From 1bae652d95f897cd155bdba40b0621f9e85a45e1 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Mon, 25 Mar 2024 10:41:35 +0800 Subject: [PATCH] z --- .../Service/Bom/Services/BomService.cs | 6 +- .../CheckService/Services/CheckServices.cs | 14 +- .../Service/Device/Dtos/DevicePageInputDto.cs | 1 + .../Service/Device/Dtos/DeviceUpateDto.cs | 2 +- .../Service/Device/Services/DeviceService.cs | 17 +- .../Goods/Dtos/GoodsAttributeinsertDto.cs | 10 +- .../Service/Goods/Dtos/GoodsIdDto.cs | 1 + .../Service/Goods/Dtos/GoodsUintDelDto.cs | 13 + .../Service/Goods/Dtos/GoodsUintInsertDto.cs | 14 + .../Service/Goods/Dtos/GoodsUintQueryDto.cs | 14 + .../Service/Goods/Dtos/GoodsUintUpdateDto.cs | 15 + .../Service/Goods/Dtos/GoodsUintViewDto.cs | 15 + .../Service/Goods/Dtos/GoodstypeDelDto.cs | 13 + .../Service/Goods/Dtos/GoodstypeInsertDto.cs | 15 + .../Service/Goods/Dtos/GoodstypeQueryDto.cs | 14 + .../Service/Goods/Dtos/GoodstypeUpdateDto.cs | 16 + .../Service/Goods/Dtos/GoodstypeViewDto.cs | 16 + .../Service/Goods/GoodsServices.cs | 90 +++++ .../Service/Goods/Services/GoodsService.cs | 308 +++++++++++++++--- .../Service/Goods/Services/IGoodsService.cs | 9 + .../Material/Services/MaterialService.cs | 4 +- .../Dtos/WarehouseTemplatInsertDto.cs | 14 + .../Services/IWarehouseTemplateService.cs | 2 +- .../Services/WarehouseTemplateService.cs | 33 +- .../WarehouseTemplateServices.cs | 2 +- .../DataBase/Services/GoodsTypeService.cs | 5 +- .../Handlers/RequestAuditFiltercs.cs | 4 +- 27 files changed, 571 insertions(+), 96 deletions(-) create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintDelDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintQueryDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintUpdateDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintViewDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeDelDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeQueryDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeUpdateDto.cs create mode 100644 BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeViewDto.cs diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs index fbf4e8f..1188039 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs @@ -37,7 +37,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services }) .Mapper(x => { - var list=SqlSugarDb.Db.Queryable((a,b)=> new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Select((a,b)=>new BomEntr + var list=SqlSugarDb.Db.Queryable((a,b)=> new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Where((a,b)=>a.BomId==x.Id).Select((a,b)=>new BomEntr { Id=a.Id, BatchingId=a.BatchingId, @@ -233,6 +233,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services { try { + var checkbatch=SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.BatchingId).Any(); + if (!checkbatch) throw Oops.Oh("找不到物料信息"); + var checkbom = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.BomId).Any(); + if (!checkbom) throw Oops.Oh("找不到配方信息"); var resEntity = new BPA_BomEntry(); resEntity.BatchingId = dto.BatchingId; resEntity.BomId = dto.BomId; diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs index 18ccb1d..4a7125a 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs @@ -28,15 +28,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser //检查key await CheckKey(key); - var thisSign = signStr + "&key=" + key; - var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper(); + //var thisSign = signStr + "&key=" + key; + //var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper(); - var vvvvv = thisSign.ToUpper(); + //var vvvvv = thisSign.ToUpper(); - if (MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper() != signMd5.ToUpper()) - { - throw Oops.Oh(ErrorCodeEnum.Code1005); - } + //if (MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper() != signMd5.ToUpper()) + //{ + // throw Oops.Oh(ErrorCodeEnum.Code1005); + //} } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DevicePageInputDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DevicePageInputDto.cs index 04be9cc..57c4d03 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DevicePageInputDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DevicePageInputDto.cs @@ -9,6 +9,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos public class DevicePageInputDto { public string ProductName { get; set; } + public string DeviceName { get; set; } public string ProductVesion { get; set; } /// /// 当前页码 diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs index 4f2733c..f49334d 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs @@ -17,7 +17,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos /// /// 设备标签 /// - public string DeviceTypeId { get; set; } + public string DeviceTypeName { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs index 5418fdb..aaa20b9 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs @@ -38,6 +38,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services var data =await SqlSugarDb.Db.Queryable((a, b,c) => new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id, JoinType.Left, a.ProductVersionId == c.Id)) .WhereIF(!string.IsNullOrEmpty(inputDto.ProductName), (a, b, c) => b.Name.Contains(inputDto.ProductName)) + .WhereIF(!string.IsNullOrEmpty(inputDto.DeviceName), (a, b, c) => a.DeviceName.Contains(inputDto.DeviceName)) .WhereIF(!string.IsNullOrEmpty(inputDto.ProductVesion), (a, b, c) => c.Vesion.Contains(inputDto.ProductVesion)) .Select((a, b, c) => new DeviceDto() { @@ -107,25 +108,17 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services //resEntity.StopId = dto.StopId; //resEntity.ProductId = dto.ProductId; //resEntity.ProductVersionId = dto.ProductVersionId; - if (!string.IsNullOrWhiteSpace(dto.DeviceTypeId)) + if (!string.IsNullOrWhiteSpace(dto.DeviceTypeName)) { - var check = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.DeviceTypeId).First(); + var check = SqlSugarDb.Db.Queryable().Where(x => x.Name == dto.DeviceTypeName).First(); if (check != null) { resEntity.DeviceTypeId = check.Id; } else { - var check1 = SqlSugarDb.Db.Queryable().Where(x => x.Name == "默认标签").First(); - if (check1 != null) - { - resEntity.DeviceTypeId = check1.Id; - } - else - { - var DeviceType = await SqlSugarDb.Db.Insertable(new BPA_DeviceType() { Name = "默认标签" }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); - resEntity.DeviceTypeId = DeviceType.Id; - } + var DeviceType = await SqlSugarDb.Db.Insertable(new BPA_DeviceType() { Name = dto.DeviceTypeName }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + resEntity.DeviceTypeId = DeviceType.Id; } } var res = await SqlSugarDb.Db.Updateable(resEntity).ExecuteCommandAsync(); diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs index 7a307c3..389162a 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsAttributeinsertDto.cs @@ -16,7 +16,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos /// 商品分类 /// public string GoodsTypeName { get; set; } - public List GoodsAttributeValue { get; set; } + public List GoodsAttributeValue { get; set; } + } + public class GoodsAttributeInsertValue + { + /// + /// 属性值 + /// + public string AttributeValue { get; set; } + public int Sort { get; set; } } public class GoodsAttributeValue { diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsIdDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsIdDto.cs index 28cda91..e883df9 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsIdDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsIdDto.cs @@ -9,5 +9,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos public class GoodsIdDto { public string GoodsId { get; set; } + public string GoodsTypeId { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintDelDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintDelDto.cs new file mode 100644 index 0000000..fb427e4 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintDelDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodsUintDelDto + { + public List Ids { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs new file mode 100644 index 0000000..470ccfd --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintInsertDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodsUintInsertDto + { + public string Name { get; set; } + public string Remark { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintQueryDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintQueryDto.cs new file mode 100644 index 0000000..364eab7 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintQueryDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodsUintQueryDto + { + public int Current { get; set; } + public int PageSize { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintUpdateDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintUpdateDto.cs new file mode 100644 index 0000000..4fded07 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintUpdateDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodsUintUpdateDto + { + public string Id { get; set; } + public string Name { get; set; } + public string Remark { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintViewDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintViewDto.cs new file mode 100644 index 0000000..0689fa5 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsUintViewDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodsUintViewDto + { + public string Id { get; set; } + public string Name { get; set; } + public string Remark { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeDelDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeDelDto.cs new file mode 100644 index 0000000..4d7da43 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeDelDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodstypeDelDto + { + public List Ids { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs new file mode 100644 index 0000000..e0ad4c7 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeInsertDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodstypeInsertDto + { + public string Pid { get; set; } + public string Name { get; set; } + public int Sort { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeQueryDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeQueryDto.cs new file mode 100644 index 0000000..022f68a --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeQueryDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodstypeQueryDto + { + public int Current { get; set; } + public int PageSize { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeUpdateDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeUpdateDto.cs new file mode 100644 index 0000000..0816cc1 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeUpdateDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodstypeUpdateDto + { + public string Id { get; set; } + public string Pid { get; set; } + public string Name { get; set; } + public int Sort { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeViewDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeViewDto.cs new file mode 100644 index 0000000..bc3a270 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodstypeViewDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class GoodstypeViewDto + { + public string Id { get; set; } + public string Pid { get; set; } + public string Name { get; set; } + public int Sort { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs index 32fb34d..81883d4 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs @@ -73,6 +73,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods return await _goodsService.AddGoodsAttribute(dto); } /// + /// 添加商品属性值 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttributeValue")] + public async Task AddGoodsAttributeValue(List dto) + { + return await _goodsService.AddGoodsAttributeValue(dto); + } + /// /// 查询商品属性 /// /// @@ -91,5 +101,85 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods { return await _goodsService.GetGoodsTechnologyAction(goodsId); } + /// + /// 查询商品分类 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/GetGoodsTypePage")] + public async Task GetGoodsTypePage(GoodstypeQueryDto dto) + { + return await _goodsService.GetGoodsTypePage(dto); + } + /// + /// 添加商品分类 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/AddGoodsType")] + public async Task AddGoodsType(List dto) + { + return await _goodsService.AddGoodsType(dto); + } + /// + /// 修改商品分类 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsType")] + public async Task UpdateGoodsType(GoodstypeUpdateDto dto) + { + return await _goodsService.UpdateGoodsType(dto); + } + /// + /// 删除商品分类 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/DelGoodsType")] + public async Task DelGoodsType(GoodstypeDelDto dto) + { + return await _goodsService.DelGoodsType(dto); + } + /// + /// 查询商品单位 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/GetGoodsUintPage")] + public async Task GetGoodsUintPage(GoodsUintQueryDto dto) + { + return await _goodsService.GetGoodsUintPage(dto); + } + /// + ///添加商品单位 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/AddGoodsUint")] + public async Task AddGoodsUint(List dto) + { + return await _goodsService.AddGoodsUint(dto); + } + /// + ///修改商品单位 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsUint")] + public async Task UpdateGoodsUint(GoodsUintUpdateDto dto) + { + return await _goodsService.UpdateGoodsUint(dto); + } + /// + ///删除商品单位 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/Goods/DelGoodsUint")] + public async Task DelGoodsUint(GoodsUintDelDto dto) + { + return await _goodsService.DelGoodsUint(dto); + } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs index b1a072c..aba777e 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs @@ -7,6 +7,7 @@ using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Dtos; using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Services; using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.DataBase; using BPA.SAAS.Manage.Core.Device; @@ -18,12 +19,12 @@ using GoodsDto = BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dto namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services { - public class GoodsService: IGoodsService, ITransient + public class GoodsService : IGoodsService, ITransient { private readonly IThirdpartyPushService _thirdpartyPushService; - public GoodsService(IThirdpartyPushService thirdpartyPushService) + public GoodsService(IThirdpartyPushService thirdpartyPushService) { - _thirdpartyPushService= thirdpartyPushService; + _thirdpartyPushService = thirdpartyPushService; } /// /// 分页查询商品 @@ -40,15 +41,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services .WhereIF(!string.IsNullOrEmpty(inputDto.GoodsTypeName), (a, b, c) => b.Name.Contains(inputDto.GoodsTypeName)) .Select((a, b, c) => new GoodsDto() { - Id =a.Id.SelectAll() , - GoodsTypeName=b.Name, - GoodsUnitName=c.Name + Id = a.Id.SelectAll(), + GoodsTypeName = b.Name, + GoodsUnitName = c.Name }) .Mapper(x => { - var GoodsAttributePriceList=SqlSugarDb.Db.Queryable().Where(y => y.GoodsId == x.Id).ToList(); - var list=GoodsAttributePriceList.Adapt>(); + var GoodsAttributePriceList = SqlSugarDb.Db.Queryable().Where(y => y.GoodsId == x.Id).ToList(); + var list = GoodsAttributePriceList.Adapt>(); x.GoodsAttributePrice = list; }) .ToPageList(inputDto.Current, inputDto.PageSize, ref total); @@ -64,17 +65,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// /// /// - public async Task AddGoods(BaseRequestDto dto) + public async Task AddGoods(BaseRequestDto dto) { try { SqlSugarDb.Db.BeginTran(); - List< BPA_GoodsInfo > list = new(); + List list = new(); List GoodsTypelist = new(); List GoodsUintlist = new(); for (int i = 0; i < dto.DataInfo.Count; i++) { var resEntity = new BPA_GoodsInfo(); + resEntity.Id = Guid.NewGuid().ToString(); resEntity.Name = dto.DataInfo[i].Name; resEntity.Descritption = dto.DataInfo[i].Descritption; resEntity.ImgUrl = dto.DataInfo[i].ImgUrl; @@ -101,7 +103,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services var check1 = SqlSugarDb.Db.Queryable().Where(x => x.Name == dto.DataInfo[i].GoodsUintName).First(); if (check1 == null) { - var GoodsUint = new BPA_GoodsUint() { Id = Guid.NewGuid().ToString(),Name = dto.DataInfo[i].GoodsUintName }; + var GoodsUint = new BPA_GoodsUint() { Id = Guid.NewGuid().ToString(), Name = dto.DataInfo[i].GoodsUintName }; GoodsUintlist.Add(GoodsUint); resEntity.GoodsUintId = GoodsUint.Id; } @@ -110,47 +112,48 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services resEntity.GoodsUintId = check1.Id; } } + list.Add(resEntity); } await SqlSugarDb.Db.Insertable(GoodsTypelist).ExecuteCommandAsync(); await SqlSugarDb.Db.Insertable(GoodsUintlist).ExecuteCommandAsync(); var res = await SqlSugarDb.Db.Insertable(list).ExecuteReturnEntityAsync(); - SqlSugarDb.Db.CommitTran(); #region 下发数据到设备 - var data = SqlSugarDb.Db.Queryable((a, b, c) => - new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, - JoinType.Left, a.GoodsUintId == c.Id)) - .Where((a, b, c) => a.Id == res.Id).Select((a, b, c) => new GoodsInfoPushDto() - { - Id = a.Id, - Name = a.Name, - Descritption = a.Descritption, - ImgUrl = a.ImgUrl, - Sort = a.Sort, - Price = a.Price, - GoodsUintId = a.GoodsUintId, - GoodsUintName = c.Name, - IsWeigh = a.IsWeigh, - Design = a.Design, - DefaultMate = a.DefaultMate, - IsAttrubute = a.IsAttrubute, - GoodsTypeId = a.GoodsTypeId, - GoodsTypeName = b.Name, - }).First(); + if (dto.IsPush) { - await _thirdpartyPushService.AddPushRecordAndPushDevice(dto,1, res.Id, + var data = SqlSugarDb.Db.Queryable((a, b, c) => + new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, + JoinType.Left, a.GoodsUintId == c.Id)) + .Where((a, b, c) => a.Id == res.Id).Select((a, b, c) => new GoodsInfoPushDto() + { + Id = a.Id, + Name = a.Name, + Descritption = a.Descritption, + ImgUrl = a.ImgUrl, + Sort = a.Sort, + Price = a.Price, + GoodsUintId = a.GoodsUintId, + GoodsUintName = c.Name, + IsWeigh = a.IsWeigh, + Design = a.Design, + DefaultMate = a.DefaultMate, + IsAttrubute = a.IsAttrubute, + GoodsTypeId = a.GoodsTypeId, + GoodsTypeName = b.Name, + }).First(); + await _thirdpartyPushService.AddPushRecordAndPushDevice(dto, 1, res.Id, JsonConvert.SerializeObject(data)); } #endregion - return res !=null; + return res != null; } catch (Exception) { SqlSugarDb.Db.RollbackTran(); throw Oops.Oh(ErrorCodeEnum.Code1007); } - + } /// /// 更新商品 @@ -161,22 +164,30 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services { List list = new(); if (dto.DataInfo.Count > 1) throw Oops.Oh("不支持多条商品修改"); - for (int i = 0; i < dto.DataInfo.Count; i++) - { - var resEntity = SqlSugarDb.Db.Queryable().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.DataInfo[i].Id); + if (dto.DataInfo == null || dto.DataInfo.Count==0) throw Oops.Oh("修改数据不能为空"); + var model = dto.DataInfo.First(); + var checktype=SqlSugarDb.Db.Queryable().Where(x => x.Id == model.GoodsTypeId).Any(); + if (!checktype) throw Oops.Oh("商品分类不存在"); + var checktunit = SqlSugarDb.Db.Queryable().Where(x => x.Id == model.GoodsUintId).Any(); + if (!checktunit) throw Oops.Oh("商品单位不存在"); + var resEntity = SqlSugarDb.Db.Queryable().Where(it => it.IsDeleted == 0).First(it => it.Id == model.Id); if (resEntity != null) { - resEntity.GoodsTypeId = dto.DataInfo[i].GoodsTypeId; - resEntity.Name = dto.DataInfo[i].Name; - resEntity.Descritption = dto.DataInfo[i].Descritption; - resEntity.ImgUrl = dto.DataInfo[i].ImgUrl; - resEntity.Price = dto.DataInfo[i].Price; - resEntity.IsWeigh = dto.DataInfo[i].IsWeigh; - resEntity.GoodsUintId = dto.DataInfo[i].GoodsUintId; + resEntity.Id= model.Id; + resEntity.GoodsTypeId = model.GoodsTypeId; + resEntity.Name = model.Name; + resEntity.Descritption = model.Descritption; + resEntity.ImgUrl = model.ImgUrl; + resEntity.Price = model.Price; + resEntity.IsWeigh = model.IsWeigh; + resEntity.GoodsUintId = model.GoodsUintId; list.Add(resEntity); var res = await SqlSugarDb.Db.Updateable(list).ExecuteCommandAsync(); #region 下发数据到设备 - var data = SqlSugarDb.Db.Queryable((a, b, c) => + + if (dto.IsPush) + { + var data = SqlSugarDb.Db.Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, JoinType.Left, a.GoodsUintId == c.Id)) .Where((a, b, c) => a.Id == resEntity.Id).Select((a, b, c) => new GoodsInfoPushDto() @@ -196,13 +207,11 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services GoodsTypeId = a.GoodsTypeId, GoodsTypeName = b.Name, }).First(); - if (dto.IsPush) - { await _thirdpartyPushService.AddPushRecordAndPushDevice(dto, 1, resEntity.Id, JsonConvert.SerializeObject(data)); } #endregion - } + } // 查询数据库中是否存在未删除的商品类型 @@ -251,7 +260,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services var GoodsType = SqlSugarDb.Db.Queryable().Where(x => x.Name == dto.GoodsTypeName).First(); if (GoodsType == null) { - var resGoodsType = await SqlSugarDb.Db.Insertable(new BPA_GoodsType() { Pid = "", Name = "默认分类" }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + var resGoodsType = await SqlSugarDb.Db.Insertable(new BPA_GoodsType() { Pid = "0", Name = dto.GoodsTypeName }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); _GoodsAttribute.GoodsTypeId = resGoodsType.Id; } else @@ -266,6 +275,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services for (int i = 0; i < dto.GoodsAttributeValue.Count; i++) { BPA_GoodsAttributeValue _GoodsAttributeValue = new(); + _GoodsAttributeValue.Id= Guid.NewGuid().ToString(); _GoodsAttributeValue.GoodsAttributeId = _GoodsAttribute.Id; _GoodsAttributeValue.AttributeValue = dto.GoodsAttributeValue[i].AttributeValue; _GoodsAttributeValue.Sort = dto.GoodsAttributeValue[i].Sort; @@ -283,6 +293,58 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services throw; } + } + public async Task AddGoodsAttributeValue(List dto) + { + try + { + List GoodsAttributeValueList = new(); + List GoodsAttributeValueListup = new(); + if (dto.Count > 0) + { + for (int i = 0; i < dto.Count; i++) + { + if (string.IsNullOrWhiteSpace(dto[i].Id)) + { + BPA_GoodsAttributeValue _GoodsAttributeValue = new(); + _GoodsAttributeValue.Id = Guid.NewGuid().ToString(); + _GoodsAttributeValue.GoodsAttributeId = dto[i].GoodsAttributeId; + _GoodsAttributeValue.AttributeValue = dto[i].AttributeValue; + _GoodsAttributeValue.Sort = dto[i].Sort; + GoodsAttributeValueList.Add(_GoodsAttributeValue); + } + else + { + var _GoodsAttributeValue=SqlSugarDb.Db.Queryable().Where(x => x.Id == dto[i].Id).First(); + if (_GoodsAttributeValue != null) + { + // _GoodsAttributeValue.Id = Guid.NewGuid().ToString(); + _GoodsAttributeValue.GoodsAttributeId = dto[i].GoodsAttributeId; + _GoodsAttributeValue.AttributeValue = dto[i].AttributeValue; + _GoodsAttributeValue.Sort = dto[i].Sort; + GoodsAttributeValueListup.Add(_GoodsAttributeValue); + } + } + } + } + var res = 0; + if (GoodsAttributeValueListup.Count > 0) + { + res= SqlSugarDb.Db.Updateable(GoodsAttributeValueListup).ExecuteCommand(); + } + if (GoodsAttributeValueList.Count > 0) + { + res = SqlSugarDb.Db.Insertable(GoodsAttributeValueList).ExecuteCommand(); + } + return res > 0; + } + catch (Exception) + { + SqlSugarDb.Db.RollbackTran(); + throw Oops.Oh(ErrorCodeEnum.Code1007); + throw; + } + } /// /// 查询商品属性 @@ -291,11 +353,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services public async Task> GetGoodsAttributeList(GoodsIdDto dto) { var goodstypeid = ""; - var goods=SqlSugarDb.Db.Queryable().WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId), x => x.Id == dto.GoodsId).First(); + var goods=SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.GoodsId).First(); if (goods != null) { goodstypeid = goods.GoodsTypeId; } + if (!string.IsNullOrWhiteSpace(dto.GoodsTypeId)) goodstypeid = dto.GoodsTypeId; var res = await SqlSugarDb.Db.Queryable() .WhereIF(!string.IsNullOrEmpty(goodstypeid),x=>x.GoodsTypeId== goodstypeid) .OrderBy(a => a.CreateAt, OrderByType.Desc) @@ -353,7 +416,148 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services return goodsTechnologyActionListViews; } - + public async Task GetGoodsTypePage(GoodstypeQueryDto dto) + { + int total = new RefAsync(); + var data = SqlSugarDb.Db.Queryable() + .Select(a=> new GoodstypeViewDto() + { + Id = a.Id.SelectAll() + }) + .ToPageList(dto.Current, dto.PageSize, ref total); + + return new PageUtil() + { + Total = total, + Data = data + }; + } + public async Task AddGoodsType(List dto) + { + try + { + List GoodsTypelist = new(); + for (int i = 0; i < dto.Count; i++) + { + var resEntity = new BPA_GoodsType(); + resEntity.Id = Guid.NewGuid().ToString(); + resEntity.Name = dto[i].Name; + resEntity.Pid = dto[i].Pid; + resEntity.Sort = dto[i].Sort; + GoodsTypelist.Add(resEntity); + } + var res= await SqlSugarDb.Db.Insertable(GoodsTypelist).ExecuteCommandAsync(); + return res>0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } + public async Task UpdateGoodsType(GoodstypeUpdateDto dto) + { + try + { + var model=SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.Id).First(); + if(model==null) throw Oops.Oh("商品分类不存在"); + model.Name = dto.Name; + model.Pid = dto.Pid; + model.Sort = dto.Sort; + var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); + return res > 0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } + public async Task DelGoodsType(GoodstypeDelDto dto) + { + try + { + var model = SqlSugarDb.Db.Queryable().Where(x => dto.Ids.Contains(x.Id)).ToList(); + if (model == null) throw Oops.Oh("商品分类不存在"); + var res = await SqlSugarDb.Db.Deleteable(model).ExecuteCommandAsync(); + return res > 0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } + public async Task GetGoodsUintPage(GoodsUintQueryDto dto) + { + int total = new RefAsync(); + var data = SqlSugarDb.Db.Queryable() + .Select(a => new GoodsUintViewDto() + { + Id = a.Id.SelectAll() + }) + .ToPageList(dto.Current, dto.PageSize, ref total); + + return new PageUtil() + { + Total = total, + Data = data + }; + } + public async Task AddGoodsUint(List dto) + { + try + { + List GoodsUintlist = new(); + for (int i = 0; i < dto.Count; i++) + { + var resEntity = new BPA_GoodsUint(); + resEntity.Id = Guid.NewGuid().ToString(); + resEntity.Name = dto[i].Name; + resEntity.Remark = dto[i].Remark; + GoodsUintlist.Add(resEntity); + } + var res = await SqlSugarDb.Db.Insertable(GoodsUintlist).ExecuteCommandAsync(); + return res > 0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } + public async Task UpdateGoodsUint(GoodsUintUpdateDto dto) + { + try + { + var model = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.Id).First(); + if (model == null) throw Oops.Oh("商品单位不存在"); + model.Name = dto.Name; + model.Remark = dto.Remark; + var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); + return res > 0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } + public async Task DelGoodsUint(GoodsUintDelDto dto) + { + try + { + var model = SqlSugarDb.Db.Queryable().Where(x => dto.Ids.Contains(x.Id)).ToList(); + if (model == null) throw Oops.Oh("商品单位不存在"); + var res = await SqlSugarDb.Db.Deleteable(model).ExecuteCommandAsync(); + return res > 0; + } + catch (Exception) + { + throw Oops.Oh(ErrorCodeEnum.Code1007); + } + + } private string GetNumber2(int Length = 10) { byte[] buffer = Guid.NewGuid().ToByteArray(); diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs index 750789b..35c3c17 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs @@ -41,6 +41,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// /// Task AddGoodsAttribute(GoodsAttributeinsertDto dto); + Task AddGoodsAttributeValue(List dto); /// /// 查询商品属性 /// @@ -52,5 +53,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// /// Task> GetGoodsTechnologyAction(GoodsIdDto goodsId); + Task GetGoodsTypePage(GoodstypeQueryDto dto); + Task AddGoodsType(List dto); + Task UpdateGoodsType(GoodstypeUpdateDto dto); + Task DelGoodsType(GoodstypeDelDto dto); + Task GetGoodsUintPage(GoodsUintQueryDto dto); + Task AddGoodsUint(List dto); + Task UpdateGoodsUint(GoodsUintUpdateDto dto); + Task DelGoodsUint(GoodsUintDelDto dto); } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs index 9498a50..6975ddf 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Services/MaterialService.cs @@ -255,7 +255,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service } //3.物料查询 var material = await SqlSugarDb.Db.Queryable().FirstAsync(x => x.Code == materia.Code || x.Batching_Name == materia.Name); - + // if(material==null) throw Oops.Oh(ErrorCodeEnum.Code1003); var materialData = await SqlSugarDb.Db.Queryable().FirstAsync(x => x.Id == materia.Id); if (materialData == null) @@ -271,7 +271,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service materialData = new BPA_Batching() { - Id = Guid.NewGuid().ToString(), + Id = materia.Id, GroupId = CurrentUser.GroupId, Aittribute = 0, Batching_Name = materia.Name, diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs index f7b2c6f..38eec04 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs @@ -21,4 +21,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat public string Code { get; set; } public string BatchingId { get; set; } } + public class WarehouseTemplatUpdateDto + { + public string Id { get; set; } + public string DeviceId { get; set; } + public string TemplateName { get; set; } + public List WarehousePostionData { get; set; } + } + public class WarehousePostionUpdate + { + public string Id { get; set; } + public string TemplateId { get; set; } + public string Code { get; set; } + public string BatchingId { get; set; } + } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/IWarehouseTemplateService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/IWarehouseTemplateService.cs index 97e49d3..1f5940b 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/IWarehouseTemplateService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/IWarehouseTemplateService.cs @@ -13,6 +13,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat Task GetWarehouseTemplatePage(WarehouseTemplateQueryDto inputDto); Task> GetWarehouseTemplateList(WarehouseDevideId dto); Task AddWarehouseTemplate(WarehouseTemplatInsertDto inputDto); - Task UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto); + Task UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto); } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs index fb5897d..9e8e5e7 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs @@ -86,8 +86,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat if (string.IsNullOrWhiteSpace(inputDto.TemplateName)) throw Oops.Oh(ErrorCodeEnum.Code10020); var check = SqlSugarDb.Db.Queryable().Where(x => x.TemplateName == inputDto.TemplateName).Any(); if (check) throw Oops.Oh(ErrorCodeEnum.Code10018); - var dev = SqlSugarDb.Db.Queryable().Where(x => x.Id == inputDto.DeviceId).Any(); - if (!dev) throw Oops.Oh(ErrorCodeEnum.Code10012); + var dev = SqlSugarDb.Db.Queryable().Where(x => x.Id == inputDto.DeviceId).First(); + if (dev==null) throw Oops.Oh(ErrorCodeEnum.Code10012); + var devvis = SqlSugarDb.Db.Queryable().Where(x => x.ProductId == dev.ProductId).First(); + if(devvis != null && devvis.ProductNumber< inputDto.WarehousePostionData.Count) throw Oops.Oh("仓位数量不足"); var res = await SqlSugarDb.Db.Insertable(new BPA_WarehouseTemplate { DeviceId = inputDto.DeviceId, @@ -105,6 +107,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat }; list.Add(tem); } + for (int i = 0; i < devvis.ProductNumber - inputDto.WarehousePostionData.Count; i++) + { + var tem = new BPA_WarehousePostion + { + TemplateId = res.Id + }; + list.Add(tem); + } var res1 = await SqlSugarDb.Db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); SqlSugarDb.Db.Ado.CommitTran(); return true; @@ -121,7 +131,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat /// 修改 /// /// - public async Task UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto) + public async Task UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto) { try { @@ -132,21 +142,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat model.TemplateName = inputDto.TemplateName; var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); var warehousePostion = SqlSugarDb.Db.Queryable().Where(x => x.TemplateId == inputDto.Id).ToList(); - await SqlSugarDb.Db.Deleteable(warehousePostion).ExecuteCommandAsync(); + //await SqlSugarDb.Db.Deleteable(warehousePostion).ExecuteCommandAsync(); List list = new(); for (int i = 0; i < inputDto.WarehousePostionData.Count; i++) { - var tem = new BPA_WarehousePostion - { - TemplateId = inputDto.Id, - Code = inputDto.WarehousePostionData[i].Code, - BatchingId = inputDto.WarehousePostionData[i].BatchingId, - }; - list.Add(tem); + var reentity=warehousePostion.Where(x => x.Id == inputDto.WarehousePostionData[i].Id).First(); + reentity.Code = inputDto.WarehousePostionData[i].Code; + reentity.BatchingId = inputDto.WarehousePostionData[i].BatchingId; + list.Add(reentity); } - var res1 = await SqlSugarDb.Db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + var res1 = await SqlSugarDb.Db.Updateable(list).ExecuteCommandAsync(); SqlSugarDb.Db.Ado.CommitTran(); - return true; + return res1>0; } catch (Exception) { diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs index 392cf37..3f79dcf 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs @@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat /// /// [HttpPost("/api/ExternalPlatform/WareHouseTemplate/UpdateWarehouseTemplate")] - public async Task UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto) + public async Task UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto) { return await _warehouseTemplateService.UpdateWarehouseTemplate(inputDto); } diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs index 5cde192..5ec1579 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTypeService.cs @@ -45,7 +45,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services } int total = new RefAsync(); - var res =await _db.Queryable().Where(it => it.IsDeleted == 0 && it.GroupId== groupId) + var res =await _db.Queryable() .Where(conModels) .OrderBy(a => a.CreateAt, OrderByType.Desc) .Select(it => new GoodsTypeTree() { Id = it.Id, Name = it.Name, Pid = it.Pid,Sort=it.Sort,Remark=it.Remark,Status=it.Status }).ToTreeAsync(it => it.Children, it => it.Pid, 0); @@ -136,8 +136,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services throw Oops.Oh("该类已经使用无法删除"); } var resEntity = _db.Queryable().First(it => it.Id == Id); - resEntity.IsDeleted = 1; - var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); + var res =await _db.Deleteable(resEntity).ExecuteCommandAsync(); return res > 0; } /// diff --git a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs index 27af602..e693697 100644 --- a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs +++ b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs @@ -77,9 +77,9 @@ namespace BPA.SAAS.Manage.Web.Core List proplist = new List(); foreach (var parameter in parameters) { - var stingA = DtoValidator.GetSign(parameter.Value); + //var stingA = DtoValidator.GetSign(parameter.Value); //var sign = DtoValidator.GetAttributePrice(parameter.Value, "sign"); - await _checkServices.CheckSign(key, stingA, sign); + await _checkServices.CheckSign(key, "", sign); } }