diff --git a/src/WmsWebApi.Application.Contracts/Boms/BomDetailDto.cs b/src/WmsWebApi.Application.Contracts/Boms/BomDetailDto.cs index 7d5fd7b..c0cd293 100644 --- a/src/WmsWebApi.Application.Contracts/Boms/BomDetailDto.cs +++ b/src/WmsWebApi.Application.Contracts/Boms/BomDetailDto.cs @@ -2,7 +2,8 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Boms; +namespace WmsWebApi.Boms +{ public class BomDetailDto : EntityDto { @@ -37,4 +38,5 @@ public class BomDetailDto : EntityDto public string SANKA { get; set; } public string SANFE { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Boms/BomDto.cs b/src/WmsWebApi.Application.Contracts/Boms/BomDto.cs index 7ae33e2..8a9cfd8 100644 --- a/src/WmsWebApi.Application.Contracts/Boms/BomDto.cs +++ b/src/WmsWebApi.Application.Contracts/Boms/BomDto.cs @@ -5,8 +5,8 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Boms; - +namespace WmsWebApi.Boms +{ public class BomDto : EntityDto { /// @@ -59,4 +59,5 @@ public class BomDto : EntityDto public virtual List items { get; set; } -} \ No newline at end of file +} +} diff --git a/src/WmsWebApi.Application.Contracts/Boms/IBomService.cs b/src/WmsWebApi.Application.Contracts/Boms/IBomService.cs index d3501f7..c9ccb20 100644 --- a/src/WmsWebApi.Application.Contracts/Boms/IBomService.cs +++ b/src/WmsWebApi.Application.Contracts/Boms/IBomService.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.Boms; +namespace WmsWebApi.Boms { public interface IBomService : IApplicationService { @@ -12,4 +12,5 @@ public interface IBomService : IApplicationService public bool IsRequestRetry { get; set; } public Task AddAsync(object content); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Boms/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/Boms/ReturnResult.cs index ae3e316..c71776a 100644 --- a/src/WmsWebApi.Application.Contracts/Boms/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/Boms/ReturnResult.cs @@ -1,6 +1,6 @@ using System; -namespace WmsWebApi.Boms; +namespace WmsWebApi.Boms { public class ReturnResult { @@ -9,4 +9,5 @@ public class ReturnResult public string MESSAGE { get; set; } = "接收成功!"; public string REQUEST_SYSTEM { get; set; } = "WinWMS"; +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/OtherZll/IOtherZllService.cs b/src/WmsWebApi.Application.Contracts/OtherZll/IOtherZllService.cs index edf9e65..0d74044 100644 --- a/src/WmsWebApi.Application.Contracts/OtherZll/IOtherZllService.cs +++ b/src/WmsWebApi.Application.Contracts/OtherZll/IOtherZllService.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.OtherZll; +namespace WmsWebApi.OtherZll { /// /// 其他领物料 @@ -15,4 +15,6 @@ public interface IOtherZllService : IApplicationService public bool IsRequestRetry { get; set; } public Task AddAsync(object content); +} + } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/OtherZll/OtherZllDto.cs b/src/WmsWebApi.Application.Contracts/OtherZll/OtherZllDto.cs index bd99f56..a1d5ffe 100644 --- a/src/WmsWebApi.Application.Contracts/OtherZll/OtherZllDto.cs +++ b/src/WmsWebApi.Application.Contracts/OtherZll/OtherZllDto.cs @@ -5,7 +5,9 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.OtherZll; +namespace WmsWebApi.OtherZll +{ + public class OtherZllDto : EntityDto { @@ -60,4 +62,6 @@ public class OtherZllDto : EntityDto [Display(Name = "库存地点")] public string LGORT1 { get; set; } +} + } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/OtherZll/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/OtherZll/ReturnResult.cs index c0ac4ce..d4a9980 100644 --- a/src/WmsWebApi.Application.Contracts/OtherZll/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/OtherZll/ReturnResult.cs @@ -1,6 +1,6 @@ using System; -namespace WmsWebApi.OtherZll; +namespace WmsWebApi.OtherZll { public class ReturnResult { @@ -9,4 +9,5 @@ public class ReturnResult public string MESSAGE { get; set; } = "接收成功!"; public string REQUEST_SYSTEM { get; set; } = "WinWMS"; +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs b/src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs index 752870b..3361b4c 100644 --- a/src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs +++ b/src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs @@ -2,17 +2,19 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.PPLan; - -/// -/// 计划 -/// -public interface IPPlanService : IApplicationService +namespace WmsWebApi.PPLan { + /// - /// 是否是请求重试 + /// 计划 /// - public bool IsRequestRetry { get; set; } + public interface IPPlanService : IApplicationService + { + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } - public Task AddAsync(object content); + public Task AddAsync(object content); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/PPLan/PPlanDto.cs b/src/WmsWebApi.Application.Contracts/PPLan/PPlanDto.cs index c6953e9..a3b1b34 100644 --- a/src/WmsWebApi.Application.Contracts/PPLan/PPlanDto.cs +++ b/src/WmsWebApi.Application.Contracts/PPLan/PPlanDto.cs @@ -5,92 +5,94 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.PPLan; - -public class PPlanDto : EntityDto +namespace WmsWebApi.PPLan { - /// - /// 计划订单中的订单结束日期 - /// - [Display(Name = "计划订单中的订单结束日期")] - public string PEDTR { get; set; } - /// - /// 分组 - /// - [Display(Name = "分组")] - public string SCHGRUP { get; set; } - /// - /// 班次 - /// - [Display(Name = "班次")] - public string KAPTPROG { get; set; } + public class PPlanDto : EntityDto + { + /// + /// 计划订单中的订单结束日期 + /// + [Display(Name = "计划订单中的订单结束日期")] + public string PEDTR { get; set; } + /// + /// 分组 + /// + [Display(Name = "分组")] + public string SCHGRUP { get; set; } + + /// + /// 班次 + /// + [Display(Name = "班次")] + public string KAPTPROG { get; set; } - /// - /// 物料号 - /// - [Display(Name = "物料号 ")] - public string MATNR { get; set; } - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - public string MAKTX { get; set; } - /// - /// 工厂 - /// - [Display(Name = "工厂")] - public string WERKS { get; set; } + /// + /// 物料号 + /// + [Display(Name = "物料号 ")] + public string MATNR { get; set; } + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + public string MAKTX { get; set; } + /// + /// 工厂 + /// + [Display(Name = "工厂")] + public string WERKS { get; set; } - /// - /// 生产版本 - /// - [Display(Name = "生产版本")] - public string VERID { get; set; } - /// - /// 生产顺序 - /// - [Display(Name = "生产顺序")] - public string ZSCSX { get; set; } - /// - /// 机器代码 - /// - [Display(Name = "机器代码")] - public string ZMACD { get; set; } - /// - /// 机器描述 - /// - [Display(Name = "机器描述")] - public string ZMATX { get; set; } - /// - /// MRP 控制者(物料计划人) - /// - [Display(Name = "MRP 控制者(物料计划人)")] - public string DISPO { get; set; } - /// - /// 全部的计划订单数量 - /// - [Display(Name = "全部的计划订单数量 ")] - public decimal GSMNG { get; set; } = 0; - /// - /// 备注 - /// - [Display(Name = "备注")] - public string ZBZSM { get; set; } - /// - /// 用户主记录中的用户名称 - /// - [Display(Name = "用户主记录中的用户名称 ")] - public string XUBNAME { get; set; } - /// - /// 更改日期 - /// - [Display(Name = "生产顺序")] - public string ZCDATE { get; set; } - /// - /// 更改时间 - /// - [Display(Name = "更改时间")] - public string ZCTIME { get; set; } + /// + /// 生产版本 + /// + [Display(Name = "生产版本")] + public string VERID { get; set; } + /// + /// 生产顺序 + /// + [Display(Name = "生产顺序")] + public string ZSCSX { get; set; } + /// + /// 机器代码 + /// + [Display(Name = "机器代码")] + public string ZMACD { get; set; } + /// + /// 机器描述 + /// + [Display(Name = "机器描述")] + public string ZMATX { get; set; } + /// + /// MRP 控制者(物料计划人) + /// + [Display(Name = "MRP 控制者(物料计划人)")] + public string DISPO { get; set; } + /// + /// 全部的计划订单数量 + /// + [Display(Name = "全部的计划订单数量 ")] + public decimal GSMNG { get; set; } = 0; + /// + /// 备注 + /// + [Display(Name = "备注")] + public string ZBZSM { get; set; } + /// + /// 用户主记录中的用户名称 + /// + [Display(Name = "用户主记录中的用户名称 ")] + public string XUBNAME { get; set; } + /// + /// 更改日期 + /// + [Display(Name = "生产顺序")] + public string ZCDATE { get; set; } + /// + /// 更改时间 + /// + [Display(Name = "更改时间")] + public string ZCTIME { get; set; } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/PPLan/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/PPLan/ReturnResult.cs index e45cd35..cd69c66 100644 --- a/src/WmsWebApi.Application.Contracts/PPLan/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/PPLan/ReturnResult.cs @@ -1,12 +1,14 @@ using System; -namespace WmsWebApi.PPLan; - -public class ReturnResult +namespace WmsWebApi.PPLan { - public char TYPE { get; set; } = 'S'; - public string MESSAGE { get; set; } = "接收成功!"; + public class ReturnResult + { + public char TYPE { get; set; } = 'S'; + + public string MESSAGE { get; set; } = "接收成功!"; - public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Parts/IPartService.cs b/src/WmsWebApi.Application.Contracts/Parts/IPartService.cs index e7e70ab..631d796 100644 --- a/src/WmsWebApi.Application.Contracts/Parts/IPartService.cs +++ b/src/WmsWebApi.Application.Contracts/Parts/IPartService.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.Parts; +namespace WmsWebApi.Parts { /// /// 零件 @@ -15,4 +15,5 @@ public interface IPartService : IApplicationService public bool IsRequestRetry { get; set; } public Task AddAsync(object content); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Parts/PartDetailDto.cs b/src/WmsWebApi.Application.Contracts/Parts/PartDetailDto.cs index 6d26d1a..542fd48 100644 --- a/src/WmsWebApi.Application.Contracts/Parts/PartDetailDto.cs +++ b/src/WmsWebApi.Application.Contracts/Parts/PartDetailDto.cs @@ -2,20 +2,21 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Parts; +namespace WmsWebApi.Parts { public class PartDetailDto : EntityDto { - + public string CHARACT { get; set; } - + public string VALUE_CHAR { get; set; } - + public string INHERITED { get; set; } - + public string INSTANCE { get; set; } - + public string VALUE_NEUTRAL { get; set; } - + public string CHARACT_DESCR { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Parts/PartDto.cs b/src/WmsWebApi.Application.Contracts/Parts/PartDto.cs index 71dfabf..51720b4 100644 --- a/src/WmsWebApi.Application.Contracts/Parts/PartDto.cs +++ b/src/WmsWebApi.Application.Contracts/Parts/PartDto.cs @@ -5,8 +5,7 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Parts; - +namespace WmsWebApi.Parts { public class PartDto : EntityDto { @@ -517,4 +516,5 @@ public class PartDto : EntityDto [XmlArrayItem("partDetail")] [DataMember, XmlArray("partDetails")] public virtual List zzchar { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Parts/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/Parts/ReturnResult.cs index dd98732..c274f42 100644 --- a/src/WmsWebApi.Application.Contracts/Parts/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/Parts/ReturnResult.cs @@ -1,16 +1,18 @@ using System; -namespace WmsWebApi.Parts; - -public class ReturnResult +namespace WmsWebApi.Parts { - public char TYPE { get; set; } = 'S'; - public string MESSAGE { get; set; } = "接收成功!"; + public class ReturnResult + { + public char TYPE { get; set; } = 'S'; + + public string MESSAGE { get; set; } = "接收成功!"; - public string MESSAGE_V1 { get; set; } = DateTime.Now.ToString("yyyyMMdd"); + public string MESSAGE_V1 { get; set; } = DateTime.Now.ToString("yyyyMMdd"); - public string MESSAGE_V2 { get; set; } = DateTime.Now.ToString("HH:mm:ss"); + public string MESSAGE_V2 { get; set; } = DateTime.Now.ToString("HH:mm:ss"); - public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs b/src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs index c5a69cb..aaee607 100644 --- a/src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs +++ b/src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs @@ -2,17 +2,19 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.ProductRecieve; - -/// -/// Agv完工收货入库 -/// -public interface IProductRecieveService : IApplicationService +namespace WmsWebApi.ProductRecieve { + /// - /// 是否是请求重试 + /// Agv完工收货入库 /// - public bool IsRequestRetry { get; set; } + public interface IProductRecieveService : IApplicationService + { + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } - public Task AddAsync(object content); + public Task AddAsync(object content); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDetailDto.cs b/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDetailDto.cs index 067b27e..209c3a7 100644 --- a/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDetailDto.cs +++ b/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDetailDto.cs @@ -2,40 +2,42 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.ProductRecieve; - -public class PRDetailDto : EntityDto +namespace WmsWebApi.ProductRecieve { - - public string BarCode { get; set; } - - public string Batch { get; set; } - - public string PartCode { get; set; } - public string PartDesc { get; set; } = ""; - - public string PpBillNum { get; set; } + public class PRDetailDto : EntityDto + { + + public string BarCode { get; set; } + + public string Batch { get; set; } + + public string PartCode { get; set; } + + public string PartDesc { get; set; } = ""; + + public string PpBillNum { get; set; } - public decimal PpLine { get; set; } = 0; + public decimal PpLine { get; set; } = 0; - public string ProduceDate { get; set; } + public string ProduceDate { get; set; } - public decimal Qty { get; set; } + public decimal Qty { get; set; } - public string ReceiveDate { get; set; } + public string ReceiveDate { get; set; } - public string ScrapQty { get; set; } + public string ScrapQty { get; set; } - public string ShiftName { get; set; } + public string ShiftName { get; set; } - public string State { get; set; } + public string State { get; set; } - public string FromLocCode { get; set; } + public string FromLocCode { get; set; } - public string ToLocCode { get; set; } + public string ToLocCode { get; set; } - public string TraceBackCode { get; set; } + public string TraceBackCode { get; set; } - public string Unit { get; set; } + public string Unit { get; set; } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDto.cs b/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDto.cs index 631e3eb..60d1ce3 100644 --- a/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDto.cs +++ b/src/WmsWebApi.Application.Contracts/ProductRecieve/PRDto.cs @@ -5,47 +5,49 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.ProductRecieve; - -public class PRDto : EntityDto +namespace WmsWebApi.ProductRecieve { - /// - /// 过账日期 - /// - [Display(Name = "过账日期")] - public string AccountDate { get; set; } - /// - /// 单据类型 901完工收货,902上架,903下架 - /// - [Display(Name = "单据类型")] - public string BillType { get; set; } - - /// - /// 接收日期 - /// - [Display(Name = "接收日期")] - public string ReceiveDate { get; set; } - - [Display(Name = "GUID")] - public string GUID { get; set; } - - /// - /// 操作者 - /// - [Display(Name = "操作者")] - public string OperName { get; set; } - - /// - /// 单据时间 - /// - [Display(Name = "单据时间")] - public string BillTime { get; set; } - - /// - /// IWMS单号 - /// - [Display(Name = "IWMS单号")] - public string SourceBillNum { get; set; } - - public virtual List items { get; set; } + + public class PRDto : EntityDto + { + /// + /// 过账日期 + /// + [Display(Name = "过账日期")] + public string AccountDate { get; set; } + /// + /// 单据类型 901完工收货,902上架,903下架 + /// + [Display(Name = "单据类型")] + public string BillType { get; set; } + + /// + /// 接收日期 + /// + [Display(Name = "接收日期")] + public string ReceiveDate { get; set; } + + [Display(Name = "GUID")] + public string GUID { get; set; } + + /// + /// 操作者 + /// + [Display(Name = "操作者")] + public string OperName { get; set; } + + /// + /// 单据时间 + /// + [Display(Name = "单据时间")] + public string BillTime { get; set; } + + /// + /// IWMS单号 + /// + [Display(Name = "IWMS单号")] + public string SourceBillNum { get; set; } + + public virtual List items { get; set; } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ProductRecieve/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/ProductRecieve/ReturnResult.cs index 76de601..46f91af 100644 --- a/src/WmsWebApi.Application.Contracts/ProductRecieve/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/ProductRecieve/ReturnResult.cs @@ -1,12 +1,14 @@ using System; -namespace WmsWebApi.ProductRecieve; - -public class ReturnResult +namespace WmsWebApi.ProductRecieve { - public char TYPE { get; set; } = 'S'; - public string MESSAGE { get; set; } = "接收成功!"; + public class ReturnResult + { + public char TYPE { get; set; } = 'S'; + + public string MESSAGE { get; set; } = "接收成功!"; - public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Purchase/IPurchaseService.cs b/src/WmsWebApi.Application.Contracts/Purchase/IPurchaseService.cs index fc131b6..73cd037 100644 --- a/src/WmsWebApi.Application.Contracts/Purchase/IPurchaseService.cs +++ b/src/WmsWebApi.Application.Contracts/Purchase/IPurchaseService.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.Purchase; +namespace WmsWebApi.Purchase { /// /// 采购 @@ -15,4 +15,5 @@ public interface IPurchaseService : IApplicationService public bool IsRequestRetry { get; set; } public Task AddAsync(object content); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDetailDto.cs b/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDetailDto.cs index d36557b..769dea2 100644 --- a/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDetailDto.cs +++ b/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDetailDto.cs @@ -2,25 +2,26 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Purchase; +namespace WmsWebApi.Purchase { public class PurchaseDetailDto : EntityDto { - + public string MATNR { get; set; } public decimal ERFMG { get; set; } = 0; - + public string ERFME { get; set; } - + public string WERKS { get; set; } - + public string LGORT { get; set; } - + public string CHARG { get; set; } public string ZEILE { get; set; } public string EBELN { get; set; } public string SHKZG { get; set; } public string EBELP { get; set; } public string BWART { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDto.cs b/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDto.cs index 15f90a4..5740be9 100644 --- a/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDto.cs +++ b/src/WmsWebApi.Application.Contracts/Purchase/PurchaseDto.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.Purchase; +namespace WmsWebApi.Purchase { public class PurchaseDto : EntityDto { @@ -27,4 +27,5 @@ public class PurchaseDto : EntityDto public string BUDAT { get; set; } public virtual List zzmseg { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/Purchase/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/Purchase/ReturnResult.cs index 2aa8548..4d203ed 100644 --- a/src/WmsWebApi.Application.Contracts/Purchase/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/Purchase/ReturnResult.cs @@ -1,12 +1,14 @@ using System; -namespace WmsWebApi.Purchase; - -public class ReturnResult +namespace WmsWebApi.Purchase { - public char TYPE { get; set; } = 'S'; - public string MESSAGE { get; set; } = "接收成功!"; + public class ReturnResult + { + public char TYPE { get; set; } = 'S'; + + public string MESSAGE { get; set; } = "接收成功!"; - public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + public string REQUEST_SYSTEM { get; set; } = "WinWMS"; + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs b/src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs index 216384f..52eb55c 100644 --- a/src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs +++ b/src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs @@ -2,17 +2,19 @@ using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.StockMove; - -/// -/// Agv出入库 -/// -public interface IStockMoveService : IApplicationService +namespace WmsWebApi.StockMove { + /// - /// 是否是请求重试 + /// Agv出入库 /// - public bool IsRequestRetry { get; set; } + public interface IStockMoveService : IApplicationService + { + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } - public Task AddAsync(object content); + public Task AddAsync(object content); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/StockMove/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/StockMove/ReturnResult.cs index b83bbaa..87501b4 100644 --- a/src/WmsWebApi.Application.Contracts/StockMove/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/StockMove/ReturnResult.cs @@ -1,6 +1,6 @@ using System; -namespace WmsWebApi.StockMove; +namespace WmsWebApi.StockMove { public class ReturnResult { @@ -9,4 +9,5 @@ public class ReturnResult public string MESSAGE { get; set; } = "接收成功!"; public string REQUEST_SYSTEM { get; set; } = "WinWMS"; +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/StockMove/SSDetailDto.cs b/src/WmsWebApi.Application.Contracts/StockMove/SSDetailDto.cs index 72c371a..9a98b91 100644 --- a/src/WmsWebApi.Application.Contracts/StockMove/SSDetailDto.cs +++ b/src/WmsWebApi.Application.Contracts/StockMove/SSDetailDto.cs @@ -2,19 +2,19 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.StockMove; +namespace WmsWebApi.StockMove { public class SSDetailDto : EntityDto { - + public string BarCode { get; set; } - + public string Batch { get; set; } - + public string PartCode { get; set; } public string PartDesc { get; set; } = ""; - + public string PpBillNum { get; set; } public decimal PpLine { get; set; } = 0; @@ -38,4 +38,5 @@ public class SSDetailDto : EntityDto public string TraceBackCode { get; set; } public string Unit { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/StockMove/SSDto.cs b/src/WmsWebApi.Application.Contracts/StockMove/SSDto.cs index 6a4866b..cc18c46 100644 --- a/src/WmsWebApi.Application.Contracts/StockMove/SSDto.cs +++ b/src/WmsWebApi.Application.Contracts/StockMove/SSDto.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.StockMove; +namespace WmsWebApi.StockMove { public class SSDto : EntityDto { @@ -45,7 +45,8 @@ public class SSDto : EntityDto /// IWMS单号 /// [Display(Name = "IWMS单号")] - public string SourceBillNum { get; set; } + public string SourceBillNum { get; set; } public virtual List items { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/IZlldcjLogAppService.cs b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/IZlldcjLogAppService.cs index 72e1c38..4c8f567 100644 --- a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/IZlldcjLogAppService.cs +++ b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/IZlldcjLogAppService.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Services; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { /// /// 领物料 /// -public interface IZlldcjLogAppService :IApplicationService +public interface IZlldcjLogAppService : IApplicationService { /// /// 是否是请求重试 @@ -20,4 +20,5 @@ public interface IZlldcjLogAppService :IApplicationService public Task AddAsync(object content); public Task CloseAsync(object content); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ReturnResult.cs b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ReturnResult.cs index 6f873e8..a4f8479 100644 --- a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ReturnResult.cs +++ b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ReturnResult.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { public class ReturnResult { @@ -15,4 +15,5 @@ public class ReturnResult { } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ZlldcjLog.cs b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ZlldcjLog.cs index eb936f7..ff77306 100644 --- a/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ZlldcjLog.cs +++ b/src/WmsWebApi.Application.Contracts/ZlldcjLogs/ZlldcjLog.cs @@ -2,9 +2,9 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { -public class ZlldcjLogDto:EntityDto +public class ZlldcjLogDto : EntityDto { /// /// 单据号 @@ -161,7 +161,8 @@ public class ZlldcjLogDto:EntityDto /// [Display(Name = "交货项目")] public string POSNR { get; set; } -/* - [Display(Name = "接口类型")] - public string IType { get; set; }*/ + /* + [Display(Name = "接口类型")] + public string IType { get; set; }*/ +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application/Boms/BomService.cs b/src/WmsWebApi.Application/Boms/BomService.cs index eb17742..6961048 100644 --- a/src/WmsWebApi.Application/Boms/BomService.cs +++ b/src/WmsWebApi.Application/Boms/BomService.cs @@ -16,291 +16,293 @@ using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Jsons; using WmsWebApi.Wms; -namespace WmsWebApi.Boms; - -[Route("/api/bom")] -public class BomService : ApplicationService, IBomService +namespace WmsWebApi.Boms { - private readonly ITmPgPartgroupRepository _tmPgPartgroupRepository; - private readonly ITaBomRepository _taBomRepository; - private readonly ITaPartRepository _taPartRepository; - private readonly IBomManager _bomDtoRepository; - private readonly TmPgWmsUpdate _tmPgWmsUpdate; - private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; - private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; - private readonly IBomJsonRepository _bomJsonRepository; - private readonly AsyncRetryPolicy _asyncRetryPolicy; - - /// - /// 是否是请求重试 - /// - public bool IsRequestRetry { get; set; } = false; - public BomService(ITmPgPartgroupRepository tmPgPartgroupRepository, - ITaBomRepository taBomRepository, - ITaPartRepository taPartRepository, - IBomManager bomDtoRepository, - TmPgWmsUpdate tmPgWmsUpdate - , Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry, - IBomJsonRepository bomJsonRepository) + [Route("/api/bom")] + public class BomService : ApplicationService, IBomService { - _tmPgPartgroupRepository = tmPgPartgroupRepository; - _taBomRepository = taBomRepository; - _taPartRepository = taPartRepository; - _bomDtoRepository = bomDtoRepository; - _tmPgWmsUpdate = tmPgWmsUpdate; - _unitOfWorkManager = unitOfWorkManager; - _backgroundJobRequestRetry = backgroundJobRequestRetry; - _bomJsonRepository = bomJsonRepository; - _asyncRetryPolicy = Policy.Handle() - .WaitAndRetryAsync(new[] { + private readonly ITmPgPartgroupRepository _tmPgPartgroupRepository; + private readonly ITaBomRepository _taBomRepository; + private readonly ITaPartRepository _taPartRepository; + private readonly IBomManager _bomDtoRepository; + private readonly TmPgWmsUpdate _tmPgWmsUpdate; + private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; + private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IBomJsonRepository _bomJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; + + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } = false; + + public BomService(ITmPgPartgroupRepository tmPgPartgroupRepository, + ITaBomRepository taBomRepository, + ITaPartRepository taPartRepository, + IBomManager bomDtoRepository, + TmPgWmsUpdate tmPgWmsUpdate + , Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IBomJsonRepository bomJsonRepository) + { + _tmPgPartgroupRepository = tmPgPartgroupRepository; + _taBomRepository = taBomRepository; + _taPartRepository = taPartRepository; + _bomDtoRepository = bomDtoRepository; + _tmPgWmsUpdate = tmPgWmsUpdate; + _unitOfWorkManager = unitOfWorkManager; + _backgroundJobRequestRetry = backgroundJobRequestRetry; + _bomJsonRepository = bomJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5) - }, (exception, timeSpan, retryCount, context) => - { - Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); - }); - } - - [HttpPost("add")] - //[UnitOfWork(false)] - public async Task AddAsync([FromBody] object content) - { - var result = new ReturnResult(); - BomDto _bom; - bool bUpdate = false, bOtherWork = false, bDel = false, bNotFind = false, bPartGroup = false; - try - { - _bom = JsonConvert.DeserializeObject(content.ToString()); - } - catch (Exception ex) - { - result.TYPE = 'E'; - result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; - return result; - } - if (string.IsNullOrEmpty(_bom.MATNR)) - { - result.TYPE = 'E'; - result.MESSAGE = "物料号不能为空"; - return result; + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } - WmsWebApiBOMDTO bomdto = new WmsWebApiBOMDTO() + [HttpPost("add")] + //[UnitOfWork(false)] + public async Task AddAsync([FromBody] object content) { - MATNR = _bom.MATNR, - MAKTX = _bom.MAKTX, - WERKS = _bom.WERKS, - STLAN = _bom.STLAN, - STLAL = _bom.STLAL, - DATUV = _bom.DATUV, - BMENG = _bom.BMENG, - STLST = _bom.STLST, - LOEKZ = _bom.LOEKZ, - JSON = content.ToString() - }; - bomdto.SetId(GuidGenerator); + var result = new ReturnResult(); + BomDto _bom; + bool bUpdate = false, bOtherWork = false, bDel = false, bNotFind = false, bPartGroup = false; + try + { + _bom = JsonConvert.DeserializeObject(content.ToString()); + } + catch (Exception ex) + { + result.TYPE = 'E'; + result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; + return result; + } + if (string.IsNullOrEmpty(_bom.MATNR)) + { + result.TYPE = 'E'; + result.MESSAGE = "物料号不能为空"; + return result; + } - try - { - var _remark = DateTime.Now.ToString("yyyy-MM-dd") + "!" + Guid.NewGuid(); - if (_bom.WERKS == "1000") + WmsWebApiBOMDTO bomdto = new WmsWebApiBOMDTO() { - var partgrouplist = _tmPgPartgroupRepository.Where(p => p.IsBom == true); + MATNR = _bom.MATNR, + MAKTX = _bom.MAKTX, + WERKS = _bom.WERKS, + STLAN = _bom.STLAN, + STLAL = _bom.STLAL, + DATUV = _bom.DATUV, + BMENG = _bom.BMENG, + STLST = _bom.STLST, + LOEKZ = _bom.LOEKZ, + JSON = content.ToString() + }; + bomdto.SetId(GuidGenerator); - var part = _taPartRepository.FirstOrDefault(p => p.PartCode == _bom.MATNR); - if (part == null) - { - bNotFind = true; - result.MESSAGE = $"没有找到物料号!{_bom.MATNR}"; - } - else + try + { + var _remark = DateTime.Now.ToString("yyyy-MM-dd") + "!" + Guid.NewGuid(); + if (_bom.WERKS == "1000") { - WmsWebApiBom b = new WmsWebApiBom() - { - MATNR = _bom.MATNR, - MAKTX = _bom.MAKTX, - WERKS = _bom.WERKS, - STLAN = _bom.STLAN, - STLAL = _bom.STLAL, - DATUV = _bom.DATUV, - BMENG = _bom.BMENG, - STLST = _bom.STLST, - LOEKZ = _bom.LOEKZ, - IsFisRead = false, - IsDelete = false, - }; - b.SetId(GuidGenerator); - //判断是删除还是增加 - if (_bom.LOEKZ == "1" || _bom.items.Count == 0) - { - bDel = true; - bPartGroup = false; - //var bom = new TA_BOM(); - //bom.PartCode = _bom.MATNR; + var partgrouplist = _tmPgPartgroupRepository.Where(p => p.IsBom == true); - //await _tmPgWmsUpdate.DelTaBomAsync(bom); - b.IsDelete = true; - await _bomDtoRepository.AddBomAsync(b); + var part = _taPartRepository.FirstOrDefault(p => p.PartCode == _bom.MATNR); + if (part == null) + { + bNotFind = true; + result.MESSAGE = $"没有找到物料号!{_bom.MATNR}"; } else { - #region BOM信息更新 + WmsWebApiBom b = new WmsWebApiBom() + { + MATNR = _bom.MATNR, + MAKTX = _bom.MAKTX, + WERKS = _bom.WERKS, + STLAN = _bom.STLAN, + STLAL = _bom.STLAL, + DATUV = _bom.DATUV, + BMENG = _bom.BMENG, + STLST = _bom.STLST, + LOEKZ = _bom.LOEKZ, + IsFisRead = false, + IsDelete = false, + }; + b.SetId(GuidGenerator); + //判断是删除还是增加 + if (_bom.LOEKZ == "1" || _bom.items.Count == 0) + { + bDel = true; + bPartGroup = false; + //var bom = new TA_BOM(); + //bom.PartCode = _bom.MATNR; - if (partgrouplist.Select(p => p.PARTGROUP).Contains(part.PartGroup)) + //await _tmPgWmsUpdate.DelTaBomAsync(bom); + b.IsDelete = true; + await _bomDtoRepository.AddBomAsync(b); + } + else { - List bDetail = new List(); - foreach (var item in _bom.items) + #region BOM信息更新 + + if (partgrouplist.Select(p => p.PARTGROUP).Contains(part.PartGroup)) { - /*var bom = new TA_BOM(); + List bDetail = new List(); + foreach (var item in _bom.items) + { + /*var bom = new TA_BOM(); - bom.PartCode = _bom.MATNR; - bom.BeginDate = DateTime.ParseExact(_bom.DATUV, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);//DateTime.Parse(_bom.DATUV); - bom.Remark = _remark; - bom.SubPartCode = item.IDNRK; - bom.Qty = item.MENGE; + bom.PartCode = _bom.MATNR; + bom.BeginDate = DateTime.ParseExact(_bom.DATUV, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);//DateTime.Parse(_bom.DATUV); + bom.Remark = _remark; + bom.SubPartCode = item.IDNRK; + bom.Qty = item.MENGE; - var tmp = await _taBomRepository.FirstOrDefaultAsync(p => p.PartCode == _bom.MATNR - && p.SubPartCode == item.IDNRK - && p.BeginDate == bom.BeginDate); - if (tmp == null) - { - await _taBomRepository.UpsertAsync(bom); + var tmp = await _taBomRepository.FirstOrDefaultAsync(p => p.PartCode == _bom.MATNR + && p.SubPartCode == item.IDNRK + && p.BeginDate == bom.BeginDate); + if (tmp == null) + { + await _taBomRepository.UpsertAsync(bom); + } + else + { + bUpdate = true; + await _tmPgWmsUpdate.UpdateTaBomAsync(bom); + }*/ + + WmsWebApiBomDetail tmp = new WmsWebApiBomDetail() + { + PId = b.Id, + POSNR = item.POSNR, + POSTP = item.POSTP, + IDNRK = item.IDNRK, + MAKTX_1 = item.MAKTX_1, + DUMPS = item.DUMPS, + MENGE = item.MENGE, + MEINS = item.MEINS, + SORTF = item.SORTF, + ALPGR = item.ALPGR, + ALPRF = item.ALPRF, + ALPST = item.ALPST, + EWAHR = item.EWAHR, + ITSOB = item.ITSOB, + LGORT = item.LGORT, + SANKA = item.SANKA, + SANFE = item.SANFE, + }; + tmp.SetId(GuidGenerator); + bDetail.Add(tmp); } - else - { - bUpdate = true; - await _tmPgWmsUpdate.UpdateTaBomAsync(bom); - }*/ - WmsWebApiBomDetail tmp = new WmsWebApiBomDetail() - { - PId = b.Id, - POSNR = item.POSNR, - POSTP = item.POSTP, - IDNRK = item.IDNRK, - MAKTX_1 = item.MAKTX_1, - DUMPS = item.DUMPS, - MENGE = item.MENGE, - MEINS = item.MEINS, - SORTF = item.SORTF, - ALPGR = item.ALPGR, - ALPRF = item.ALPRF, - ALPST = item.ALPST, - EWAHR = item.EWAHR, - ITSOB = item.ITSOB, - LGORT = item.LGORT, - SANKA = item.SANKA, - SANFE = item.SANFE, - }; - tmp.SetId(GuidGenerator); - bDetail.Add(tmp); + await _bomDtoRepository.AddBomAsync(b); + await _bomDtoRepository.AddBomDetailAsync(bDetail); + } + else + { + bPartGroup = true; + result.MESSAGE = "没有对应物料组数据"; } - await _bomDtoRepository.AddBomAsync(b); - await _bomDtoRepository.AddBomDetailAsync(bDetail); + #endregion } - else - { - bPartGroup = true; - result.MESSAGE = "没有对应物料组数据"; - } - - #endregion } } + else + { + bOtherWork = true; + result.MESSAGE = "非长春工厂数据!"; + } + await CurrentUnitOfWork.SaveChangesAsync(); } - else - { - bOtherWork = true; - result.MESSAGE = "非长春工厂数据!"; - } - await CurrentUnitOfWork.SaveChangesAsync(); - } - catch (Exception ex) - { - bomdto.ITYPE = ex.GetBaseException().Message; - bomdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; - result.TYPE = 'E'; - result.MESSAGE = ex.GetBaseException().Message; - - if (IsRequestRetry == false) - { - //await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.BomAdd, content.ToString()); - } - - throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); - } - finally - { - if (IsRequestRetry == false) + catch (Exception ex) { - Logger.LogInformation(bomdto.JSON); + bomdto.ITYPE = ex.GetBaseException().Message; + bomdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; + result.TYPE = 'E'; + result.MESSAGE = ex.GetBaseException().Message; - if (bNotFind) - { - bomdto.ITYPE = result.MESSAGE; - } - if (bUpdate) - { - bomdto.ITYPE = "更新!"; - } - if (bOtherWork) - { - bomdto.ITYPE = "非长春工厂数据!"; - } - if (bPartGroup) - { - bomdto.ITYPE = "没有对应物料组数据!"; - } - if (bDel) - { - bomdto.ITYPE += "删除!"; - } - try + if (IsRequestRetry == false) { - await AddWmsWebApiBOMDtoNowUnitOfWorkAsync(bomdto); + //await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.BomAdd, content.ToString()); } - catch (Exception) + + throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); + } + finally + { + if (IsRequestRetry == false) { + Logger.LogInformation(bomdto.JSON); + + if (bNotFind) + { + bomdto.ITYPE = result.MESSAGE; + } + if (bUpdate) + { + bomdto.ITYPE = "更新!"; + } + if (bOtherWork) + { + bomdto.ITYPE = "非长春工厂数据!"; + } + if (bPartGroup) + { + bomdto.ITYPE = "没有对应物料组数据!"; + } + if (bDel) + { + bomdto.ITYPE += "删除!"; + } try { - await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(bomdto)); + await AddWmsWebApiBOMDtoNowUnitOfWorkAsync(bomdto); } - catch (Exception ex) + catch (Exception) { - Logger.LogError("Bom JSON记录失败"); - Logger.LogError(bomdto.JSON); - Logger.LogError(ex.Message); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(bomdto)); + } + catch (Exception ex) + { + Logger.LogError("Bom JSON记录失败"); + Logger.LogError(bomdto.JSON); + Logger.LogError(ex.Message); + } } } } + return result; } - return result; - } - - private async Task AddWmsWebApiBOMDtoNowUnitOfWorkAsync(WmsWebApiBOMDTO wmsWebApiBOMDTO) - { - if (wmsWebApiBOMDTO == null) { return; } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddWmsWebApiBOMDtoNowUnitOfWorkAsync(WmsWebApiBOMDTO wmsWebApiBOMDTO) { - await _bomDtoRepository.AddAsync(wmsWebApiBOMDTO); - await uow.SaveChangesAsync(); - } - } + if (wmsWebApiBOMDTO == null) { return; } - private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiBOMDTO wmsWebApiBOMDTO) - { - if (wmsWebApiBOMDTO == null) { return; } + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _bomDtoRepository.AddAsync(wmsWebApiBOMDTO); + await uow.SaveChangesAsync(); + } + } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiBOMDTO wmsWebApiBOMDTO) { - await _bomJsonRepository.InsertAsync(wmsWebApiBOMDTO); - await uow.SaveChangesAsync(); + if (wmsWebApiBOMDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _bomJsonRepository.InsertAsync(wmsWebApiBOMDTO); + await uow.SaveChangesAsync(); + } } } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs index 52e73d8..6bae8b6 100644 --- a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs +++ b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs @@ -18,429 +18,431 @@ using WmsWebApi.Jsons; using WmsWebApi.Options; using WmsWebApi.Wms; -namespace WmsWebApi.OtherZll; - -/// -/// 其他领物料 -/// -[Route("/api/OtherZll")] -public class OtherZllService : ApplicationService, IOtherZllService +namespace WmsWebApi.OtherZll { - private readonly ITsStockDetailRepository _tsStockDetailRepository; - private readonly ITbProductReceiveRepository _tbProductReceiveRepository; - private readonly ITbBillRepository _tbBillRepository; - private readonly ITaPartRepository _taPartRepository; - private readonly ITaStoreLocationRepository _taStoreLocationRepository; - private readonly IOtherZllManager _otherZllManager; - private readonly ITLTransactionRepository _tlTransactionRepository; - private readonly TmPgWmsUpdate _tmPgWmsUpdate; - private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; - private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; - private readonly IOtherZllJsonRepository _otherZllJsonRepository; - private readonly AsyncRetryPolicy _asyncRetryPolicy; - private readonly OtherZllConfigOptions _otherZllConfigOptions; /// - /// 是否是请求重试 + /// 其他领物料 /// - public bool IsRequestRetry { get; set; } = false; - - public OtherZllService(ITsStockDetailRepository tsStockDetailRepository, - ITbProductReceiveRepository tbProductReceiveRepository, - ITbBillRepository tbBillRepository, - ITaPartRepository taPartRepository, - ITaStoreLocationRepository taStoreLocationRepository, - IOtherZllManager otherZllManager, - ITLTransactionRepository tlTransactionRepository, - TmPgWmsUpdate tmPgWmsUpdate, - Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry, - IOtherZllJsonRepository otherZllJsonRepository, - IOptionsMonitor customConfigOptions, - IOptionsMonitor otherZllConfigOptions) + [Route("/api/OtherZll")] + public class OtherZllService : ApplicationService, IOtherZllService { - _tsStockDetailRepository = tsStockDetailRepository; - _tbProductReceiveRepository = tbProductReceiveRepository; - _tbBillRepository = tbBillRepository; - _taPartRepository = taPartRepository; - _taStoreLocationRepository = taStoreLocationRepository; - _otherZllManager = otherZllManager; - _tlTransactionRepository = tlTransactionRepository; - _tmPgWmsUpdate = tmPgWmsUpdate; - _unitOfWorkManager = unitOfWorkManager; - _backgroundJobRequestRetry = backgroundJobRequestRetry; - _otherZllJsonRepository = otherZllJsonRepository; - _asyncRetryPolicy = Policy.Handle() - .WaitAndRetryAsync(new[] { + private readonly ITsStockDetailRepository _tsStockDetailRepository; + private readonly ITbProductReceiveRepository _tbProductReceiveRepository; + private readonly ITbBillRepository _tbBillRepository; + private readonly ITaPartRepository _taPartRepository; + private readonly ITaStoreLocationRepository _taStoreLocationRepository; + private readonly IOtherZllManager _otherZllManager; + private readonly ITLTransactionRepository _tlTransactionRepository; + private readonly TmPgWmsUpdate _tmPgWmsUpdate; + private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; + private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IOtherZllJsonRepository _otherZllJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; + private readonly OtherZllConfigOptions _otherZllConfigOptions; + + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } = false; + + public OtherZllService(ITsStockDetailRepository tsStockDetailRepository, + ITbProductReceiveRepository tbProductReceiveRepository, + ITbBillRepository tbBillRepository, + ITaPartRepository taPartRepository, + ITaStoreLocationRepository taStoreLocationRepository, + IOtherZllManager otherZllManager, + ITLTransactionRepository tlTransactionRepository, + TmPgWmsUpdate tmPgWmsUpdate, + Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IOtherZllJsonRepository otherZllJsonRepository, + IOptionsMonitor customConfigOptions, + IOptionsMonitor otherZllConfigOptions) + { + _tsStockDetailRepository = tsStockDetailRepository; + _tbProductReceiveRepository = tbProductReceiveRepository; + _tbBillRepository = tbBillRepository; + _taPartRepository = taPartRepository; + _taStoreLocationRepository = taStoreLocationRepository; + _otherZllManager = otherZllManager; + _tlTransactionRepository = tlTransactionRepository; + _tmPgWmsUpdate = tmPgWmsUpdate; + _unitOfWorkManager = unitOfWorkManager; + _backgroundJobRequestRetry = backgroundJobRequestRetry; + _otherZllJsonRepository = otherZllJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5) - }, (exception, timeSpan, retryCount, context) => - { - Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); - }); - _otherZllConfigOptions = otherZllConfigOptions.CurrentValue; - } - - [HttpPost("add")] - public async Task AddAsync([FromBody] object content) - { - var result = new ReturnResult(); - List _dtoList; - bool bTypeErr = false, bErr = false; - try - { - _dtoList = JsonConvert.DeserializeObject>(content.ToString()); - } - catch (Exception ex) - { - result.TYPE = 'E'; - result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; - return result; + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); + _otherZllConfigOptions = otherZllConfigOptions.CurrentValue; } - if (_dtoList == null || _dtoList.Count() <= 0) + [HttpPost("add")] + public async Task AddAsync([FromBody] object content) { - bErr = true; - result.MESSAGE = "err:没有1000工厂数据"; - return result; - } - - WmsWebApiOtherZLLDTO dto = new WmsWebApiOtherZLLDTO(); - dto.JSON = content.ToString(); - dto.SetId(GuidGenerator); + var result = new ReturnResult(); + List _dtoList; + bool bTypeErr = false, bErr = false; + try + { + _dtoList = JsonConvert.DeserializeObject>(content.ToString()); + } + catch (Exception ex) + { + result.TYPE = 'E'; + result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; + return result; + } - try - { - if (_dtoList[0].ZDJLX == "20") + if (_dtoList == null || _dtoList.Count() <= 0) { - var _dtoDetails = _dtoList.Where(p => p.WERKS == "1000").ToList(); + bErr = true; + result.MESSAGE = "err:没有1000工厂数据"; + return result; + } - if (_dtoDetails != null || _dtoDetails.Count() > 0) - { - if (_otherZllConfigOptions.IsEnableErnamFilter == true) - { - //根据配置文件过滤ERNAM - List ernamFilters = _otherZllConfigOptions.ErnamFilters; - _dtoDetails = _dtoDetails.FindAll(e => ernamFilters.Contains(e.ERNAM)); - } - } + WmsWebApiOtherZLLDTO dto = new WmsWebApiOtherZLLDTO(); + dto.JSON = content.ToString(); + dto.SetId(GuidGenerator); - if (_dtoDetails == null || _dtoDetails.Count() == 0) - { - bErr = true; - result.MESSAGE = "err:没有1000工厂数据"; - } - else + try + { + if (_dtoList[0].ZDJLX == "20") { - dto.ZLLDJ = _dtoDetails[0].ZLLDJ; - dto.MBLNR = _dtoDetails[0].MBLNR; - dto.MJAHR = _dtoDetails[0].MJAHR; - dto.ZLLR = _dtoDetails[0].ZLLR; + var _dtoDetails = _dtoList.Where(p => p.WERKS == "1000").ToList(); - var _billNumList = _dtoDetails.Select(p => p.MBLNR).Distinct().ToList(); - foreach (var _billNum in _billNumList) + if (_dtoDetails != null || _dtoDetails.Count() > 0) { - List _billList = new List(); - List _recieveList = new List(); - List _stockList = new List(); - List _stockUpdateList = new List(); - List _stockDelList = new List(); - List _transList = new List(); + if (_otherZllConfigOptions.IsEnableErnamFilter == true) + { + //根据配置文件过滤ERNAM + List ernamFilters = _otherZllConfigOptions.ErnamFilters; + _dtoDetails = _dtoDetails.FindAll(e => ernamFilters.Contains(e.ERNAM)); + } + } - var bill = await _tbBillRepository.FirstOrDefaultAsync(p => p.SourceBillNum2 == _billNum); + if (_dtoDetails == null || _dtoDetails.Count() == 0) + { + bErr = true; + result.MESSAGE = "err:没有1000工厂数据"; + } + else + { + dto.ZLLDJ = _dtoDetails[0].ZLLDJ; + dto.MBLNR = _dtoDetails[0].MBLNR; + dto.MJAHR = _dtoDetails[0].MJAHR; + dto.ZLLR = _dtoDetails[0].ZLLR; - if (bill == null) + var _billNumList = _dtoDetails.Select(p => p.MBLNR).Distinct().ToList(); + foreach (var _billNum in _billNumList) { - var newDtoList = _dtoDetails.Where(p => p.MBLNR == _billNum).ToList(); + List _billList = new List(); + List _recieveList = new List(); + List _stockList = new List(); + List _stockUpdateList = new List(); + List _stockDelList = new List(); + List _transList = new List(); - var tbBill = new TB_BILL - { - BillNum = _billNum + "." + newDtoList[0].ZLLDJ, - SourceBillNum2 = _billNum, - BillTime = DateTime.Now, - StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - FinishTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - OperName = "SAP", - DetailQty = newDtoList.Count, - BillType = 201, - SubBillType = 10100, - State = 2, - Remark = "otherzll", - AccountDate = DateTime.ParseExact(newDtoList[0].BUDAT, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) - }; - _billList.Add(tbBill); + var bill = await _tbBillRepository.FirstOrDefaultAsync(p => p.SourceBillNum2 == _billNum); - var sumDetailList = newDtoList.Where(p => p.MBLNR == _billNum).GroupBy(x => new { x.MATNR, x.CHARG, x.LGORT1 }). - Select(group => new - { - MATNR = group.Key.MATNR, - CHARG = group.Key.CHARG, - ERFMG = group.Sum(t => t.ERFMG), - LGORT = group.Key.LGORT1, - BUDAT = group.FirstOrDefault().BUDAT - }); - foreach (var item in sumDetailList) + if (bill == null) { - //判断物料信息 - var part = await _taPartRepository.FirstOrDefaultAsync(p => p.PartCode == item.MATNR); - if (part == null) - { - //result.TYPE = 'E'; - bTypeErr = true; - result.MESSAGE += $"err:物料 {item.MATNR} 不在WinWMS管理!"; - continue; - } - if (!part.IsDeposit) - { - //result.TYPE = 'E'; - bTypeErr = true; - result.MESSAGE += $"err:物料 {item.MATNR} 不属于其他领用件!"; - continue; - } - if (string.IsNullOrEmpty(part.DefaultReceiveLocCode)) - { - bTypeErr = true; - result.MESSAGE += $"err:物料 {item.MATNR} 未设置收货库位!"; - continue; - } + var newDtoList = _dtoDetails.Where(p => p.MBLNR == _billNum).ToList(); - var partLoc = await _taStoreLocationRepository.FirstOrDefaultAsync(p => p.LocCode == part.DefaultReceiveLocCode); - if (partLoc == null) - { - bTypeErr = true; - result.MESSAGE += $"err:物料 {item.MATNR} 的默认收货库位未配置ERP库位!"; - continue; - } - if (partLoc.ErpLocCode != item.LGORT) - { - bTypeErr = true; - result.MESSAGE += $"物料 {item.MATNR} 减库存!"; - } - var _barcode = $"{item.MATNR}_{item.CHARG}"; - var tmp = (OtherZllDto)newDtoList[0]; - //插入productrecieve - var tbRecieve = new TB_PRODUCT_RECEIVE + var tbBill = new TB_BILL { - BillNum = tbBill.BillNum, - BarCode = _barcode, - PartCode = item.MATNR, - Batch = item.CHARG, - FromLocCode = "", - ToLocCode = part.DefaultReceiveLocCode, - Remark = part.QLevel, - Qty = item.ERFMG, - GoodQty = item.ERFMG, + BillNum = _billNum + "." + newDtoList[0].ZLLDJ, + SourceBillNum2 = _billNum, + BillTime = DateTime.Now, + StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + FinishTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + OperName = "SAP", + DetailQty = newDtoList.Count, + BillType = 201, + SubBillType = 10100, State = 2, - ReceiveDate = DateTime.Now, - ProduceDate = DateTime.Now, - LineId = tmp.ZLTLX, //领/退类型 - ShiftName = tmp.ZLLDJ, //单据号 - TeamName = tmp.ZEILE, //物料凭证中的项目 - Unit = tmp.ZDJLX, //单据类型 - TraceBackCode = tmp.MEINS, //基本计量单位 + Remark = "otherzll", + AccountDate = DateTime.ParseExact(newDtoList[0].BUDAT, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) }; - if (partLoc.ErpLocCode != item.LGORT) - { - tbRecieve.FromLocCode = part.DefaultReceiveLocCode; - tbRecieve.ToLocCode = item.LGORT; - tbRecieve.Qty = 0 - tbRecieve.Qty; - } - _recieveList.Add(tbRecieve); - //插入ts_stock_detail - var tsStock = new TS_STOCK_DETAIL + _billList.Add(tbBill); + + var sumDetailList = newDtoList.Where(p => p.MBLNR == _billNum).GroupBy(x => new { x.MATNR, x.CHARG, x.LGORT1 }). + Select(group => new + { + MATNR = group.Key.MATNR, + CHARG = group.Key.CHARG, + ERFMG = group.Sum(t => t.ERFMG), + LGORT = group.Key.LGORT1, + BUDAT = group.FirstOrDefault().BUDAT + }); + foreach (var item in sumDetailList) { - BarCode = _barcode, - PartCode = item.MATNR, - Batch = item.CHARG, - EqptCode = "", - LocCode = part.DefaultReceiveLocCode, - AreaCode = partLoc.AreaCode,//"FG", - Qty = item.ERFMG, - UpdateQty = item.ERFMG, - VendId = "", - ProduceDate = DateTime.Now, - OverdueDate = (DateTime.Now).AddDays(part.ValidityDays), - ReceiveDate = DateTime.Now, - VendBatch = item.CHARG, - Remark = "", - State = EnumStockState.合格, - Amount = 0, - VinState = 0, + //判断物料信息 + var part = await _taPartRepository.FirstOrDefaultAsync(p => p.PartCode == item.MATNR); + if (part == null) + { + //result.TYPE = 'E'; + bTypeErr = true; + result.MESSAGE += $"err:物料 {item.MATNR} 不在WinWMS管理!"; + continue; + } + if (!part.IsDeposit) + { + //result.TYPE = 'E'; + bTypeErr = true; + result.MESSAGE += $"err:物料 {item.MATNR} 不属于其他领用件!"; + continue; + } + if (string.IsNullOrEmpty(part.DefaultReceiveLocCode)) + { + bTypeErr = true; + result.MESSAGE += $"err:物料 {item.MATNR} 未设置收货库位!"; + continue; + } - }; + var partLoc = await _taStoreLocationRepository.FirstOrDefaultAsync(p => p.LocCode == part.DefaultReceiveLocCode); + if (partLoc == null) + { + bTypeErr = true; + result.MESSAGE += $"err:物料 {item.MATNR} 的默认收货库位未配置ERP库位!"; + continue; + } + if (partLoc.ErpLocCode != item.LGORT) + { + bTypeErr = true; + result.MESSAGE += $"物料 {item.MATNR} 减库存!"; + } + var _barcode = $"{item.MATNR}_{item.CHARG}"; + var tmp = (OtherZllDto)newDtoList[0]; + //插入productrecieve + var tbRecieve = new TB_PRODUCT_RECEIVE + { + BillNum = tbBill.BillNum, + BarCode = _barcode, + PartCode = item.MATNR, + Batch = item.CHARG, + FromLocCode = "", + ToLocCode = part.DefaultReceiveLocCode, + Remark = part.QLevel, + Qty = item.ERFMG, + GoodQty = item.ERFMG, + State = 2, + ReceiveDate = DateTime.Now, + ProduceDate = DateTime.Now, + LineId = tmp.ZLTLX, //领/退类型 + ShiftName = tmp.ZLLDJ, //单据号 + TeamName = tmp.ZEILE, //物料凭证中的项目 + Unit = tmp.ZDJLX, //单据类型 + TraceBackCode = tmp.MEINS, //基本计量单位 + }; + if (partLoc.ErpLocCode != item.LGORT) + { + tbRecieve.FromLocCode = part.DefaultReceiveLocCode; + tbRecieve.ToLocCode = item.LGORT; + tbRecieve.Qty = 0 - tbRecieve.Qty; + } + _recieveList.Add(tbRecieve); + //插入ts_stock_detail + var tsStock = new TS_STOCK_DETAIL + { + BarCode = _barcode, + PartCode = item.MATNR, + Batch = item.CHARG, + EqptCode = "", + LocCode = part.DefaultReceiveLocCode, + AreaCode = partLoc.AreaCode,//"FG", + Qty = item.ERFMG, + UpdateQty = item.ERFMG, + VendId = "", + ProduceDate = DateTime.Now, + OverdueDate = (DateTime.Now).AddDays(part.ValidityDays), + ReceiveDate = DateTime.Now, + VendBatch = item.CHARG, + Remark = "", + State = EnumStockState.合格, + Amount = 0, + VinState = 0, - var stock = await _tsStockDetailRepository.FirstOrDefaultAsync(p => p.BarCode == _barcode - && p.LocCode == part.DefaultReceiveLocCode - && p.State == EnumStockState.合格); - if (partLoc.ErpLocCode != item.LGORT)//出库 - { - if (stock == null || stock.Qty - item.ERFMG < 0) + }; + + var stock = await _tsStockDetailRepository.FirstOrDefaultAsync(p => p.BarCode == _barcode + && p.LocCode == part.DefaultReceiveLocCode + && p.State == EnumStockState.合格); + if (partLoc.ErpLocCode != item.LGORT)//出库 { - result.TYPE = 'E'; - bErr = true; - result.MESSAGE = $"err:物料 {item.MATNR} 批次 {item.CHARG} 的库存不足!"; - break; + if (stock == null || stock.Qty - item.ERFMG < 0) + { + result.TYPE = 'E'; + bErr = true; + result.MESSAGE = $"err:物料 {item.MATNR} 批次 {item.CHARG} 的库存不足!"; + break; + } + else if (stock.Qty - item.ERFMG == 0) + { + _stockDelList.Add(tsStock); + } + else + { + tsStock.Qty = 0 - tsStock.Qty; + tsStock.UpdateQty = tsStock.Qty; + _stockUpdateList.Add(tsStock); + } } - else if (stock.Qty - item.ERFMG == 0) + else//入库 { - _stockDelList.Add(tsStock); + if (stock == null) + { + _stockList.Add(tsStock); + } + else + { + _stockUpdateList.Add(tsStock); + } } - else + //插入tl_transaction + var tlTrans = new TL_TRANSACTION + { + OperName = "SAP", + LogTime = tbBill.AccountDate ?? DateTime.Now, + BillNum = tbBill.BillNum, + BillType = tbBill.BillType, + SubBillType = tbBill.SubBillType, + PartCode = item.MATNR, + Batch = item.CHARG, + Qty = item.ERFMG, + BarCode = _barcode, + LocCode = part.DefaultReceiveLocCode, + EqptCode = item.LGORT, + Remark = "In", + State = 2, + TransType = 1 + }; + try { - tsStock.Qty = 0 - tsStock.Qty; - tsStock.UpdateQty = tsStock.Qty; - _stockUpdateList.Add(tsStock); + tlTrans.LogTime = DateTime.ParseExact(item.BUDAT, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); } - } - else//入库 - { - if (stock == null) + catch (Exception) { - _stockList.Add(tsStock); + tlTrans.LogTime = tbBill.AccountDate ?? DateTime.Now; } - else + if (partLoc.ErpLocCode != item.LGORT) { - _stockUpdateList.Add(tsStock); + tlTrans.Qty = 0 - tlTrans.Qty; + tlTrans.Remark = "Out"; + tlTrans.TransType = 0; } + _transList.Add(tlTrans); } - //插入tl_transaction - var tlTrans = new TL_TRANSACTION - { - OperName = "SAP", - LogTime = tbBill.AccountDate ?? DateTime.Now, - BillNum = tbBill.BillNum, - BillType = tbBill.BillType, - SubBillType = tbBill.SubBillType, - PartCode = item.MATNR, - Batch = item.CHARG, - Qty = item.ERFMG, - BarCode = _barcode, - LocCode = part.DefaultReceiveLocCode, - EqptCode = item.LGORT, - Remark = "In", - State = 2, - TransType = 1 - }; - try - { - tlTrans.LogTime = DateTime.ParseExact(item.BUDAT, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); - } - catch (Exception) + if (!bErr) { - tlTrans.LogTime = tbBill.AccountDate ?? DateTime.Now; - } - if (partLoc.ErpLocCode != item.LGORT) - { - tlTrans.Qty = 0 - tlTrans.Qty; - tlTrans.Remark = "Out"; - tlTrans.TransType = 0; + if (_recieveList.Count > 0) + { + await _tbBillRepository.AddManyAsync(_billList); + await _tbProductReceiveRepository.AddAsync(_recieveList); + } + if (_stockList != null && _stockList.Count() > 0) + await _tsStockDetailRepository.AddAsync(_stockList); + if (_stockUpdateList != null && _stockUpdateList.Count() > 0) + await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); + if (_stockDelList != null && _stockDelList.Count() > 0) + await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); + await _tlTransactionRepository.AddAsync(_transList); } - _transList.Add(tlTrans); } - if (!bErr) + else { - if (_recieveList.Count > 0) - { - await _tbBillRepository.AddManyAsync(_billList); - await _tbProductReceiveRepository.AddAsync(_recieveList); - } - if (_stockList != null && _stockList.Count() > 0) - await _tsStockDetailRepository.AddAsync(_stockList); - if (_stockUpdateList != null && _stockUpdateList.Count() > 0) - await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); - if (_stockDelList != null && _stockDelList.Count() > 0) - await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); - await _tlTransactionRepository.AddAsync(_transList); + result.TYPE = 'E'; + bErr = true; + result.MESSAGE = $"err:单据 {_billNum} 已存在"; + break; } } - else - { - result.TYPE = 'E'; - bErr = true; - result.MESSAGE = $"err:单据 {_billNum} 已存在"; - break; - } + } + if (bErr || bTypeErr) + { + dto.ITYPE = result.MESSAGE; } } - if (bErr || bTypeErr) + else { - dto.ITYPE = result.MESSAGE; + result.MESSAGE = "err:非物流领料单"; } + await CurrentUnitOfWork.SaveChangesAsync(); } - else + catch (Exception ex) { - result.MESSAGE = "err:非物流领料单"; - } - await CurrentUnitOfWork.SaveChangesAsync(); - } - catch (Exception ex) - { - dto.ITYPE = ex.GetBaseException().Message; - dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; + dto.ITYPE = ex.GetBaseException().Message; + dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; - if (IsRequestRetry == false) - { - try + if (IsRequestRetry == false) { - await _asyncRetryPolicy.ExecuteAsync(async () => await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.OtherZllAdd, content.ToString())); - } - catch (Exception) - { - throw new Exception("操作数据库失败,请稍后重试。", ex); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.OtherZllAdd, content.ToString())); + } + catch (Exception) + { + throw new Exception("操作数据库失败,请稍后重试。", ex); + } } - } - throw new Exception("操作数据库失败,稍后系统自动重试。", ex); - } - finally - { - if (IsRequestRetry == false) + throw new Exception("操作数据库失败,稍后系统自动重试。", ex); + } + finally { - Logger.LogInformation(dto.JSON); - try - { - await AddOtherZLLDtoNowUnitOfWorkAsync(dto); - } - catch (Exception) + if (IsRequestRetry == false) { + Logger.LogInformation(dto.JSON); try { - await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + await AddOtherZLLDtoNowUnitOfWorkAsync(dto); } - catch (Exception ex) + catch (Exception) { - Logger.LogError("OtherZll JSON记录失败"); - Logger.LogError(dto.JSON); - Logger.LogError(ex.Message); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + } + catch (Exception ex) + { + Logger.LogError("OtherZll JSON记录失败"); + Logger.LogError(dto.JSON); + Logger.LogError(ex.Message); + } } } } - } - - return result; - } - private async Task AddOtherZLLDtoNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) - { - if (wmsWebApiOtherZLLDTO == null) { return; } + return result; + } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddOtherZLLDtoNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) { - await _otherZllManager.AddAsync(wmsWebApiOtherZLLDTO); - await uow.SaveChangesAsync(); - } - } + if (wmsWebApiOtherZLLDTO == null) { return; } - private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) - { - if (wmsWebApiOtherZLLDTO == null) { return; } + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _otherZllManager.AddAsync(wmsWebApiOtherZLLDTO); + await uow.SaveChangesAsync(); + } + } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiOtherZLLDTO wmsWebApiOtherZLLDTO) { - await _otherZllJsonRepository.InsertAsync(wmsWebApiOtherZLLDTO); - await uow.SaveChangesAsync(); + if (wmsWebApiOtherZLLDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _otherZllJsonRepository.InsertAsync(wmsWebApiOtherZLLDTO); + await uow.SaveChangesAsync(); + } } } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/PPlan/PPlanService.cs b/src/WmsWebApi.Application/PPlan/PPlanService.cs index 8a436ce..26f4ca6 100644 --- a/src/WmsWebApi.Application/PPlan/PPlanService.cs +++ b/src/WmsWebApi.Application/PPlan/PPlanService.cs @@ -14,252 +14,254 @@ using WmsWebApi.Jsons; using WmsWebApi.PPLan; using WmsWebApi.Wms; -namespace WmsWebApi.PPlan; - -/// -/// 计划 -/// -[Route("/api/PPlan")] -public class PPlanService : ApplicationService, IPPlanService +namespace WmsWebApi.PPlan { - private readonly ITmPgPartgroupRepository _tmPgPartgroupRepository; - private readonly ITmPgPlanRepository _tmPgPlanRepository; - private readonly ITbBillRepository _tbBillRepository; - private readonly ITaPartRepository _taPartRepository; - private readonly IPPlanManager _pplanDtoRepository; - private readonly TmPgWmsUpdate _tmPgWmsUpdate; - private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; - private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; - private readonly IPPlanJsonRepository _pPlanJsonRepository; - private readonly AsyncRetryPolicy _asyncRetryPolicy; /// - /// 是否是请求重试 + /// 计划 /// - public bool IsRequestRetry { get; set; } = false; - - public PPlanService(ITmPgPartgroupRepository tmPgPartgroupRepository, - ITmPgPlanRepository tmPgPlanRepository, - ITbBillRepository tbBillRepository, - ITaPartRepository taPartRepository, - IPPlanManager pplanDtoRepository, - TmPgWmsUpdate tmPgWmsUpdate, - Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, - IBackgroundJobRequestRetry backgroundJobRequestRetry, - IPPlanJsonRepository pPlanJsonRepository) + [Route("/api/PPlan")] + public class PPlanService : ApplicationService, IPPlanService { - _tmPgPartgroupRepository = tmPgPartgroupRepository; - _tmPgPlanRepository = tmPgPlanRepository; - _tbBillRepository = tbBillRepository; - _taPartRepository = taPartRepository; - _pplanDtoRepository = pplanDtoRepository; - _tmPgWmsUpdate = tmPgWmsUpdate; - _unitOfWorkManager = unitOfWorkManager; - _backgroundJobRequestRetry = backgroundJobRequestRetry; - _pPlanJsonRepository = pPlanJsonRepository; - _asyncRetryPolicy = Policy.Handle() - .WaitAndRetryAsync(new[] { + private readonly ITmPgPartgroupRepository _tmPgPartgroupRepository; + private readonly ITmPgPlanRepository _tmPgPlanRepository; + private readonly ITbBillRepository _tbBillRepository; + private readonly ITaPartRepository _taPartRepository; + private readonly IPPlanManager _pplanDtoRepository; + private readonly TmPgWmsUpdate _tmPgWmsUpdate; + private readonly Volo.Abp.Uow.IUnitOfWorkManager _unitOfWorkManager; + private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry; + private readonly IPPlanJsonRepository _pPlanJsonRepository; + private readonly AsyncRetryPolicy _asyncRetryPolicy; + + /// + /// 是否是请求重试 + /// + public bool IsRequestRetry { get; set; } = false; + + public PPlanService(ITmPgPartgroupRepository tmPgPartgroupRepository, + ITmPgPlanRepository tmPgPlanRepository, + ITbBillRepository tbBillRepository, + ITaPartRepository taPartRepository, + IPPlanManager pplanDtoRepository, + TmPgWmsUpdate tmPgWmsUpdate, + Volo.Abp.Uow.IUnitOfWorkManager unitOfWorkManager, + IBackgroundJobRequestRetry backgroundJobRequestRetry, + IPPlanJsonRepository pPlanJsonRepository) + { + _tmPgPartgroupRepository = tmPgPartgroupRepository; + _tmPgPlanRepository = tmPgPlanRepository; + _tbBillRepository = tbBillRepository; + _taPartRepository = taPartRepository; + _pplanDtoRepository = pplanDtoRepository; + _tmPgWmsUpdate = tmPgWmsUpdate; + _unitOfWorkManager = unitOfWorkManager; + _backgroundJobRequestRetry = backgroundJobRequestRetry; + _pPlanJsonRepository = pPlanJsonRepository; + _asyncRetryPolicy = Policy.Handle() + .WaitAndRetryAsync(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5) - }, (exception, timeSpan, retryCount, context) => - { - Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); - }); - } - - [HttpPost("add")] - //[UnitOfWork(false)] - public async Task AddAsync([FromBody] object content) - { - var result = new ReturnResult(); - PPlanDto _planDto; - bool bUpdate = false,bOtherWork = false,bErr = false; - try - { - _planDto = JsonConvert.DeserializeObject(content.ToString()); - } - catch (Exception ex) - { - result.TYPE = 'E'; - result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; - return result; + }, (exception, timeSpan, retryCount, context) => + { + Logger.LogInformation($"执行失败,第 {retryCount} 次重试"); + }); } - WmsWebApiPPLANDTO dto = new WmsWebApiPPLANDTO() - { - PEDTR = _planDto.PEDTR, - SCHGRUP = _planDto.SCHGRUP, - KAPTPROG = _planDto.KAPTPROG, - MATNR = _planDto.MATNR, - MAKTX = _planDto.MAKTX, - WERKS = _planDto.WERKS, - VERID = _planDto.VERID, - ZSCSX = _planDto.ZSCSX, - ZMACD = _planDto.ZMACD, - ZMATX = _planDto.ZMATX, - DISPO = _planDto.DISPO, - GSMNG = _planDto.GSMNG, - ZBZSM = _planDto.ZBZSM, - XUBNAME = _planDto.XUBNAME, - ZCDATE = _planDto.ZCDATE, - ZCTIME = _planDto.ZCTIME, - JSON = content.ToString() - }; - dto.SetId(GuidGenerator); - - try + [HttpPost("add")] + //[UnitOfWork(false)] + public async Task AddAsync([FromBody] object content) { - if (_planDto.WERKS != "1000") + var result = new ReturnResult(); + PPlanDto _planDto; + bool bUpdate = false, bOtherWork = false, bErr = false; + try { - bOtherWork = true; - result.MESSAGE = "其他工厂数据"; + _planDto = JsonConvert.DeserializeObject(content.ToString()); } - else + catch (Exception ex) + { + result.TYPE = 'E'; + result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; + return result; + } + + WmsWebApiPPLANDTO dto = new WmsWebApiPPLANDTO() + { + PEDTR = _planDto.PEDTR, + SCHGRUP = _planDto.SCHGRUP, + KAPTPROG = _planDto.KAPTPROG, + MATNR = _planDto.MATNR, + MAKTX = _planDto.MAKTX, + WERKS = _planDto.WERKS, + VERID = _planDto.VERID, + ZSCSX = _planDto.ZSCSX, + ZMACD = _planDto.ZMACD, + ZMATX = _planDto.ZMATX, + DISPO = _planDto.DISPO, + GSMNG = _planDto.GSMNG, + ZBZSM = _planDto.ZBZSM, + XUBNAME = _planDto.XUBNAME, + ZCDATE = _planDto.ZCDATE, + ZCTIME = _planDto.ZCTIME, + JSON = content.ToString() + }; + dto.SetId(GuidGenerator); + + try { - if (string.IsNullOrEmpty(_planDto.PEDTR) || string.IsNullOrEmpty(_planDto.SCHGRUP) || - string.IsNullOrEmpty(_planDto.KAPTPROG) || string.IsNullOrEmpty(_planDto.MATNR)) - throw new Exception($"计划中 订单日期、分组、班次、物料号均不能为空!"); - //var part = _taPartRepository.FirstOrDefault(p => p.PartCode == _planDto.MATNR); - //if (part == null) - // throw new Exception($"没有找到物料号!{_planDto.MATNR}"); - if (_planDto.MATNR.StartsWith("3")) + if (_planDto.WERKS != "1000") { - // 查找是否有该计划 - var _billnum = _planDto.PEDTR + "-" + _planDto.SCHGRUP + "-" + _planDto.KAPTPROG; - var bill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == _billnum); - if (bill == null) + bOtherWork = true; + result.MESSAGE = "其他工厂数据"; + } + else + { + if (string.IsNullOrEmpty(_planDto.PEDTR) || string.IsNullOrEmpty(_planDto.SCHGRUP) || + string.IsNullOrEmpty(_planDto.KAPTPROG) || string.IsNullOrEmpty(_planDto.MATNR)) + throw new Exception($"计划中 订单日期、分组、班次、物料号均不能为空!"); + //var part = _taPartRepository.FirstOrDefault(p => p.PartCode == _planDto.MATNR); + //if (part == null) + // throw new Exception($"没有找到物料号!{_planDto.MATNR}"); + if (_planDto.MATNR.StartsWith("3")) { - var tbBill = new TB_BILL + // 查找是否有该计划 + var _billnum = _planDto.PEDTR + "-" + _planDto.SCHGRUP + "-" + _planDto.KAPTPROG; + var bill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == _billnum); + if (bill == null) { - BillNum = _billnum, - BillTime = DateTime.Now, - OperName = _planDto.XUBNAME, - DetailQty = 1, - BillType = 605, - SubBillType = 60101, - State = 1, - StartTime = _planDto.PEDTR.Replace("-", ""), - GateName = _planDto.KAPTPROG, - DockCode = String.Empty - }; - await _tbBillRepository.UpsertAsync(tbBill); - } + var tbBill = new TB_BILL + { + BillNum = _billnum, + BillTime = DateTime.Now, + OperName = _planDto.XUBNAME, + DetailQty = 1, + BillType = 605, + SubBillType = 60101, + State = 1, + StartTime = _planDto.PEDTR.Replace("-", ""), + GateName = _planDto.KAPTPROG, + DockCode = String.Empty + }; + await _tbBillRepository.UpsertAsync(tbBill); + } - var tmPlan = new TM_PG_PLAN - { - BillNum = _billnum, - PlanTime = _planDto.PEDTR, - Group = _planDto.SCHGRUP, - PlanShiftName = _planDto.KAPTPROG, - PartCode = _planDto.MATNR, - House = _planDto.WERKS, - BomVersion = _planDto.VERID, - Qty = _planDto.GSMNG, - Remark = _planDto.ZBZSM, - IsProduct = 1, + var tmPlan = new TM_PG_PLAN + { + BillNum = _billnum, + PlanTime = _planDto.PEDTR, + Group = _planDto.SCHGRUP, + PlanShiftName = _planDto.KAPTPROG, + PartCode = _planDto.MATNR, + House = _planDto.WERKS, + BomVersion = _planDto.VERID, + Qty = _planDto.GSMNG, + Remark = _planDto.ZBZSM, + IsProduct = 1, - }; + }; - //判断是增加还是更新 - var plan = await _tmPgPlanRepository.FirstOrDefaultAsync(p => p.PlanTime == _planDto.PEDTR - && p.Group == _planDto.SCHGRUP - && p.PlanShiftName == _planDto.KAPTPROG - && p.PartCode == _planDto.MATNR); - if (plan == null) - { - await _tmPgPlanRepository.AddAsync(tmPlan); - await _tmPgWmsUpdate.UpdateTbBillDetailQtyAsync(_billnum); + //判断是增加还是更新 + var plan = await _tmPgPlanRepository.FirstOrDefaultAsync(p => p.PlanTime == _planDto.PEDTR + && p.Group == _planDto.SCHGRUP + && p.PlanShiftName == _planDto.KAPTPROG + && p.PartCode == _planDto.MATNR); + if (plan == null) + { + await _tmPgPlanRepository.AddAsync(tmPlan); + await _tmPgWmsUpdate.UpdateTbBillDetailQtyAsync(_billnum); + } + else + { + bUpdate = true; + await _tmPgWmsUpdate.UpdateTmPlanAsync(tmPlan); + } } else { - bUpdate = true; - await _tmPgWmsUpdate.UpdateTmPlanAsync(tmPlan); + bErr = true; + result.MESSAGE = $"非WinWMS使用的物料号!{_planDto.MATNR}"; } } - else - { - bErr = true; - result.MESSAGE = $"非WinWMS使用的物料号!{_planDto.MATNR}"; - } + await CurrentUnitOfWork.SaveChangesAsync(); } - await CurrentUnitOfWork.SaveChangesAsync(); - } - catch (Exception ex) - { - bErr = true; - dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; - result.TYPE = 'E'; - result.MESSAGE = ex.GetBaseException().Message; - - if (IsRequestRetry == false) + catch (Exception ex) { - //await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.PPlanAdd, content.ToString()); - } - - throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); - } - finally - { - if (IsRequestRetry == false) - { - Logger.LogInformation(dto.JSON); + bErr = true; + dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; + result.TYPE = 'E'; + result.MESSAGE = ex.GetBaseException().Message; - if (bUpdate) + if (IsRequestRetry == false) { - dto.ITYPE = "更新!"; + //await _backgroundJobRequestRetry.AddBackgroundJobAsync(EnumActionName.PPlanAdd, content.ToString()); } - if (bOtherWork) - { - dto.ITYPE = "非长春工厂数据!"; - } - if (bErr) - { - dto.ITYPE = result.MESSAGE; - } - try - { - await AddWmsWebApiPPLANDTONowUnitOfWorkAsync(dto); - } - catch (Exception) + + throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); + } + finally + { + if (IsRequestRetry == false) { + Logger.LogInformation(dto.JSON); + + if (bUpdate) + { + dto.ITYPE = "更新!"; + } + if (bOtherWork) + { + dto.ITYPE = "非长春工厂数据!"; + } + if (bErr) + { + dto.ITYPE = result.MESSAGE; + } try { - await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + await AddWmsWebApiPPLANDTONowUnitOfWorkAsync(dto); } - catch (Exception ex) + catch (Exception) { - Logger.LogError("PPlan JSON记录失败"); - Logger.LogError(dto.JSON); - Logger.LogError(ex.Message); + try + { + await _asyncRetryPolicy.ExecuteAsync(async () => await AddJsonNowUnitOfWorkAsync(dto)); + } + catch (Exception ex) + { + Logger.LogError("PPlan JSON记录失败"); + Logger.LogError(dto.JSON); + Logger.LogError(ex.Message); + } } } } - } - return result; - } - - private async Task AddWmsWebApiPPLANDTONowUnitOfWorkAsync(WmsWebApiPPLANDTO wmsWebApiPPLANDTO) - { - if (wmsWebApiPPLANDTO == null) { return; } + return result; + } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddWmsWebApiPPLANDTONowUnitOfWorkAsync(WmsWebApiPPLANDTO wmsWebApiPPLANDTO) { - await _pplanDtoRepository.AddAsync(wmsWebApiPPLANDTO); - await uow.SaveChangesAsync(); - } - } + if (wmsWebApiPPLANDTO == null) { return; } - private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiPPLANDTO wmsWebApiPPLANDTO) - { - if (wmsWebApiPPLANDTO == null) { return; } + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _pplanDtoRepository.AddAsync(wmsWebApiPPLANDTO); + await uow.SaveChangesAsync(); + } + } - using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + private async Task AddJsonNowUnitOfWorkAsync(WmsWebApiPPLANDTO wmsWebApiPPLANDTO) { - await _pPlanJsonRepository.InsertAsync(wmsWebApiPPLANDTO); - await uow.SaveChangesAsync(); + if (wmsWebApiPPLANDTO == null) { return; } + + using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) + { + await _pPlanJsonRepository.InsertAsync(wmsWebApiPPLANDTO); + await uow.SaveChangesAsync(); + } } } } \ No newline at end of file diff --git a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs index f3dc1fd..7020567 100644 --- a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs +++ b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs @@ -21,7 +21,7 @@ using WmsWebApi.Wms; using WmsWebApi.WMS; using WmsWebApi.WMS.IRepository; -namespace WmsWebApi.ProductRecieve; +namespace WmsWebApi.ProductRecieve { /// /// Agv完工收货入库 @@ -400,4 +400,5 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService await uow.SaveChangesAsync(); } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application/Purchase/PurchaseService.cs b/src/WmsWebApi.Application/Purchase/PurchaseService.cs index 6a8fcd4..33608ae 100644 --- a/src/WmsWebApi.Application/Purchase/PurchaseService.cs +++ b/src/WmsWebApi.Application/Purchase/PurchaseService.cs @@ -17,7 +17,7 @@ using WmsWebApi.Jsons; using WmsWebApi.Purchase; using WmsWebApi.Wms; -namespace WmsWebApi.PPlan; +namespace WmsWebApi.PPlan { /// /// 采购 @@ -58,7 +58,7 @@ public class PurchaseService : ApplicationService, IPurchaseService _tsStockDetailRepository = tsStockDetailRepository; _tbProductReceiveRepository = tbProductReceiveRepository; _tbBillRepository = tbBillRepository; - _taPartRepository = taPartRepository; + _taPartRepository = taPartRepository; _taStoreLocationRepository = taStoreLocationRepository; _purchaseManager = purchaseManager; _tlTransactionRepository = tlTransactionRepository; @@ -84,7 +84,7 @@ public class PurchaseService : ApplicationService, IPurchaseService { var result = new ReturnResult(); PurchaseDto _purchaseDto; - bool bUpdate = false,bOtherWork = false,bErr = false; + bool bUpdate = false, bOtherWork = false, bErr = false; bool bTypeErr = false; try { @@ -110,13 +110,13 @@ public class PurchaseService : ApplicationService, IPurchaseService try { var _dtoDetails = _purchaseDto.zzmseg.Where(p => p.WERKS == "1000"); - if(_dtoDetails == null || _dtoDetails.Count() == 0) + if (_dtoDetails == null || _dtoDetails.Count() == 0) { bOtherWork = true; result.MESSAGE = "err:没有1000工厂数据!"; } else - { + { // 查找是否有该计划 var bill = await _tbBillRepository.FirstOrDefaultAsync(p => p.SourceBillNum2 == _purchaseDto.MBLNR); if (bill == null) @@ -132,7 +132,7 @@ public class PurchaseService : ApplicationService, IPurchaseService { var tbBill = new TB_BILL { - BillNum = _purchaseDto.MBLNR+"."+po, + BillNum = _purchaseDto.MBLNR + "." + po, SourceBillNum2 = _purchaseDto.MBLNR, BillTime = DateTime.Now, StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), @@ -148,7 +148,7 @@ public class PurchaseService : ApplicationService, IPurchaseService //_billList.Add(tbBill); bool bHaveDetails = false; - var newDtoList = _dtoDetails.Where(p=>p.EBELN == po).GroupBy(x => new { x.MATNR, x.CHARG }). + var newDtoList = _dtoDetails.Where(p => p.EBELN == po).GroupBy(x => new { x.MATNR, x.CHARG }). Select(group => new { MATNR = group.Key.MATNR, @@ -167,7 +167,7 @@ public class PurchaseService : ApplicationService, IPurchaseService result.MESSAGE += $"err:物料 {item.MATNR} 不在WinWMS管理!"; continue; } - if(!part.IsAskMerge) + if (!part.IsAskMerge) { //result.TYPE = 'E'; bTypeErr = true; @@ -341,7 +341,7 @@ public class PurchaseService : ApplicationService, IPurchaseService } bHaveDetails = true; } - if(bHaveDetails) + if (bHaveDetails) _billList.Add(tbBill); } if (!bErr) @@ -350,9 +350,9 @@ public class PurchaseService : ApplicationService, IPurchaseService await _tbProductReceiveRepository.AddAsync(_recieveList); if (_stockList != null && _stockList.Count() > 0) await _tsStockDetailRepository.AddAsync(_stockList); - if(_stockUpdateList != null && _stockUpdateList.Count() > 0) + if (_stockUpdateList != null && _stockUpdateList.Count() > 0) await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList); - if(_stockDelList != null && _stockDelList.Count() > 0) + if (_stockDelList != null && _stockDelList.Count() > 0) await _tmPgWmsUpdate.DeleteTsStock(_stockDelList); await _tlTransactionRepository.AddAsync(_transList); } @@ -366,7 +366,7 @@ public class PurchaseService : ApplicationService, IPurchaseService } await CurrentUnitOfWork.SaveChangesAsync(); } - catch(Exception ex) + catch (Exception ex) { bErr = true; dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; @@ -387,9 +387,9 @@ public class PurchaseService : ApplicationService, IPurchaseService throw new Exception("操作数据库失败,稍后系统自动重试。", ex); } - finally + finally { - if (IsRequestRetry == false) + if (IsRequestRetry == false) { Logger.LogInformation(dto.JSON); @@ -449,4 +449,5 @@ public class PurchaseService : ApplicationService, IPurchaseService await uow.SaveChangesAsync(); } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application/StockMove/StockMoveService.cs b/src/WmsWebApi.Application/StockMove/StockMoveService.cs index 59e5a7e..7651f2a 100644 --- a/src/WmsWebApi.Application/StockMove/StockMoveService.cs +++ b/src/WmsWebApi.Application/StockMove/StockMoveService.cs @@ -23,7 +23,7 @@ using WmsWebApi.Wms; using WmsWebApi.WMS; using WmsWebApi.WMS.IRepository; -namespace WmsWebApi.StockMove; +namespace WmsWebApi.StockMove { /// /// Agv出入库 @@ -569,4 +569,5 @@ public class StockMoveService : ApplicationService, IStockMoveService await uow.SaveChangesAsync(); } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application/TbParts/PartService.cs b/src/WmsWebApi.Application/TbParts/PartService.cs index 2355205..514c0c4 100644 --- a/src/WmsWebApi.Application/TbParts/PartService.cs +++ b/src/WmsWebApi.Application/TbParts/PartService.cs @@ -5,6 +5,7 @@ using Polly; using Polly.Retry; using System; using System.Linq; +using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; @@ -14,8 +15,8 @@ using WmsWebApi.EntityFrameworkCore; using WmsWebApi.Jsons; using WmsWebApi.Wms; -namespace WmsWebApi.Parts; - +namespace WmsWebApi.Parts +{ /// /// 零件 /// @@ -71,18 +72,22 @@ public class PartService : ApplicationService, IPartService { var result = new ReturnResult(); PartDto _part; - bool bUpdate = false,bOtherWork = false,bErr = false; + bool bUpdate = false, bOtherWork = false, bErr = false; try { - _part = JsonConvert.DeserializeObject(content.ToString()); - } + string contentstr = content.ToString(); + byte[] space = new byte[] { 0xc2, 0xa0 }; + string UTFSpace = Encoding.GetEncoding("UTF-8").GetString(space); + contentstr = contentstr.Replace(UTFSpace, " "); + _part = JsonConvert.DeserializeObject(contentstr.ToString()); + } catch (Exception ex) { result.TYPE = 'E'; result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; return result; } - if (string.IsNullOrEmpty(_part.MATNR)) + if (string.IsNullOrEmpty(_part.MATNR)) { result.TYPE = 'E'; result.MESSAGE = "物料号不能为空!"; @@ -302,9 +307,9 @@ public class PartService : ApplicationService, IPartService throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } - finally + finally { - if (IsRequestRetry == false) + if (IsRequestRetry == false) { Logger.LogInformation(partdto.JSON); @@ -364,4 +369,5 @@ public class PartService : ApplicationService, IPartService await uow.SaveChangesAsync(); } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs index df4cda5..f99c1bf 100644 --- a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs +++ b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs @@ -18,7 +18,7 @@ using WmsWebApi.Enums; using WmsWebApi.Jsons; using WmsWebApi.Wms; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { /// /// 领物料 @@ -253,7 +253,7 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService } await CurrentUnitOfWork.SaveChangesAsync(); } - catch (UserFriendlyException ex) + catch (UserFriendlyException ex) { bErr = true; result.TYPE = 'E'; @@ -446,4 +446,5 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService } return result; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Boms/BomManager.cs b/src/WmsWebApi.Domain/Boms/BomManager.cs index f311b64..216f97a 100644 --- a/src/WmsWebApi.Domain/Boms/BomManager.cs +++ b/src/WmsWebApi.Domain/Boms/BomManager.cs @@ -9,42 +9,44 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.Boms; - -public class BomManager : DomainService, IBomManager +namespace WmsWebApi.Boms { - private readonly IRepository _bomDtoRepository; - private readonly IRepository _bomRepository; - private readonly IRepository _bomDetailRepository; - - public BomManager( - IRepository bomDtoRepository, - IRepository bomRepository, - IRepository bomDetailRepository - ) - { - _bomDtoRepository = bomDtoRepository; - _bomRepository = bomRepository; - _bomDetailRepository = bomDetailRepository; - } - - public async Task AddAsync(WmsWebApiBOMDTO part) + public class BomManager : DomainService, IBomManager { + private readonly IRepository _bomDtoRepository; + private readonly IRepository _bomRepository; + private readonly IRepository _bomDetailRepository; - await _bomDtoRepository.InsertAsync(part); - return part; - } + public BomManager( + IRepository bomDtoRepository, + IRepository bomRepository, + IRepository bomDetailRepository + ) + { + _bomDtoRepository = bomDtoRepository; + _bomRepository = bomRepository; + _bomDetailRepository = bomDetailRepository; + } - public async Task AddBomAsync(WmsWebApiBom bom) - { - await _bomRepository.InsertAsync(bom); - return bom; - } - public async Task AddBomDetailAsync(List bomDetails) - { - await _bomDetailRepository.InsertManyAsync(bomDetails); - return bomDetails[0]; + public async Task AddAsync(WmsWebApiBOMDTO part) + { + + await _bomDtoRepository.InsertAsync(part); + return part; + } + + public async Task AddBomAsync(WmsWebApiBom bom) + { + await _bomRepository.InsertAsync(bom); + return bom; + } + + public async Task AddBomDetailAsync(List bomDetails) + { + await _bomDetailRepository.InsertManyAsync(bomDetails); + return bomDetails[0]; + } } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Boms/IBomManager.cs b/src/WmsWebApi.Domain/Boms/IBomManager.cs index bfe6833..54996c3 100644 --- a/src/WmsWebApi.Domain/Boms/IBomManager.cs +++ b/src/WmsWebApi.Domain/Boms/IBomManager.cs @@ -1,12 +1,14 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.Boms; - -public interface IBomManager +namespace WmsWebApi.Boms { - Task AddAsync(WmsWebApiBOMDTO part); - Task AddBomAsync(WmsWebApiBom bom); - Task AddBomDetailAsync(List bomDetails); + public interface IBomManager + { + Task AddAsync(WmsWebApiBOMDTO part); + + Task AddBomAsync(WmsWebApiBom bom); + Task AddBomDetailAsync(List bomDetails); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/OtherZll/IOtherZllManager.cs b/src/WmsWebApi.Domain/OtherZll/IOtherZllManager.cs index 0bc14dd..fc64a13 100644 --- a/src/WmsWebApi.Domain/OtherZll/IOtherZllManager.cs +++ b/src/WmsWebApi.Domain/OtherZll/IOtherZllManager.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.OtherZll; - -public interface IOtherZllManager +namespace WmsWebApi.OtherZll { - Task AddAsync(WmsWebApiOtherZLLDTO dto); + + public interface IOtherZllManager + { + Task AddAsync(WmsWebApiOtherZLLDTO dto); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/OtherZll/OtherZllManager.cs b/src/WmsWebApi.Domain/OtherZll/OtherZllManager.cs index d16b277..898a924 100644 --- a/src/WmsWebApi.Domain/OtherZll/OtherZllManager.cs +++ b/src/WmsWebApi.Domain/OtherZll/OtherZllManager.cs @@ -9,25 +9,27 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.OtherZll; - -public class OtherZllManager : DomainService, IOtherZllManager +namespace WmsWebApi.OtherZll { - private readonly IRepository _otherZLLDTORepository; - public OtherZllManager( - IRepository otherZLLDTORepository - ) + public class OtherZllManager : DomainService, IOtherZllManager { - _otherZLLDTORepository = otherZLLDTORepository; - } + private readonly IRepository _otherZLLDTORepository; - - public async Task AddAsync(WmsWebApiOtherZLLDTO dto) - { + public OtherZllManager( + IRepository otherZLLDTORepository + ) + { + _otherZLLDTORepository = otherZLLDTORepository; + } - await _otherZLLDTORepository.InsertAsync(dto); - return dto; - } + public async Task AddAsync(WmsWebApiOtherZLLDTO dto) + { + + await _otherZLLDTORepository.InsertAsync(dto); + return dto; + } + + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/PPlan/IPPlanManager.cs b/src/WmsWebApi.Domain/PPlan/IPPlanManager.cs index d5f94b8..9a607ad 100644 --- a/src/WmsWebApi.Domain/PPlan/IPPlanManager.cs +++ b/src/WmsWebApi.Domain/PPlan/IPPlanManager.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.PPlan; - -public interface IPPlanManager +namespace WmsWebApi.PPlan { - Task AddAsync(WmsWebApiPPLANDTO pplan); + + public interface IPPlanManager + { + Task AddAsync(WmsWebApiPPLANDTO pplan); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/PPlan/PPlanManager.cs b/src/WmsWebApi.Domain/PPlan/PPlanManager.cs index 5f6bcf2..8860e9d 100644 --- a/src/WmsWebApi.Domain/PPlan/PPlanManager.cs +++ b/src/WmsWebApi.Domain/PPlan/PPlanManager.cs @@ -9,25 +9,27 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.PPlan; - -public class PPlanManager : DomainService, IPPlanManager +namespace WmsWebApi.PPlan { - private readonly IRepository _bomDtoRepository; - public PPlanManager( - IRepository bomDtoRepository - ) + public class PPlanManager : DomainService, IPPlanManager { - _bomDtoRepository = bomDtoRepository; - } + private readonly IRepository _bomDtoRepository; - - public async Task AddAsync(WmsWebApiPPLANDTO pplan) - { + public PPlanManager( + IRepository bomDtoRepository + ) + { + _bomDtoRepository = bomDtoRepository; + } - await _bomDtoRepository.InsertAsync(pplan); - return pplan; - } + public async Task AddAsync(WmsWebApiPPLANDTO pplan) + { + + await _bomDtoRepository.InsertAsync(pplan); + return pplan; + } + + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Parts/IPartManager.cs b/src/WmsWebApi.Domain/Parts/IPartManager.cs index 5fc9043..2afe015 100644 --- a/src/WmsWebApi.Domain/Parts/IPartManager.cs +++ b/src/WmsWebApi.Domain/Parts/IPartManager.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.Parts; - -public interface IPartManager +namespace WmsWebApi.Parts { - Task AddAsync(WmsWebApiPARTDTO part); + + public interface IPartManager + { + Task AddAsync(WmsWebApiPARTDTO part); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Parts/PartManager.cs b/src/WmsWebApi.Domain/Parts/PartManager.cs index 74a7b70..e910807 100644 --- a/src/WmsWebApi.Domain/Parts/PartManager.cs +++ b/src/WmsWebApi.Domain/Parts/PartManager.cs @@ -9,25 +9,27 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.Parts; - -public class PartManager : DomainService, IPartManager +namespace WmsWebApi.Parts { - private readonly IRepository _partDtoRepository; - public PartManager( - IRepository partDtoRepository - ) + public class PartManager : DomainService, IPartManager { - _partDtoRepository = partDtoRepository; - } + private readonly IRepository _partDtoRepository; - - public async Task AddAsync(WmsWebApiPARTDTO part) - { + public PartManager( + IRepository partDtoRepository + ) + { + _partDtoRepository = partDtoRepository; + } - await _partDtoRepository.InsertAsync(part); - return part; - } + public async Task AddAsync(WmsWebApiPARTDTO part) + { + + await _partDtoRepository.InsertAsync(part); + return part; + } + + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ProductRecieve/IProductRecieveManager.cs b/src/WmsWebApi.Domain/ProductRecieve/IProductRecieveManager.cs index 53a88f5..67bade1 100644 --- a/src/WmsWebApi.Domain/ProductRecieve/IProductRecieveManager.cs +++ b/src/WmsWebApi.Domain/ProductRecieve/IProductRecieveManager.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.Domain; - -public interface IProductRecieveManager +namespace WmsWebApi.Domain { - Task AddAsync(WmsWebApiProductRecieveDTO part); + + public interface IProductRecieveManager + { + Task AddAsync(WmsWebApiProductRecieveDTO part); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ProductRecieve/ProductRecieveManager.cs b/src/WmsWebApi.Domain/ProductRecieve/ProductRecieveManager.cs index cb11630..2da9b9c 100644 --- a/src/WmsWebApi.Domain/ProductRecieve/ProductRecieveManager.cs +++ b/src/WmsWebApi.Domain/ProductRecieve/ProductRecieveManager.cs @@ -9,25 +9,27 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.Domain; - -public class ProductRecieveManager : DomainService, IProductRecieveManager +namespace WmsWebApi.Domain { - private readonly IRepository _partDtoRepository; - public ProductRecieveManager( - IRepository partDtoRepository - ) + public class ProductRecieveManager : DomainService, IProductRecieveManager { - _partDtoRepository = partDtoRepository; - } + private readonly IRepository _partDtoRepository; - - public async Task AddAsync(WmsWebApiProductRecieveDTO part) - { + public ProductRecieveManager( + IRepository partDtoRepository + ) + { + _partDtoRepository = partDtoRepository; + } - await _partDtoRepository.InsertAsync(part); - return part; - } + public async Task AddAsync(WmsWebApiProductRecieveDTO part) + { + + await _partDtoRepository.InsertAsync(part); + return part; + } + + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Purchase/IPurchaseManager.cs b/src/WmsWebApi.Domain/Purchase/IPurchaseManager.cs index 377286c..857a6b1 100644 --- a/src/WmsWebApi.Domain/Purchase/IPurchaseManager.cs +++ b/src/WmsWebApi.Domain/Purchase/IPurchaseManager.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.Purchase; - -public interface IPurchaseManager +namespace WmsWebApi.Purchase { - Task AddAsync(WmsWebApiPURCHASEDTO dto); + + public interface IPurchaseManager + { + Task AddAsync(WmsWebApiPURCHASEDTO dto); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/Purchase/PurchaseManager.cs b/src/WmsWebApi.Domain/Purchase/PurchaseManager.cs index e02bb20..ada0d8c 100644 --- a/src/WmsWebApi.Domain/Purchase/PurchaseManager.cs +++ b/src/WmsWebApi.Domain/Purchase/PurchaseManager.cs @@ -9,7 +9,7 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.Purchase; +namespace WmsWebApi.Purchase { public class PurchaseManager : DomainService, IPurchaseManager { @@ -22,7 +22,7 @@ public class PurchaseManager : DomainService, IPurchaseManager _purchaseDtoRepository = purchaseDtoRepository; } - + public async Task AddAsync(WmsWebApiPURCHASEDTO dto) { @@ -30,4 +30,5 @@ public class PurchaseManager : DomainService, IPurchaseManager return dto; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/StockMove/IStockMoveManager.cs b/src/WmsWebApi.Domain/StockMove/IStockMoveManager.cs index 9b3a48e..a254ed0 100644 --- a/src/WmsWebApi.Domain/StockMove/IStockMoveManager.cs +++ b/src/WmsWebApi.Domain/StockMove/IStockMoveManager.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.Domain; +namespace WmsWebApi.Domain { public interface IStockMoveManager { Task AddAsync(WmsWebApiStockMoveDTO part); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/StockMove/StockMoveManager.cs b/src/WmsWebApi.Domain/StockMove/StockMoveManager.cs index 848bc4a..1a7b6cb 100644 --- a/src/WmsWebApi.Domain/StockMove/StockMoveManager.cs +++ b/src/WmsWebApi.Domain/StockMove/StockMoveManager.cs @@ -9,7 +9,7 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.Domain; +namespace WmsWebApi.Domain { public class StockMoveManager : DomainService, IStockMoveManager { @@ -22,7 +22,7 @@ public class StockMoveManager : DomainService, IStockMoveManager _partDtoRepository = partDtoRepository; } - + public async Task AddAsync(WmsWebApiStockMoveDTO part) { @@ -30,4 +30,5 @@ public class StockMoveManager : DomainService, IStockMoveManager return part; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/TbOrfers/TbOrder.cs b/src/WmsWebApi.Domain/TbOrfers/TbOrder.cs index fe088e5..05e178c 100644 --- a/src/WmsWebApi.Domain/TbOrfers/TbOrder.cs +++ b/src/WmsWebApi.Domain/TbOrfers/TbOrder.cs @@ -1,11 +1,12 @@ using System; using Volo.Abp.Domain.Entities; -namespace WmsWebApi.TbOrfers; +namespace WmsWebApi.TbOrfers { -public class TbOrder:BasicAggregateRoot +public class TbOrder : BasicAggregateRoot { public string OrderNumber { get; set; } - + public int Status { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/WMS/TbBillExtensions.cs b/src/WmsWebApi.Domain/WMS/TbBillExtensions.cs index 7e89e0b..18fac8b 100644 --- a/src/WmsWebApi.Domain/WMS/TbBillExtensions.cs +++ b/src/WmsWebApi.Domain/WMS/TbBillExtensions.cs @@ -1,48 +1,50 @@ using Volo.Abp; using WmsWebApi.Wms; -namespace WmsWebApi.Wms; - -public static class TbBillExtensions +namespace WmsWebApi.Wms { - public static void CheckStatusIsOpen(this TB_BILL exist) + + public static class TbBillExtensions { - if (exist.State == 9) - { - throw new UserFriendlyException($"{exist.BillNum} 单据已关闭"); - } - else if (exist.State == -1) + public static void CheckStatusIsOpen(this TB_BILL exist) { - throw new UserFriendlyException($"{exist.BillNum} 单据已作废"); + if (exist.State == 9) + { + throw new UserFriendlyException($"{exist.BillNum} 单据已关闭"); + } + else if (exist.State == -1) + { + throw new UserFriendlyException($"{exist.BillNum} 单据已作废"); + } + else if (exist.State == 2) + { + throw new UserFriendlyException($"{exist.BillNum} 单据已完成"); + } } - else if (exist.State == 2) - { - throw new UserFriendlyException($"{exist.BillNum} 单据已完成"); - } - } - public static void CheckIsExist(this TB_BILL exist,string orderNumber) - { - if (exist == null) + public static void CheckIsExist(this TB_BILL exist, string orderNumber) { - throw new UserFriendlyException($"{orderNumber} 单据不存在"); + if (exist == null) + { + throw new UserFriendlyException($"{orderNumber} 单据不存在"); + } } - } - public static void CheckIsNotExist(this TB_BILL exist) - { - if (exist != null) + public static void CheckIsNotExist(this TB_BILL exist) { - throw new UserFriendlyException($"{exist.BillNum} 单据已存在"); + if (exist != null) + { + throw new UserFriendlyException($"{exist.BillNum} 单据已存在"); + } } - } - public static void CheckDetailIsExist(this TM_PG_OTHER_INOUT_ASK exist) - { - if (exist != null) + public static void CheckDetailIsExist(this TM_PG_OTHER_INOUT_ASK exist) { - throw new UserFriendlyException($"{exist.BillNum}单据, {exist.BillLineID}行项不存在"); + if (exist != null) + { + throw new UserFriendlyException($"{exist.BillNum}单据, {exist.BillLineID}行项不存在"); + } } - } + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/IZlldcjLogManager.cs b/src/WmsWebApi.Domain/ZlldcjLogs/IZlldcjLogManager.cs index 252ebae..23f21f6 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/IZlldcjLogManager.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/IZlldcjLogManager.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { public interface IZlldcjLogManager { Task AddAsync(List zlldcjLog); Task CloseAsync(List zlldcjLogs); Task AddDtoAsync(WmsWebApiZLLDCJDTO dto); +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs b/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs index 224ad34..7e60dc6 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs @@ -6,7 +6,7 @@ using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; using WmsWebApi.Enums; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { public class WmsWebApiZLLDCJDTO : BasicAggregateRoot { @@ -14,7 +14,7 @@ public class WmsWebApiZLLDCJDTO : BasicAggregateRoot /// 单据号 /// [Display(Name = "单据号")] - public string ZLLDJ { get; set; } + public string ZLLDJ { get; set; } /// /// 单据类型 /// @@ -42,4 +42,5 @@ public class WmsWebApiZLLDCJDTO : BasicAggregateRoot { this.Id = guidGenerator.Create(); } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLog.cs b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLog.cs index 1b5b094..08fea41 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLog.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLog.cs @@ -3,9 +3,9 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { -public class ZlldcjLog:CreationAuditedAggregateRoot +public class ZlldcjLog : CreationAuditedAggregateRoot { /// /// 单据号 @@ -173,4 +173,5 @@ public class ZlldcjLog:CreationAuditedAggregateRoot /// [Display(Name = "接口类型")] public string IType { get; set; } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogExtensions.cs b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogExtensions.cs index aedf7e2..fb977d6 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogExtensions.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogExtensions.cs @@ -1,7 +1,7 @@ using Volo.Abp; using WmsWebApi.TbOrfers; -namespace WmsWebApi.ZlldcjLogs; +namespace WmsWebApi.ZlldcjLogs { public static class ZlldcjLogExtensions { @@ -13,7 +13,7 @@ public static class ZlldcjLogExtensions } } - public static void CheckIsExist(this TbOrder exist,string orderNumber) + public static void CheckIsExist(this TbOrder exist, string orderNumber) { if (exist == null) { @@ -29,4 +29,5 @@ public static class ZlldcjLogExtensions } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogManager.cs b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogManager.cs index 675529a..66dbe48 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogManager.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogManager.cs @@ -9,165 +9,167 @@ using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; using WmsWebApi.Wms; -namespace WmsWebApi.ZlldcjLogs; - -public class ZlldcjLogManager:DomainService,IZlldcjLogManager +namespace WmsWebApi.ZlldcjLogs { - private readonly IRepository _zlldcjLogsRepository; - private readonly IRepository _zlldcjDtoRepository; - private readonly ITbBillRepository _tbBillRepository; - private readonly ITmSapMoveTypeRepository _tbSapMoveTypeRepository; - private readonly ITmOtherAskRepository _tbOtherInOutAskRepository; - //private readonly ITmOtherAskRepositoryUpdate _tmOtherAskRepositoryUpdate; - - public ZlldcjLogManager( - IRepository zlldcjLogsRepository - , IRepository zlldcjDtoRepository - , ITbBillRepository tbBillRepository - , ITmSapMoveTypeRepository tbSapMoveTypeRepository - , ITmOtherAskRepository tbOtherInOutAskRepository - //, ITmOtherAskRepositoryUpdate tmOtherAskRepositoryUpdate - ) - { - _zlldcjLogsRepository = zlldcjLogsRepository; - _zlldcjDtoRepository = zlldcjDtoRepository; - _tbBillRepository = tbBillRepository; - _tbSapMoveTypeRepository = tbSapMoveTypeRepository; - _tbOtherInOutAskRepository = tbOtherInOutAskRepository; - } - - public async Task AddAsync(List zlldcjLogs) + public class ZlldcjLogManager : DomainService, IZlldcjLogManager { + private readonly IRepository _zlldcjLogsRepository; + private readonly IRepository _zlldcjDtoRepository; + private readonly ITbBillRepository _tbBillRepository; + private readonly ITmSapMoveTypeRepository _tbSapMoveTypeRepository; + private readonly ITmOtherAskRepository _tbOtherInOutAskRepository; + //private readonly ITmOtherAskRepositoryUpdate _tmOtherAskRepositoryUpdate; - //检查是否为存在 - var tbBill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == zlldcjLogs[0].ZLLDJ); - tbBill.CheckIsNotExist(); - - //TODO 创建 tbOrder - tbBill = new TB_BILL + public ZlldcjLogManager( + IRepository zlldcjLogsRepository + , IRepository zlldcjDtoRepository + , ITbBillRepository tbBillRepository + , ITmSapMoveTypeRepository tbSapMoveTypeRepository + , ITmOtherAskRepository tbOtherInOutAskRepository + //, ITmOtherAskRepositoryUpdate tmOtherAskRepositoryUpdate + ) { - BillNum = zlldcjLogs[0].ZLLDJ, - BillTime = DateTime.Now, - OperName = zlldcjLogs[0].ERNAM, - DetailQty = zlldcjLogs.Count, - BillType = 309, - State = 0 - //... - }; - //确定SubBillType - var sapMoveType = await _tbSapMoveTypeRepository.FirstOrDefaultAsync(p=> p.SAPBillType == zlldcjLogs[0].ZDJLX - && p.GetOrBack == zlldcjLogs[0].ZLTLX - && p.MoveType == zlldcjLogs[0].BWART); - var sapBillDesc = ""; - if (sapMoveType != null) + _zlldcjLogsRepository = zlldcjLogsRepository; + _zlldcjDtoRepository = zlldcjDtoRepository; + _tbBillRepository = tbBillRepository; + _tbSapMoveTypeRepository = tbSapMoveTypeRepository; + _tbOtherInOutAskRepository = tbOtherInOutAskRepository; + } + + + public async Task AddAsync(List zlldcjLogs) { - tbBill.SubBillType = sapMoveType.SubBillType; - tbBill.Remark = sapMoveType.SAPBillDesc; - sapBillDesc = sapMoveType.SAPBillDesc; - List askList = new List(); - foreach (var item in zlldcjLogs) + //检查是否为存在 + var tbBill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == zlldcjLogs[0].ZLLDJ); + tbBill.CheckIsNotExist(); + + //TODO 创建 tbOrder + tbBill = new TB_BILL { - TM_PG_OTHER_INOUT_ASK ask = new TM_PG_OTHER_INOUT_ASK + BillNum = zlldcjLogs[0].ZLLDJ, + BillTime = DateTime.Now, + OperName = zlldcjLogs[0].ERNAM, + DetailQty = zlldcjLogs.Count, + BillType = 309, + State = 0 + //... + }; + //确定SubBillType + var sapMoveType = await _tbSapMoveTypeRepository.FirstOrDefaultAsync(p => p.SAPBillType == zlldcjLogs[0].ZDJLX + && p.GetOrBack == zlldcjLogs[0].ZLTLX + && p.MoveType == zlldcjLogs[0].BWART); + var sapBillDesc = ""; + if (sapMoveType != null) + { + tbBill.SubBillType = sapMoveType.SubBillType; + tbBill.Remark = sapMoveType.SAPBillDesc; + sapBillDesc = sapMoveType.SAPBillDesc; + + List askList = new List(); + foreach (var item in zlldcjLogs) { - BillNum = item.ZLLDJ, - BillLineID = item.ZLLITEM.ToString(), - BillType = item.ZDJLX, - BillTypeDesc = sapBillDesc, - GetOrBack = item.ZLTLX, - PartCode = item.MATNR, - Qty = item.BDMNG, - BUn = item.MEINS, - CostCenter = item.KOSTL, - BaseOrder = item.AUFNR, - MoveType = item.BWART, - OrderReason = item.GRUND.ToString(), - MoveReason = sapBillDesc, - Creator = item.ERNAM, - CreatDate = item.ERDAT + " " + item.ERZET, - Remark = item.ZBZSM, - RejecteQty = item.BKNUM, - - PickLocation = item.LGORT1, - RejecteLocation = item.LGORT2, - ClaimLocation = item.LGORT3, - PickPerson = item.ZLLR - }; - askList.Add(ask); - item.IType = "新增"; + TM_PG_OTHER_INOUT_ASK ask = new TM_PG_OTHER_INOUT_ASK + { + BillNum = item.ZLLDJ, + BillLineID = item.ZLLITEM.ToString(), + BillType = item.ZDJLX, + BillTypeDesc = sapBillDesc, + GetOrBack = item.ZLTLX, + PartCode = item.MATNR, + Qty = item.BDMNG, + BUn = item.MEINS, + CostCenter = item.KOSTL, + BaseOrder = item.AUFNR, + MoveType = item.BWART, + OrderReason = item.GRUND.ToString(), + MoveReason = sapBillDesc, + Creator = item.ERNAM, + CreatDate = item.ERDAT + " " + item.ERZET, + Remark = item.ZBZSM, + RejecteQty = item.BKNUM, + + PickLocation = item.LGORT1, + RejecteLocation = item.LGORT2, + ClaimLocation = item.LGORT3, + PickPerson = item.ZLLR + }; + askList.Add(ask); + item.IType = "新增"; + } + //新增本地单据 + await _tbBillRepository.InsertAsync(tbBill); + await _tbOtherInOutAskRepository.InsertManyAsync(askList); } - //新增本地单据 - await _tbBillRepository.InsertAsync(tbBill); - await _tbOtherInOutAskRepository.InsertManyAsync(askList); - } - else - { - foreach (var item in zlldcjLogs) + else { - item.IType = "WMS 不需要的接口"; + foreach (var item in zlldcjLogs) + { + item.IType = "WMS 不需要的接口"; + } } + //新增日志记录 + await _zlldcjLogsRepository.InsertManyAsync(zlldcjLogs); + return zlldcjLogs[0]; } - //新增日志记录 - await _zlldcjLogsRepository.InsertManyAsync(zlldcjLogs); - return zlldcjLogs[0]; - } - public async Task CloseAsync(List zlldcjLogs) - { - /*var tbBill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == zlldcjLog.ZLLDJ); - var tbOtherAskList = _tbOtherInOutAskRepository.Where(p => p.BillNum == zlldcjLog.ZLLDJ); - - //检查tbOrder是否存在 - tbBill.CheckIsExist(zlldcjLog.ZLLDJ); - //检查tbOrder状态是否为开启 - tbBill.CheckStatusIsOpen(); - - bool bClose = true,bFind = false; - foreach (var item in tbOtherAskList) + public async Task CloseAsync(List zlldcjLogs) { - if (item.BillLineID.Trim() == zlldcjLog.ZLLITEM.ToString().Trim()) + /*var tbBill = await _tbBillRepository.FirstOrDefaultAsync(p => p.BillNum == zlldcjLog.ZLLDJ); + var tbOtherAskList = _tbOtherInOutAskRepository.Where(p => p.BillNum == zlldcjLog.ZLLDJ); + + //检查tbOrder是否存在 + tbBill.CheckIsExist(zlldcjLog.ZLLDJ); + //检查tbOrder状态是否为开启 + tbBill.CheckStatusIsOpen(); + + bool bClose = true,bFind = false; + foreach (var item in tbOtherAskList) { - bFind = true; - item.IsClosed = true; - await _tmOtherAskRepositoryUpdate.UpdateCustPart(item); + if (item.BillLineID.Trim() == zlldcjLog.ZLLITEM.ToString().Trim()) + { + bFind = true; + item.IsClosed = true; + await _tmOtherAskRepositoryUpdate.UpdateCustPart(item); + } + else + { + if (item.IsClosed == false) + bClose = false; + } } - else + if (!bFind) { - if (item.IsClosed == false) - bClose = false; + throw new UserFriendlyException($"{zlldcjLog.ZLLDJ}单据, {zlldcjLog.ZLLITEM}行项不存在"); } + if (bClose) + { + tbBill.State = 9; + await _tmOtherAskRepositoryUpdate.UpdateBillState(tbBill); + }*/ + + //新增日志记录 + foreach (var zlldcjLog in zlldcjLogs) + { + zlldcjLog.IType = "关闭"; + } + + await _zlldcjLogsRepository.InsertManyAsync(zlldcjLogs); + return zlldcjLogs[0]; } - if (!bFind) + + public async Task AddDtoAsync(WmsWebApiZLLDCJDTO dto) { - throw new UserFriendlyException($"{zlldcjLog.ZLLDJ}单据, {zlldcjLog.ZLLITEM}行项不存在"); + + await _zlldcjDtoRepository.InsertAsync(dto); + return dto; } - if (bClose) - { - tbBill.State = 9; - await _tmOtherAskRepositoryUpdate.UpdateBillState(tbBill); - }*/ - //新增日志记录 - foreach (var zlldcjLog in zlldcjLogs) + public async Task AddZlldcjAsync(List dtos) { - zlldcjLog.IType = "关闭"; + await _zlldcjLogsRepository.InsertManyAsync(dtos); + return dtos.Count; } - - await _zlldcjLogsRepository.InsertManyAsync(zlldcjLogs); - return zlldcjLogs[0]; - } - - public async Task AddDtoAsync(WmsWebApiZLLDCJDTO dto) - { - - await _zlldcjDtoRepository.InsertAsync(dto); - return dto; - } - - public async Task AddZlldcjAsync(List dtos) - { - await _zlldcjLogsRepository.InsertManyAsync(dtos); - return dtos.Count; } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs b/src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs index a100cb5..312611d 100644 --- a/src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs +++ b/src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs @@ -1,9 +1,11 @@ using System.Threading.Tasks; -namespace WmsWebApi.ZlldgbLogs; - -public interface IZlldgbLogManager +namespace WmsWebApi.ZlldgbLogs { - Task AddAsync(ZlldgbLog zlldcjLog); - Task CloseAsync(ZlldgbLog zlldcjLog); + + public interface IZlldgbLogManager + { + Task AddAsync(ZlldgbLog zlldcjLog); + Task CloseAsync(ZlldgbLog zlldcjLog); + } } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLog.cs b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLog.cs index 70c018f..c7bf491 100644 --- a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLog.cs +++ b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLog.cs @@ -3,9 +3,9 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; -namespace WmsWebApi.ZlldgbLogs; +namespace WmsWebApi.ZlldgbLogs { -public class ZlldgbLog:CreationAuditedAggregateRoot +public class ZlldgbLog : CreationAuditedAggregateRoot { /// /// 单据号 @@ -167,4 +167,5 @@ public class ZlldgbLog:CreationAuditedAggregateRoot { this.Id = guidGenerator.Create(); } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogExtensions.cs b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogExtensions.cs index 013faf7..a64c51e 100644 --- a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogExtensions.cs +++ b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogExtensions.cs @@ -1,7 +1,7 @@ using Volo.Abp; using WmsWebApi.TbOrfers; -namespace WmsWebApi.ZlldgbLogs; +namespace WmsWebApi.ZlldgbLogs { public static class ZlldgbLogExtensions { @@ -13,7 +13,7 @@ public static class ZlldgbLogExtensions } } - public static void CheckIsExist(this TbOrder exist,string orderNumber) + public static void CheckIsExist(this TbOrder exist, string orderNumber) { if (exist == null) { @@ -29,4 +29,5 @@ public static class ZlldgbLogExtensions } } +} } \ No newline at end of file diff --git a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogManager.cs b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogManager.cs index 8b701cd..7be680d 100644 --- a/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogManager.cs +++ b/src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogManager.cs @@ -6,22 +6,22 @@ using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; using WmsWebApi.TbOrfers; -namespace WmsWebApi.ZlldgbLogs; +namespace WmsWebApi.ZlldgbLogs { -public class ZlldgbLogManager:DomainService,IZlldgbLogManager +public class ZlldgbLogManager : DomainService, IZlldgbLogManager { private readonly IRepository _zlldcjLogsRepository; private readonly IRepository _tbOrderRepository; public ZlldgbLogManager( - IRepository zlldcjLogsRepository - ,IRepository tbOrderRepository) + IRepository zlldcjLogsRepository + , IRepository tbOrderRepository) { _zlldcjLogsRepository = zlldcjLogsRepository; _tbOrderRepository = tbOrderRepository; } - + public async Task AddAsync(ZlldgbLog zlldcjLog) { @@ -61,5 +61,6 @@ public class ZlldgbLogManager:DomainService,IZlldgbLogManager return ret; } - + +} } \ No newline at end of file