Browse Source

记录Json请求参数表添加重试状态字段

master
mahao 2 years ago
parent
commit
86b3b3576d
  1. 2
      host/WmsWebApi.HttpApi.Host/AbpExceptionFilterExtension.cs
  2. 33
      src/WmsWebApi.Application/Boms/BomService.cs
  3. 4
      src/WmsWebApi.Application/OtherZll/OtherZllService.cs
  4. 47
      src/WmsWebApi.Application/PPlan/PPlanService.cs
  5. 30
      src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs
  6. 24
      src/WmsWebApi.Application/Purchase/PurchaseService.cs
  7. 29
      src/WmsWebApi.Application/StockMove/StockMoveService.cs
  8. 40
      src/WmsWebApi.Application/TbParts/PartService.cs
  9. 1
      src/WmsWebApi.Application/WmsWebApi.Application.csproj
  10. 2
      src/WmsWebApi.Application/WmsWebApiApplicationModule.cs
  11. 21
      src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs
  12. 32
      src/WmsWebApi.Domain.Shared/Enums/EnumRetryStatus.cs
  13. 7
      src/WmsWebApi.Domain/Boms/WmsWebApiBOMDTO.cs
  14. 10
      src/WmsWebApi.Domain/OtherZll/WmsWebApiOtherZLLDTO.cs
  15. 9
      src/WmsWebApi.Domain/PPlan/WmsWebApiPPLANDTO.cs
  16. 9
      src/WmsWebApi.Domain/Parts/WmsWebApiPARTDTO.cs
  17. 7
      src/WmsWebApi.Domain/ProductRecieve/WmsWebApiProductRecieveDTO.cs
  18. 9
      src/WmsWebApi.Domain/Purchase/WmsWebApiPURCHASEDTO.cs
  19. 9
      src/WmsWebApi.Domain/StockMove/WmsWebApiStockMoveDTO.cs
  20. 4
      src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs
  21. 3
      src/WmsWebApi.Domain/WMS/TA_PART.cs
  22. 3
      src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs
  23. 3
      src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs
  24. 3
      src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs
  25. 8
      src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs
  26. 2
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs
  27. 8
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContextModelCreatingExtensions.cs
  28. 30
      test/WmsWebApi.Application.Tests/Samples/SampleAppService_Tests.cs
  29. 4
      test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj
  30. 156
      test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs
  31. 13
      test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs

2
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;

33
src/WmsWebApi.Application/Boms/BomService.cs

@ -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;

4
src/WmsWebApi.Application/OtherZll/OtherZllService.cs

@ -15,6 +15,9 @@ using WmsWebApi.Wms;
namespace WmsWebApi.OtherZll;
/// <summary>
/// 其他领物料
/// </summary>
[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

47
src/WmsWebApi.Application/PPlan/PPlanService.cs

@ -13,6 +13,9 @@ using WmsWebApi.Wms;
namespace WmsWebApi.PPlan;
/// <summary>
/// 计划
/// </summary>
[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 = "更新!";

30
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;
/// <summary>
/// Agv完工收货入库
/// </summary>
[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<TB_BILL> _billList = new List<TB_BILL>();
@ -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';

24
src/WmsWebApi.Application/Purchase/PurchaseService.cs

@ -14,6 +14,9 @@ using WmsWebApi.Wms;
namespace WmsWebApi.PPlan;
/// <summary>
/// 采购
/// </summary>
[Route("/api/Purchase")]
public class PurchaseService : ApplicationService, IPPlanService
{
@ -67,6 +70,16 @@ public class PurchaseService : ApplicationService, IPPlanService
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} 已存在!";

29
src/WmsWebApi.Application/StockMove/StockMoveService.cs

@ -15,6 +15,9 @@ using WmsWebApi.Wms;
namespace WmsWebApi.StockMove;
/// <summary>
/// Agv出入库
/// </summary>
[Route("/api/ss")]
public class StockMoveService : ApplicationService, IStockMoveService
{
@ -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<TB_BILL> _billList = new List<TB_BILL>();
@ -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';

40
src/WmsWebApi.Application/TbParts/PartService.cs

@ -13,6 +13,9 @@ using WmsWebApi.Wms;
namespace WmsWebApi.Parts;
/// <summary>
/// 零件
/// </summary>
[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();
}
}
}

1
src/WmsWebApi.Application/WmsWebApi.Application.csproj

@ -11,6 +11,7 @@
<PackageReference Include="Abp" Version="7.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="4.4.4" />
<PackageReference Include="Volo.Abp.BackgroundWorkers.Quartz" Version="7.0.2" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.4.4" />
<ProjectReference Include="..\WmsWebApi.Application.Contracts\WmsWebApi.Application.Contracts.csproj" />
<ProjectReference Include="..\WmsWebApi.Domain\WmsWebApi.Domain.csproj" />

2
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)

21
src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs

@ -16,6 +16,9 @@ using Abp.Domain.Uow;
namespace WmsWebApi.ZlldcjLogs;
/// <summary>
/// 领物料
/// </summary>
[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;

32
src/WmsWebApi.Domain.Shared/Enums/EnumRetryStatus.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WmsWebApi.Enums
{
/// <summary>
/// 重试状态
/// </summary>
public enum EnumRetryStatus
{
/// <summary>
/// 未定义
/// </summary>
None = 0,
/// <summary>
/// 等待重试
/// </summary>
WaitRetry = 1,
/// <summary>
/// 完成重试
/// </summary>
CompleteRetry = 2,
/// <summary>
/// 重试后失败
/// </summary>
FailedRetry = 3
}
}

7
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; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

10
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
{
/// <summary>
/// 其他领物料Json
/// </summary>
public class WmsWebApiOtherZLLDTO : BasicAggregateRoot<Guid>
{
//public int UID { get; set; }
@ -32,6 +36,12 @@ namespace WmsWebApi.OtherZll
[DisplayName("调用类型")]
public string ITYPE { get; set; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

9
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<Guid>
{
//public int UID { get; set; }
/// <summary>
/// 计划订单中的订单结束日期
/// </summary>
@ -104,6 +103,12 @@ namespace WmsWebApi.PPlan
[DisplayName("调用类型")]
public string ITYPE { get; set; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

9
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<Guid>
{
//public int UID { get; set; }
[DisplayName("物料号")]
public string MATNR { get; set; }
@ -56,6 +55,12 @@ namespace WmsWebApi.Parts
[DisplayName("调用类型")]
public string ITYPE { get; set; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

7
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; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

9
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<Guid>
{
//public int UID { get; set; }
/// <summary>
/// 物料凭证编号
/// </summary>
@ -37,6 +36,12 @@ namespace WmsWebApi.Purchase
[DisplayName("调用类型")]
public string ITYPE { get; set; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

9
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<Guid>
{
//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; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

4
src/WmsWebApi.Domain/WMS/IRepository/ITaPartRepository.cs

@ -6,7 +6,9 @@ using Volo.Abp.Domain.Services;
namespace WmsWebApi.Wms
{
/// <summary>
/// 物料
/// </summary>
public interface ITaPartRepository : IRepository<TA_PART>, ITransientDependency
{
Task<TA_PART> UpsertAsync(TA_PART taPart);

3
src/WmsWebApi.Domain/WMS/TA_PART.cs

@ -5,6 +5,9 @@ using Volo.Abp.Domain.Entities;
namespace WmsWebApi.Wms
{
/// <summary>
/// 物料
/// </summary>
public class TA_PART : Entity<long>
{
//public long UID { get; set; }

3
src/WmsWebApi.Domain/WMS/TA_STORE_LOCATION.cs

@ -5,6 +5,9 @@ using Volo.Abp.Domain.Entities;
namespace WmsWebApi.Wms
{
/// <summary>
/// 库位
/// </summary>
public class TA_STORE_LOCATION : Entity<int>
{
//public int UID { get; set; }

3
src/WmsWebApi.Domain/WMS/TM_PG_PLAN.cs

@ -6,6 +6,9 @@ using Volo.Abp.Domain.Entities;
namespace WmsWebApi.Wms
{
/// <summary>
/// 计划
/// </summary>
public class TM_PG_PLAN : Entity<int>
{
//public int UID { get; set; }

3
src/WmsWebApi.Domain/WMS/TS_STOCK_DETAIL.cs

@ -6,6 +6,9 @@ using Volo.Abp.Domain.Entities;
namespace WmsWebApi.Wms
{
/// <summary>
/// 库存
/// </summary>
public partial class TS_STOCK_DETAIL : Entity<long>
{
//public long UID { get; set; }

8
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<Guid>
public string ITYPE { get; set; } = "新增";
/// <summary>
/// 重试状态
/// </summary>
[DisplayName("重试状态")]
public EnumRetryStatus EnumRetryStatus { get; set; }
public void SetId(IGuidGenerator guidGenerator)
{
this.Id = guidGenerator.Create();

2
src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiDbContext.cs

@ -46,7 +46,7 @@ namespace WmsWebApi.EntityFrameworkCore
public WmsWebApiDbContext(DbContextOptions<WmsWebApiDbContext> options)
: base(options)
{
//this.Database.SetCommandTimeout(120);
this.Database.SetCommandTimeout(40);
}
protected override void OnModelCreating(ModelBuilder builder)

8
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<string>();
});
}
@ -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<string>();
});
}
@ -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<string>();
});
}
@ -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<string>();
});
}
@ -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<string>();
});
}
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<string>();
});
}
@ -652,6 +658,7 @@ namespace WmsWebApi.EntityFrameworkCore
{
b.ToTable("WmsWebApiProductRecieveDTO", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion<string>();
});
}
@ -661,6 +668,7 @@ namespace WmsWebApi.EntityFrameworkCore
{
b.ToTable("WmsWebApiStockMoveDTO", WmsWebApiDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(p => p.EnumRetryStatus).HasMaxLength(64).HasConversion<string>();
});
}
}

30
test/WmsWebApi.Application.Tests/Samples/SampleAppService_Tests.cs

@ -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<ISampleAppService>();
}
[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);
}
}
}

4
test/WmsWebApi.Application.Tests/WmsWebApi.Application.Tests.csproj

@ -13,4 +13,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Samples\" />
</ItemGroup>
</Project>

156
test/WmsWebApi.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs

@ -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);
}
}
}
}
}

13
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<WmsWebApiConsoleApiClientModule>(options=>
{
options.Services.ReplaceConfiguration(_configuration);
}))
{
application.Initialize();
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>();
await demo.RunAsync();
application.Shutdown();
}
await Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;

Loading…
Cancel
Save