diff --git a/host/WmsWebApi.HttpApi.Host/AbpExceptionFilterExtension.cs b/host/WmsWebApi.HttpApi.Host/AbpExceptionFilterExtension.cs index e322c68..343300c 100644 --- a/host/WmsWebApi.HttpApi.Host/AbpExceptionFilterExtension.cs +++ b/host/WmsWebApi.HttpApi.Host/AbpExceptionFilterExtension.cs @@ -20,7 +20,7 @@ namespace WmsWebApi var error = context.Exception; context.Result = new ObjectResult(new ReturnResult() { - TYPE = 'E', + TYPE = 'R', MESSAGE = error.Message, }); context.ExceptionHandled = true; diff --git a/host/WmsWebApi.HttpApi.Host/appsettings.json b/host/WmsWebApi.HttpApi.Host/appsettings.json index 67e9003..3000c1a 100644 --- a/host/WmsWebApi.HttpApi.Host/appsettings.json +++ b/host/WmsWebApi.HttpApi.Host/appsettings.json @@ -9,9 +9,9 @@ "AgvInLoc": "A01", "AgvOutLoc": "B01" }, - "Redis": { - "Configuration": "127.0.0.1" - }, + "Redis": { + "Configuration": "127.0.0.1" + }, "AuthServer": { "Authority": "http://192.168.0.140:8066", "RequireHttpsMetadata": "false", diff --git a/src/WmsWebApi.Application/Boms/BomService.cs b/src/WmsWebApi.Application/Boms/BomService.cs index c3ed572..b08d6c0 100644 --- a/src/WmsWebApi.Application/Boms/BomService.cs +++ b/src/WmsWebApi.Application/Boms/BomService.cs @@ -48,7 +48,7 @@ public class BomService : ApplicationService, IBomService try { _bom = JsonConvert.DeserializeObject(content.ToString()); - } + } catch (Exception ex) { result.TYPE = 'E'; @@ -62,6 +62,21 @@ public class BomService : ApplicationService, IBomService return result; } + WmsWebApiBOMDTO bomdto = new WmsWebApiBOMDTO() + { + 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); + try { var _remark = DateTime.Now.ToString("yyyy-MM-dd") + "!" + Guid.NewGuid(); @@ -179,26 +194,14 @@ public class BomService : ApplicationService, IBomService } catch (Exception ex) { + bomdto.ITYPE = ex.GetBaseException().Message; + bomdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.GetBaseException().Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - WmsWebApiBOMDTO bomdto = new WmsWebApiBOMDTO() - { - 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); if (bNotFind) { bomdto.ITYPE = result.MESSAGE; @@ -219,7 +222,7 @@ public class BomService : ApplicationService, IBomService { bomdto.ITYPE += "删除!"; } - await _bomDtoRepository.AddAsync(bomdto); + await AddWmsWebApiBOMDtoNowUnitOfWorkAsync(bomdto); } return result; diff --git a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs index 1a73314..f120276 100644 --- a/src/WmsWebApi.Application/OtherZll/OtherZllService.cs +++ b/src/WmsWebApi.Application/OtherZll/OtherZllService.cs @@ -15,6 +15,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.OtherZll; +/// +/// 其他领物料 +/// [Route("/api/OtherZll")] public class OtherZllService : ApplicationService, IOtherZllService { @@ -324,6 +327,7 @@ public class OtherZllService : ApplicationService, IOtherZllService catch (Exception ex) { dto.ITYPE = ex.GetBaseException().Message; + dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; throw; } finally diff --git a/src/WmsWebApi.Application/PPlan/PPlanService.cs b/src/WmsWebApi.Application/PPlan/PPlanService.cs index 5de95f6..b4ecec8 100644 --- a/src/WmsWebApi.Application/PPlan/PPlanService.cs +++ b/src/WmsWebApi.Application/PPlan/PPlanService.cs @@ -13,6 +13,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.PPlan; +/// +/// 计划 +/// [Route("/api/PPlan")] public class PPlanService : ApplicationService, IPPlanService { @@ -59,6 +62,28 @@ public class PPlanService : ApplicationService, IPPlanService 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 (_planDto.WERKS != "1000") @@ -138,33 +163,13 @@ public class PPlanService : ApplicationService, IPPlanService catch (Exception ex) { bErr = true; + dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.GetBaseException().Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - 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); if (bUpdate) { dto.ITYPE = "更新!"; diff --git a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs index 57bea34..e031604 100644 --- a/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs +++ b/src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Abp.Webhooks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; @@ -16,6 +17,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.ProductRecieve; +/// +/// Agv完工收货入库 +/// [Route("/api/pr")] public class ProductRecieveService : ApplicationService, IProductRecieveService { @@ -72,6 +76,19 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService return result; } + WmsWebApiProductRecieveDTO apiPRdto = new WmsWebApiProductRecieveDTO() + { + AccountDate = _PRDto.AccountDate, + BillType = _PRDto.BillType, + ReceiveDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + GUID = _PRDto.GUID, + OperName = _PRDto.OperName, + BillTime = _PRDto.BillTime, + SourceBillNum = _PRDto.SourceBillNum, + JSON = content.ToString() + }; + apiPRdto.SetId(GuidGenerator); + try { List _billList = new List(); @@ -231,24 +248,13 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService catch (Exception ex) { bErr = true; + apiPRdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - WmsWebApiProductRecieveDTO apiPRdto = new WmsWebApiProductRecieveDTO() - { - AccountDate = _PRDto.AccountDate, - BillType = _PRDto.BillType, - ReceiveDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - GUID = _PRDto.GUID, - OperName = _PRDto.OperName, - BillTime = _PRDto.BillTime, - SourceBillNum = _PRDto.SourceBillNum, - JSON = content.ToString() - }; - apiPRdto.SetId(GuidGenerator); if (bErr) { result.TYPE = 'E'; diff --git a/src/WmsWebApi.Application/Purchase/PurchaseService.cs b/src/WmsWebApi.Application/Purchase/PurchaseService.cs index 96c32c9..c81eca7 100644 --- a/src/WmsWebApi.Application/Purchase/PurchaseService.cs +++ b/src/WmsWebApi.Application/Purchase/PurchaseService.cs @@ -14,6 +14,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.PPlan; +/// +/// 采购 +/// [Route("/api/Purchase")] public class PurchaseService : ApplicationService, IPPlanService { @@ -66,7 +69,17 @@ public class PurchaseService : ApplicationService, IPPlanService result.MESSAGE = "Json格式不正确,详细信息:" + ex.Message; return result; } - + + WmsWebApiPURCHASEDTO dto = new WmsWebApiPURCHASEDTO() + { + MBLNR = _purchaseDto.MBLNR, + MJAHR = _purchaseDto.MJAHR, + BUDAT = _purchaseDto.BUDAT, + + JSON = content.ToString() + }; + dto.SetId(GuidGenerator); + try { var _dtoDetails = _purchaseDto.zzmseg.Where(p => p.WERKS == "1000"); @@ -328,22 +341,13 @@ public class PurchaseService : ApplicationService, IPPlanService catch(Exception ex) { bErr = true; + dto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.GetBaseException().Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - WmsWebApiPURCHASEDTO dto = new WmsWebApiPURCHASEDTO() - { - MBLNR = _purchaseDto.MBLNR, - MJAHR = _purchaseDto.MJAHR, - BUDAT = _purchaseDto.BUDAT, - - JSON = content.ToString() - }; - dto.SetId(GuidGenerator); - if (bUpdate) { dto.ITYPE = $"err:单据 {_purchaseDto.MBLNR} 已存在!"; diff --git a/src/WmsWebApi.Application/StockMove/StockMoveService.cs b/src/WmsWebApi.Application/StockMove/StockMoveService.cs index 7950fb7..c87b46b 100644 --- a/src/WmsWebApi.Application/StockMove/StockMoveService.cs +++ b/src/WmsWebApi.Application/StockMove/StockMoveService.cs @@ -15,6 +15,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.StockMove; +/// +/// Agv出入库 +/// [Route("/api/ss")] public class StockMoveService : ApplicationService, IStockMoveService { @@ -62,7 +65,7 @@ public class StockMoveService : ApplicationService, IStockMoveService try { _SSDto = JsonConvert.DeserializeObject(content.ToString()); - } + } catch (Exception ex) { result.TYPE = 'E'; @@ -70,6 +73,19 @@ public class StockMoveService : ApplicationService, IStockMoveService return result; } + WmsWebApiStockMoveDTO apiSSdto = new WmsWebApiStockMoveDTO() + { + AccountDate = _SSDto.AccountDate, + BillType = _SSDto.BillType, + ReceiveDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + GUID = _SSDto.GUID, + OperName = _SSDto.OperName, + BillTime = _SSDto.BillTime, + SourceBillNum = _SSDto.SourceBillNum, + JSON = content.ToString() + }; + apiSSdto.SetId(GuidGenerator); + try { List _billList = new List(); @@ -361,24 +377,13 @@ public class StockMoveService : ApplicationService, IStockMoveService catch (Exception ex) { bErr = true; + apiSSdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - WmsWebApiStockMoveDTO apiSSdto = new WmsWebApiStockMoveDTO() - { - AccountDate = _SSDto.AccountDate, - BillType = _SSDto.BillType, - ReceiveDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - GUID = _SSDto.GUID, - OperName = _SSDto.OperName, - BillTime = _SSDto.BillTime, - SourceBillNum = _SSDto.SourceBillNum, - JSON = content.ToString() - }; - apiSSdto.SetId(GuidGenerator); if (bErr) { result.TYPE = 'E'; diff --git a/src/WmsWebApi.Application/TbParts/PartService.cs b/src/WmsWebApi.Application/TbParts/PartService.cs index dba895e..231c6b8 100644 --- a/src/WmsWebApi.Application/TbParts/PartService.cs +++ b/src/WmsWebApi.Application/TbParts/PartService.cs @@ -13,6 +13,9 @@ using WmsWebApi.Wms; namespace WmsWebApi.Parts; +/// +/// 零件 +/// [Route("/api/part")] public class PartService : ApplicationService, IPartService { @@ -61,6 +64,24 @@ public class PartService : ApplicationService, IPartService return result; } + WmsWebApiPARTDTO partdto = new WmsWebApiPARTDTO() + { + MATNR = _part.MATNR, + MBRSH = _part.MBRSH, + MTART = _part.MTART, + WERKS = _part.WERKS, + VTWEG = _part.VTWEG, + MAKTX = _part.MAKTX, + MAKTX1 = _part.MAKTX1, + MEINS = _part.MEINS, + MATKL = _part.MATKL, + GROES = _part.GROES, + ZTEXT22 = _part.ZTEXT22, + DISGR = _part.DISGR, + JSON = content.ToString() + }; + partdto.SetId(GuidGenerator); + try { //判断是否是长春工厂 @@ -244,29 +265,13 @@ public class PartService : ApplicationService, IPartService catch (Exception ex) { bErr = true; + partdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.GetBaseException().Message; throw new Exception($"接口异常,请稍后重试:{ex.GetBaseException().Message}", ex); } finally { - WmsWebApiPARTDTO partdto = new WmsWebApiPARTDTO() - { - MATNR = _part.MATNR, - MBRSH = _part.MBRSH, - MTART = _part.MTART, - WERKS = _part.WERKS, - VTWEG = _part.VTWEG, - MAKTX = _part.MAKTX, - MAKTX1 = _part.MAKTX1, - MEINS = _part.MEINS, - MATKL = _part.MATKL, - GROES = _part.GROES, - ZTEXT22 = _part.ZTEXT22, - DISGR = _part.DISGR, - JSON = content.ToString() - }; - partdto.SetId(GuidGenerator); if (bUpdate) { partdto.ITYPE = "更新"; @@ -295,5 +300,4 @@ public class PartService : ApplicationService, IPartService await uow.SaveChangesAsync(); } } - } \ No newline at end of file diff --git a/src/WmsWebApi.Application/WmsWebApi.Application.csproj b/src/WmsWebApi.Application/WmsWebApi.Application.csproj index e3c9217..e272c81 100644 --- a/src/WmsWebApi.Application/WmsWebApi.Application.csproj +++ b/src/WmsWebApi.Application/WmsWebApi.Application.csproj @@ -11,6 +11,7 @@ + diff --git a/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs b/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs index 68557e8..4f793dc 100644 --- a/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs +++ b/src/WmsWebApi.Application/WmsWebApiApplicationModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Application; +using Volo.Abp.BackgroundWorkers.Quartz; namespace WmsWebApi { @@ -11,6 +12,7 @@ namespace WmsWebApi typeof(AbpDddApplicationModule), typeof(AbpAutoMapperModule) )] + [DependsOn(typeof(AbpBackgroundWorkersQuartzModule))] public class WmsWebApiApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs index c1ab87d..c1dfe02 100644 --- a/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs +++ b/src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs @@ -16,6 +16,9 @@ using Abp.Domain.Uow; namespace WmsWebApi.ZlldcjLogs; +/// +/// 领物料 +/// [Route("/api/zlldcj")] public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService { @@ -87,6 +90,15 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService return result; } + WmsWebApiZLLDCJDTO zlldcjdto = new WmsWebApiZLLDCJDTO() + { + ZLLDJ = dtos[0].ZLLDJ, + ZDJLX = dtos[0].ZDJLX, + ZLTLX = dtos[0].ZLTLX, + JSON = content.ToString() + }; + zlldcjdto.SetId(GuidGenerator); + try { var dtoList = dtos.Where(p => p.WERKS == "1000").ToList(); @@ -212,20 +224,13 @@ public class ZlldcjLogAppService : ApplicationService, IZlldcjLogAppService catch (Exception ex) { bErr = true; + zlldcjdto.EnumRetryStatus = Enums.EnumRetryStatus.WaitRetry; result.TYPE = 'E'; result.MESSAGE = ex.GetBaseException().Message; throw; } finally { - WmsWebApiZLLDCJDTO zlldcjdto = new WmsWebApiZLLDCJDTO() - { - ZLLDJ = dtos[0].ZLLDJ, - ZDJLX = dtos[0].ZDJLX, - ZLTLX = dtos[0].ZLTLX, - JSON = content.ToString() - }; - zlldcjdto.SetId(GuidGenerator); if (bErr) { zlldcjdto.ITYPE = result.MESSAGE; diff --git a/src/WmsWebApi.Domain.Shared/Enums/EnumRetryStatus.cs b/src/WmsWebApi.Domain.Shared/Enums/EnumRetryStatus.cs new file mode 100644 index 0000000..9fd5851 --- /dev/null +++ b/src/WmsWebApi.Domain.Shared/Enums/EnumRetryStatus.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WmsWebApi.Enums +{ + /// + /// 重试状态 + /// + public enum EnumRetryStatus + { + /// + /// 未定义 + /// + None = 0, + + /// + /// 等待重试 + /// + WaitRetry = 1, + + /// + /// 完成重试 + /// + CompleteRetry = 2, + + /// + /// 重试后失败 + /// + FailedRetry = 3 + } +} diff --git a/src/WmsWebApi.Domain/Boms/WmsWebApiBOMDTO.cs b/src/WmsWebApi.Domain/Boms/WmsWebApiBOMDTO.cs index 4052ff3..7737174 100644 --- a/src/WmsWebApi.Domain/Boms/WmsWebApiBOMDTO.cs +++ b/src/WmsWebApi.Domain/Boms/WmsWebApiBOMDTO.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.Boms { @@ -47,6 +48,12 @@ namespace WmsWebApi.Boms [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/OtherZll/WmsWebApiOtherZLLDTO.cs b/src/WmsWebApi.Domain/OtherZll/WmsWebApiOtherZLLDTO.cs index e25a9dd..abaa8e5 100644 --- a/src/WmsWebApi.Domain/OtherZll/WmsWebApiOtherZLLDTO.cs +++ b/src/WmsWebApi.Domain/OtherZll/WmsWebApiOtherZLLDTO.cs @@ -4,9 +4,13 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.OtherZll { + /// + /// 其他领物料Json + /// public class WmsWebApiOtherZLLDTO : BasicAggregateRoot { //public int UID { get; set; } @@ -32,6 +36,12 @@ namespace WmsWebApi.OtherZll [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/PPlan/WmsWebApiPPLANDTO.cs b/src/WmsWebApi.Domain/PPlan/WmsWebApiPPLANDTO.cs index c757623..53f7ec8 100644 --- a/src/WmsWebApi.Domain/PPlan/WmsWebApiPPLANDTO.cs +++ b/src/WmsWebApi.Domain/PPlan/WmsWebApiPPLANDTO.cs @@ -4,13 +4,12 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.PPlan { public class WmsWebApiPPLANDTO : BasicAggregateRoot { - //public int UID { get; set; } - /// /// 计划订单中的订单结束日期 /// @@ -104,6 +103,12 @@ namespace WmsWebApi.PPlan [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/Parts/WmsWebApiPARTDTO.cs b/src/WmsWebApi.Domain/Parts/WmsWebApiPARTDTO.cs index de9f624..00f872e 100644 --- a/src/WmsWebApi.Domain/Parts/WmsWebApiPARTDTO.cs +++ b/src/WmsWebApi.Domain/Parts/WmsWebApiPARTDTO.cs @@ -4,13 +4,12 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.Parts { public class WmsWebApiPARTDTO : BasicAggregateRoot { - //public int UID { get; set; } - [DisplayName("物料号")] public string MATNR { get; set; } @@ -56,6 +55,12 @@ namespace WmsWebApi.Parts [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/ProductRecieve/WmsWebApiProductRecieveDTO.cs b/src/WmsWebApi.Domain/ProductRecieve/WmsWebApiProductRecieveDTO.cs index c00448b..028a219 100644 --- a/src/WmsWebApi.Domain/ProductRecieve/WmsWebApiProductRecieveDTO.cs +++ b/src/WmsWebApi.Domain/ProductRecieve/WmsWebApiProductRecieveDTO.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.Domain { @@ -41,6 +42,12 @@ namespace WmsWebApi.Domain [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/Purchase/WmsWebApiPURCHASEDTO.cs b/src/WmsWebApi.Domain/Purchase/WmsWebApiPURCHASEDTO.cs index fc86ac0..ffd9c23 100644 --- a/src/WmsWebApi.Domain/Purchase/WmsWebApiPURCHASEDTO.cs +++ b/src/WmsWebApi.Domain/Purchase/WmsWebApiPURCHASEDTO.cs @@ -4,13 +4,12 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.Purchase { public class WmsWebApiPURCHASEDTO : BasicAggregateRoot { - //public int UID { get; set; } - /// /// 物料凭证编号 /// @@ -37,6 +36,12 @@ namespace WmsWebApi.Purchase [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/StockMove/WmsWebApiStockMoveDTO.cs b/src/WmsWebApi.Domain/StockMove/WmsWebApiStockMoveDTO.cs index d4bb1d8..0fd0dcc 100644 --- a/src/WmsWebApi.Domain/StockMove/WmsWebApiStockMoveDTO.cs +++ b/src/WmsWebApi.Domain/StockMove/WmsWebApiStockMoveDTO.cs @@ -4,13 +4,12 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.Domain { public class WmsWebApiStockMoveDTO : BasicAggregateRoot { - //public int UID { get; set; } - [Display(Name = "过账日期")] public string AccountDate { get; set; } @@ -41,6 +40,12 @@ namespace WmsWebApi.Domain [DisplayName("调用类型")] public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs b/src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs index b88e1ca..3f10501 100644 --- a/src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs +++ b/src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs @@ -6,7 +6,9 @@ using Volo.Abp.Domain.Services; namespace WmsWebApi.Wms { - + /// + /// 物料 + /// public interface ITaPartRepository : IRepository, ITransientDependency { Task UpsertAsync(TA_PART taPart); diff --git a/src/WmsWebApi.Domain/WMS/TA_PART.cs b/src/WmsWebApi.Domain/WMS/TA_PART.cs index 0484fd4..e7241be 100644 --- a/src/WmsWebApi.Domain/WMS/TA_PART.cs +++ b/src/WmsWebApi.Domain/WMS/TA_PART.cs @@ -5,6 +5,9 @@ using Volo.Abp.Domain.Entities; namespace WmsWebApi.Wms { + /// + /// 物料 + /// public class TA_PART : Entity { //public long UID { get; set; } diff --git a/src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs b/src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs index 2cb0292..a84ec5a 100644 --- a/src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs +++ b/src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs @@ -5,6 +5,9 @@ using Volo.Abp.Domain.Entities; namespace WmsWebApi.Wms { + /// + /// 库位 + /// public class TA_STORE_LOCATION : Entity { //public int UID { get; set; } diff --git a/src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs b/src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs index bfbf565..cbad233 100644 --- a/src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs +++ b/src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs @@ -6,6 +6,9 @@ using Volo.Abp.Domain.Entities; namespace WmsWebApi.Wms { + /// + /// 计划 + /// public class TM_PG_PLAN : Entity { //public int UID { get; set; } diff --git a/src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs b/src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs index 26760ec..ab1a6df 100644 --- a/src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs +++ b/src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs @@ -6,6 +6,9 @@ using Volo.Abp.Domain.Entities; namespace WmsWebApi.Wms { + /// + /// 库存 + /// public partial class TS_STOCK_DETAIL : Entity { //public long UID { get; set; } diff --git a/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs b/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs index 78ab3d6..224ad34 100644 --- a/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs +++ b/src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs @@ -1,8 +1,10 @@ using System; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; +using WmsWebApi.Enums; namespace WmsWebApi.ZlldcjLogs; @@ -30,6 +32,12 @@ public class WmsWebApiZLLDCJDTO : BasicAggregateRoot public string ITYPE { get; set; } = "新增"; + /// + /// 重试状态 + /// + [DisplayName("重试状态")] + public EnumRetryStatus EnumRetryStatus { get; set; } + public void SetId(IGuidGenerator guidGenerator) { this.Id = guidGenerator.Create(); diff --git a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs index 4315eca..43d6618 100644 --- a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs +++ b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs @@ -46,7 +46,7 @@ namespace WmsWebApi.EntityFrameworkCore public WmsWebApiDbContext(DbContextOptions options) : base(options) { - //this.Database.SetCommandTimeout(120); + this.Database.SetCommandTimeout(40); } protected override void OnModelCreating(ModelBuilder builder) diff --git a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContextModelCreatingExtensions.cs b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContextModelCreatingExtensions.cs index d20b6f2..c7457cf 100644 --- a/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContextModelCreatingExtensions.cs +++ b/src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContextModelCreatingExtensions.cs @@ -240,6 +240,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -377,6 +378,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -398,6 +400,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(q => q.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -491,6 +494,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(q => q.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -539,6 +543,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } private static void ConfigureTbProductReceive(ModelBuilder builder) @@ -643,6 +648,7 @@ namespace WmsWebApi.EntityFrameworkCore b.Property(q => q.JSON); b.Property(q => q.DYSJ); b.Property(q => q.ITYPE); + b.Property(q => q.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -652,6 +658,7 @@ namespace WmsWebApi.EntityFrameworkCore { b.ToTable("WmsWebApiProductRecieveDTO", WmsWebApiDbProperties.DbSchema); b.ConfigureByConvention(); + b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } @@ -661,6 +668,7 @@ namespace WmsWebApi.EntityFrameworkCore { b.ToTable("WmsWebApiStockMoveDTO", WmsWebApiDbProperties.DbSchema); b.ConfigureByConvention(); + b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion(); }); } } diff --git a/test/WmsWebApi.Application.Tests/Samples/SampleAppService_Tests.cs b/test/WmsWebApi.Application.Tests/Samples/SampleAppService_Tests.cs deleted file mode 100644 index c01c019..0000000 --- a/test/WmsWebApi.Application.Tests/Samples/SampleAppService_Tests.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using Shouldly; -using Xunit; - -namespace WmsWebApi.Samples -{ - public class SampleAppService_Tests : WmsWebApiApplicationTestBase - { - private readonly ISampleAppService _sampleAppService; - - public SampleAppService_Tests() - { - _sampleAppService = GetRequiredService(); - } - - [Fact] - public async Task GetAsync() - { - var result = await _sampleAppService.GetAsync(); - result.Value.ShouldBe(42); - } - - [Fact] - public async Task GetAuthorizedAsync() - { - var result = await _sampleAppService.GetAuthorizedAsync(); - result.Value.ShouldBe(42); - } - } -} diff --git a/test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj b/test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj index 2693972..1a5c392 100644 --- a/test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj +++ b/test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj @@ -13,4 +13,8 @@ + + + + diff --git a/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs deleted file mode 100644 index 265530e..0000000 --- a/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading.Tasks; -using IdentityModel.Client; -using Microsoft.Extensions.Configuration; -using WmsWebApi.Samples; -using Volo.Abp.DependencyInjection; -using Volo.Abp.IdentityModel; - -namespace WmsWebApi -{ - public class ClientDemoService : ITransientDependency - { - private readonly ISampleAppService _sampleAppService; - private readonly IIdentityModelAuthenticationService _authenticationService; - private readonly IConfiguration _configuration; - - public ClientDemoService( - ISampleAppService sampleAppService, - IIdentityModelAuthenticationService authenticationService, - IConfiguration configuration) - { - _sampleAppService = sampleAppService; - _authenticationService = authenticationService; - _configuration = configuration; - } - - public async Task RunAsync() - { - await TestWithDynamicProxiesAsync(); - await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); - await TestAllManuallyAsync(); - } - - /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy - * feature. It is just simple as calling a local service method. - * Authorization and HTTP request details are handled by the ABP framework. - */ - private async Task TestWithDynamicProxiesAsync() - { - Console.WriteLine(); - Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); - - var result = await _sampleAppService.GetAsync(); - Console.WriteLine("Result: " + result.Value); - - result = await _sampleAppService.GetAuthorizedAsync(); - Console.WriteLine("Result (authorized): " + result.Value); - } - - /* Shows how to use HttpClient to perform a request to the HTTP API. - * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. - */ - private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() - { - Console.WriteLine(); - Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); - - //Get access token using ABP's IIdentityModelAuthenticationService - - var accessToken = await _authenticationService.GetAccessTokenAsync( - new IdentityClientConfiguration( - _configuration["IdentityClients:Default:Authority"], - _configuration["IdentityClients:Default:Scope"], - _configuration["IdentityClients:Default:ClientId"], - _configuration["IdentityClients:Default:ClientSecret"], - _configuration["IdentityClients:Default:GrantType"], - _configuration["IdentityClients:Default:UserName"], - _configuration["IdentityClients:Default:UserPassword"] - ) - ); - - //Perform the actual HTTP request - - using (var httpClient = new HttpClient()) - { - httpClient.SetBearerToken(accessToken); - - var url = _configuration["RemoteServices:WmsWebApi:BaseUrl"] + - "api/WmsWebApi/sample/authorized"; - - var responseMessage = await httpClient.GetAsync(url); - if (responseMessage.IsSuccessStatusCode) - { - var responseString = await responseMessage.Content.ReadAsStringAsync(); - Console.WriteLine("Result: " + responseString); - } - else - { - throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); - } - } - } - - /* Shows how to use HttpClient to perform a request to the HTTP API. - * It obtains access token using IdentityServer's API. See its documentation: - * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html - */ - private async Task TestAllManuallyAsync() - { - Console.WriteLine(); - Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); - - //Obtain access token from the IDS4 server - - // discover endpoints from metadata - var client = new HttpClient(); - var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); - if (disco.IsError) - { - Console.WriteLine(disco.Error); - return; - } - - // request token - var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest - { - Address = disco.TokenEndpoint, - ClientId = _configuration["IdentityClients:Default:ClientId"], - ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], - UserName = _configuration["IdentityClients:Default:UserName"], - Password = _configuration["IdentityClients:Default:UserPassword"], - Scope = _configuration["IdentityClients:Default:Scope"] - }); - - if (tokenResponse.IsError) - { - Console.WriteLine(tokenResponse.Error); - return; - } - - Console.WriteLine(tokenResponse.Json); - - //Perform the actual HTTP request - - using (var httpClient = new HttpClient()) - { - httpClient.SetBearerToken(tokenResponse.AccessToken); - - var url = _configuration["RemoteServices:WmsWebApi:BaseUrl"] + - "api/WmsWebApi/sample/authorized"; - - var responseMessage = await httpClient.GetAsync(url); - if (responseMessage.IsSuccessStatusCode) - { - var responseString = await responseMessage.Content.ReadAsStringAsync(); - Console.WriteLine("Result: " + responseString); - } - else - { - throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); - } - } - } - } -} \ No newline at end of file diff --git a/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index ddd076b..4451f24 100644 --- a/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -18,18 +18,7 @@ namespace WmsWebApi.HttpApi.Client.ConsoleTestApp public async Task StartAsync(CancellationToken cancellationToken) { - using (var application = AbpApplicationFactory.Create(options=> - { - options.Services.ReplaceConfiguration(_configuration); - })) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - await demo.RunAsync(); - - application.Shutdown(); - } + await Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;