Browse Source

Merge branch 'master' into kitchenmanage

tmp
zhaoy 9 months ago
parent
commit
ef968f685e
10 changed files with 34 additions and 322 deletions
  1. +1
    -5
      BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs
  2. +19
    -5
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  3. +0
    -279
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs
  4. +1
    -5
      BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
  5. +2
    -5
      BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs
  6. +2
    -5
      BPA.SAAS.Manage.Application/Device/Services/ProductTopicsService.cs
  7. +1
    -5
      BPA.SAAS.Manage.Application/Org/Services/UserService.cs
  8. +1
    -5
      BPA.SAAS.Manage.Application/System/Services/DictDataService.cs
  9. +2
    -4
      BPA.SAAS.Manage.Application/System/Services/DictTypeService.cs
  10. +5
    -4
      BPA.SAAS.Manage.Application/System/Services/MenuService.cs

+ 1
- 5
BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs View File

@@ -211,11 +211,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
// 查询数据库中是否存在未删除的活动信息
var resEntitites = _db.Queryable<BPA_Batching>().In(Ids).ToList();
resEntitites.ForEach(x =>
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
return res>0;
}


+ 19
- 5
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs View File

@@ -189,11 +189,25 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
/// <returns></returns>
public async Task<bool> DeleteGoods(string id)
{
var goods = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id== id).First();
if (goods == null) throw Oops.Oh("商品不存在");
goods.IsDeleted = 1;
var res = await _db.Updateable(goods).ExecuteCommandAsync();
return res > 0;
try
{
_db.Ado.BeginTran();
var goods = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == id).First();
if (goods == null) throw Oops.Oh("商品不存在");
var goodsbom = _db.Queryable<BPA_GoodsBom>().Where(x => x.Goods_Id == id).ToList();
var goodsTechnology = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == id).ToList();
await _db.Deleteable(goodsbom).ExecuteCommandAsync();
await _db.Deleteable(goodsTechnology).ExecuteCommandAsync();
var res = await _db.Deleteable(goods).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
catch (Exception)
{
_db.Ado.RollbackTran();
throw Oops.Oh("删除失败");
}
}
/// <summary>
/// 查询商品单位


+ 0
- 279
BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs View File

@@ -20,285 +20,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
_db = db;
}
//#region 配方工艺流程
///// <summary>
///// 获取工艺流程
///// </summary>
///// <param name="inputDto"></param>
///// <returns></returns>
//public PageUtil GetBomTechnologyPage(PageInputBase inputDto)
//{
// int total = new RefAsync<int>();
// var res = _db.Queryable<BPA_BomTechnology, BPA_BOMEntry, BPA_Batching>((a, b, c) => new
// JoinQueryInfos(JoinType.Left, a.BomentryId == b.Id, JoinType.Left, b.BatchingId == c.Id)
// ).Where((a, b, c) => a.IsDeleted == 0 && a.ChnologyId == inputDto.chnologyId && a.GroupId == groupId)
// .WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomId), (a, b, c) => b.BomId == inputDto.bomId)
// .OrderBy(a => a.Sort, OrderByType.Asc)
// .Select((a, b, c) => new
// {
// Id = a.Id,
// BatchingId = a.BomentryId,
// ChnologyId = a.ChnologyId,
// BatchingName = c.Batching_Name,
// BomQty = b.BomQty,
// TotalCount = a.TotalCount,
// Sort = a.Sort
// }).ToPageList(inputDto.Current, inputDto.PageSize, ref total);
// return new PageUtil()
// {
// Data = res,
// Total = total
// };
//}
///// <summary>
///// 添加工艺流程
///// </summary>
///// <param name="inputDto"></param>
///// <returns></returns>
//public async Task<bool> AddBomTechnology(List<BomTechnologyBaseDto> inputDto)
//{
// var groupId = string.IsNullOrWhiteSpace(CurrentUser.TenantId)
// ? App.User?.FindFirst(ClaimConst.GroupId)?.Value
// : CurrentUser.TenantId;
// var res = 0;
// var addlist = new List<BPA_BomTechnology>();
// var uplist = new List<BPA_BomTechnology>();
// var list = _db.Queryable<BPA_BomTechnology>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList();
// for (int i = 0; i < inputDto.Count; i++)
// {
// if (list.Count > 0)
// {
// var model = list.Where(a => a.BomentryId == inputDto[i].BatchingId && a.IsDeleted == 0 && a.ChnologyId == inputDto[i].ChnologyId).FirstOrDefault();
// if (model != null)
// {
// model.BomentryId = inputDto[i].BatchingId;
// model.Sort = inputDto[i].Sort;
// model.TotalCount = inputDto[i].total;
// uplist.Add(model);
// }
// else
// {
// var data = new BPA_BomTechnology()
// {
// Id = Guid.NewGuid().ToString(),
// BomentryId = inputDto[i].BatchingId,
// ChnologyId = inputDto[i].ChnologyId,
// Sort = inputDto[i].Sort,
// CreateAt = DateTime.Now,
// GroupId = groupId,
// IsDeleted = 0,
// TotalCount = inputDto[i].total
// };
// addlist.Add(data);
// }
// }
// else
// {
// var data = new BPA_BomTechnology()
// {
// Id = Guid.NewGuid().ToString(),
// BomentryId = inputDto[i].BatchingId,
// ChnologyId = inputDto[i].ChnologyId,
// Sort = inputDto[i].Sort,
// CreateAt = DateTime.Now,
// GroupId = groupId,
// IsDeleted = 0,
// };
// addlist.Add(data);
// }
// }
// if (addlist.Count > 0)
// {
// res = await _db.Insertable(addlist).ExecuteCommandAsync();
// }
// if (uplist.Count > 0)
// {
// res = await _db.Updateable(uplist).ExecuteCommandAsync();
// }

// return res > 0;
//}
///// <summary>
///// 修改工艺流程
///// </summary>
///// <param name="inputDto"></param>
///// <returns></returns>
//public bool UpdateBomTechnology(BomTechnologyBaseDto inputDto)
//{
// var check = _db.Queryable<BPA_BomTechnology>().Any(a => a.BomentryId == inputDto.BatchingId && a.IsDeleted == 0 && a.ChnologyId == inputDto.ChnologyId && a.Id != inputDto.Id);
// if (check) throw Oops.Oh("工艺流程已存在");
// var data = _db.Queryable<BPA_BomTechnology>().Where(a => a.Id == inputDto.Id).First();
// if (data == null) throw Oops.Oh("工艺流程不存在");
// data.BomentryId = inputDto.BatchingId;
// data.ChnologyId = inputDto.ChnologyId;
// data.Sort = inputDto.Sort;
// var res = _db.Updateable(data).ExecuteCommand();
// return res > 0;
//}
///// <summary>
///// 删除工艺流程
///// </summary>
///// <param name="ids"></param>
///// <returns></returns>
//public bool DeleteBomTechnology(List<string> ids)
//{
// var resEntity = _db.Queryable<BPA_BomTechnology>().Where(x => ids.Contains(x.Id)).ToList();
// foreach (var item in resEntity)
// {
// item.IsDeleted = 1;
// }
// var res = _db.Updateable(resEntity).ExecuteCommand();
// return res > 0;
//}
//#endregion
//#region 配方工艺动作
///// <summary>
///// 查询配方工艺流程动作
///// </summary>
///// <returns></returns>
//public BPA_BomTechnologyAction GetBomTechnologyAction(BomTechnologyActionBase dto)
//{
// var res = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.IsDeleted == 0 && x.BomId == dto.BomId && x.ChnologyId == dto.ChnologyId && x.GroupId == groupId)
// .OrderBy(i => i.Sort, OrderByType.Desc)
// .First();
// return res;
//}
//public async Task<List<BPA_BomTechnologyAction>> GetBomTechnologyActionList(string BomId)
//{
// var res = await _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.IsDeleted == 0 && x.BomId == BomId && x.GroupId == groupId)
// .OrderBy(i => i.Sort, OrderByType.Asc)
// .ToListAsync();
// return res;
//}
//public BPA_BomTechnologyAction GetBomTechnologyActionById(string id)
//{
// var res = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.Id == id)
// .OrderBy(i => i.Sort, OrderByType.Desc)
// .First();
// return res;
//}

///// <summary>
///// 添加配方工艺流程动作步骤
///// </summary>
///// <param name="inputDto"></param>
///// <returns></returns>
//public async Task<bool> AddBomTechnologyAction(BomTechnologyActionBaseDto inputDto)
//{
// var res = 0;
// var addlist = new BPA_BomTechnologyAction();
// var uplist = new BPA_BomTechnologyAction();
// var list = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList();

// if (inputDto != null)
// {

// if (list.Count > 0)
// {
// var sort = list.Max(x => x.Sort);
// var model = list.Where(a => a.BomId == inputDto.BomId && a.IsDeleted == 0 && a.ChnologyId == inputDto.ChnologyId && a.BomId == inputDto.BomId).FirstOrDefault();
// if (string.IsNullOrEmpty(inputDto.Id))
// {
// model = null;
// }
// if (model != null)
// {
// model.ActionJson = inputDto.ActionJson;
// model.StepName = inputDto.StepName;
// uplist = model;
// }
// else
// {
// var data = new BPA_BomTechnologyAction()
// {
// Id = Guid.NewGuid().ToString(),
// ActionJson = inputDto.ActionJson,
// ChnologyId = inputDto.ChnologyId,
// StepName = inputDto.StepName,
// CreateAt = DateTime.Now,
// GroupId = groupId,
// IsDeleted = 0,
// BomId = inputDto.BomId,
// Sort = sort + 1,
// IsBatch = inputDto.IsBatch
// };
// addlist = data;
// }
// }
// else
// {
// var data = new BPA_BomTechnologyAction()
// {
// Id = Guid.NewGuid().ToString(),
// ActionJson = inputDto.ActionJson,
// StepName = inputDto.StepName,
// ChnologyId = inputDto.ChnologyId,
// CreateAt = DateTime.Now,
// GroupId = groupId,
// IsDeleted = 0,
// BomId = inputDto.BomId,
// Sort = 1,
// IsBatch = inputDto.IsBatch
// };
// addlist = data;
// }
// }
// if (!string.IsNullOrWhiteSpace(addlist.ActionJson))
// {
// res = await _db.Insertable(addlist).ExecuteCommandAsync();
// }
// if (!string.IsNullOrWhiteSpace(uplist.ActionJson))
// {
// res = await _db.Updateable(uplist).ExecuteCommandAsync();

// }
// return res > 0;
//}

///// <summary>
///// 删除工艺动作步骤
///// </summary>
///// <param name="ids"></param>
///// <returns></returns>
//public async Task<bool> DeleteBomTechnologyAction(string ids)
//{
// var resEntity = _db.Queryable<BPA_BomTechnologyAction>().Where(x => ids == x.Id).First();
// if (resEntity == null) throw Oops.Oh("工艺流程不存在");
// if (resEntity.IsBatch)
// {
// //如果是绑定的是物料的步骤 则删除物料步骤相关表数据
// var resEntitywl = _db.Queryable<BPA_BomTechnology>().Where(x => resEntity.ChnologyId.Contains(x.ChnologyId) && x.GroupId == groupId).ToList();
// foreach (var item in resEntitywl)
// {
// item.IsDeleted = 1;
// }
// await _db.Updateable(resEntitywl).ExecuteCommandAsync();
// }
// resEntity.IsDeleted = 1;
// var res = await _db.Updateable(resEntity).ExecuteCommandAsync();
// return res > 0;
//}
///// <summary>
///// 排序
///// </summary>
///// <param name="updateSortDtos"></param>
///// <returns></returns>
//public async Task<bool> UpdateSortBomTechnologyAction(List<UpdateSortDto> updateSortDtos)
//{
// try
// {
// var ids = updateSortDtos.Select(p => p.id).ToArray();
// var list = _db.Queryable<BPA_BomTechnologyAction>().Where(x => ids.Contains(x.Id)).ToList();
// list.ForEach(x => x.Sort = updateSortDtos.Where(p => p.id == x.Id).FirstOrDefault().sort);
// return await _db.Updateable(list).ExecuteCommandAsync() > 0;
// }
// catch (Exception e)
// {
// throw Oops.Oh("更新出错");
// }
//}
//#endregion
#region 商品工艺(新版本工艺制作)
/// <summary>
/// 添加商品工艺


+ 1
- 5
BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs View File

@@ -130,11 +130,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<bool> DelDeviceInfo(List<string> inputList)
{
var data = await _db.Queryable<BPA_DeviceInfo>().Where(x => inputList.Contains(x.Id)).ToListAsync();
foreach (var item in data)
{
item.IsDeleted = 1;
}
var res = await _db.Updateable(data) .ExecuteCommandAsync();
var res = await _db.Deleteable(data) .ExecuteCommandAsync();
return res > 0;
}
/// <summary>


+ 2
- 5
BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs View File

@@ -158,11 +158,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<bool> DeleteProductFunction(List<string> ids)
{
var resEntity = _db.Queryable<BPA_ProductFunction>().Where(x => ids.Contains(x.Id)).ToList();
foreach (var item in resEntity)
{
item.IsDeleted = 1;
}
var res =await _db.Updateable(resEntity).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntity).ExecuteCommandAsync();
return res > 0;
}
#endregion


+ 2
- 5
BPA.SAAS.Manage.Application/Device/Services/ProductTopicsService.cs View File

@@ -86,11 +86,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<bool> DelProductTopics(List<string> inputList)
{
var data = await _db.Queryable<BPA_ProductTopics>().Where(x => inputList.Contains(x.Id)).ToListAsync();
foreach (var item in data)
{
item.IsDeleted = 1;
}
var res = await _db.Updateable(data).ExecuteCommandAsync();
var res = await _db.Deleteable(data).ExecuteCommandAsync();
return res > 0;
}
}


+ 1
- 5
BPA.SAAS.Manage.Application/Org/Services/UserService.cs View File

@@ -97,11 +97,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services
public async Task<bool> DeleteUser(List<string> input)
{
var resEntitites = _db.Queryable<BPA_Users>().In(input).ToList();
resEntitites.ForEach(x =>
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
return res > 0;
}



+ 1
- 5
BPA.SAAS.Manage.Application/System/Services/DictDataService.cs View File

@@ -147,11 +147,7 @@ namespace BPA.SAAS.Manage.Application
public async Task<bool> BatchDelDictData(List<string> Ids)
{
var resEntitites = _db.Queryable<BPA_DictData>().In(Ids).ToList();
resEntitites.ForEach(x =>
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
return res > 0;
}
}

+ 2
- 4
BPA.SAAS.Manage.Application/System/Services/DictTypeService.cs View File

@@ -143,10 +143,8 @@ namespace BPA.SAAS.Manage.Application.System.Services
{
_db.Ado.BeginTran();
var dictType = _db.Queryable<BPA_DictType>().Where(x => x.IsDeleted == 0).Where(x => ids.Contains(x.Id)).ToList();
dictType.ForEach(x => {
x.IsDeleted = 1;
});
var res =await _db.Updateable(dictType).ExecuteCommandAsync();
var res =await _db.Deleteable(dictType).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res>0;
}


+ 5
- 4
BPA.SAAS.Manage.Application/System/Services/MenuService.cs View File

@@ -148,11 +148,12 @@ namespace BPA.SAAS.Manage.Application.System.Services
_db.Ado.BeginTran();
// 查询数据库中是否存在未删除的活动信息
var resEntitites = _db.Queryable<BPA_Menu>().In(input).ToList();
resEntitites.ForEach(x =>
for (int i = 0; i < resEntitites.Count; i++)
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var childlist = _db.Queryable<BPA_Menu>().Where(x => x.Pid == resEntitites[i].Id).ToList();
if(childlist.Count>0) resEntitites.AddRange(childlist);
}
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res>0;
}


Loading…
Cancel
Save