Browse Source

1、修改命名空间

2、增加UTF-8空格强转校验
master
陈宜阳 7 months ago
parent
commit
4d66753980
  1. 4
      src/WmsWebApi.Application.Contracts/Boms/BomDetailDto.cs
  2. 7
      src/WmsWebApi.Application.Contracts/Boms/BomDto.cs
  3. 3
      src/WmsWebApi.Application.Contracts/Boms/IBomService.cs
  4. 3
      src/WmsWebApi.Application.Contracts/Boms/ReturnResult.cs
  5. 4
      src/WmsWebApi.Application.Contracts/OtherZll/IOtherZllService.cs
  6. 6
      src/WmsWebApi.Application.Contracts/OtherZll/OtherZllDto.cs
  7. 3
      src/WmsWebApi.Application.Contracts/OtherZll/ReturnResult.cs
  8. 20
      src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs
  9. 168
      src/WmsWebApi.Application.Contracts/PPLan/PPlanDto.cs
  10. 14
      src/WmsWebApi.Application.Contracts/PPLan/ReturnResult.cs
  11. 3
      src/WmsWebApi.Application.Contracts/Parts/IPartService.cs
  12. 15
      src/WmsWebApi.Application.Contracts/Parts/PartDetailDto.cs
  13. 4
      src/WmsWebApi.Application.Contracts/Parts/PartDto.cs
  14. 18
      src/WmsWebApi.Application.Contracts/Parts/ReturnResult.cs
  15. 20
      src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs
  16. 48
      src/WmsWebApi.Application.Contracts/ProductRecieve/PRDetailDto.cs
  17. 86
      src/WmsWebApi.Application.Contracts/ProductRecieve/PRDto.cs
  18. 14
      src/WmsWebApi.Application.Contracts/ProductRecieve/ReturnResult.cs
  19. 3
      src/WmsWebApi.Application.Contracts/Purchase/IPurchaseService.cs
  20. 13
      src/WmsWebApi.Application.Contracts/Purchase/PurchaseDetailDto.cs
  21. 3
      src/WmsWebApi.Application.Contracts/Purchase/PurchaseDto.cs
  22. 14
      src/WmsWebApi.Application.Contracts/Purchase/ReturnResult.cs
  23. 20
      src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs
  24. 3
      src/WmsWebApi.Application.Contracts/StockMove/ReturnResult.cs
  25. 11
      src/WmsWebApi.Application.Contracts/StockMove/SSDetailDto.cs
  26. 5
      src/WmsWebApi.Application.Contracts/StockMove/SSDto.cs
  27. 5
      src/WmsWebApi.Application.Contracts/ZlldcjLogs/IZlldcjLogAppService.cs
  28. 3
      src/WmsWebApi.Application.Contracts/ZlldcjLogs/ReturnResult.cs
  29. 11
      src/WmsWebApi.Application.Contracts/ZlldcjLogs/ZlldcjLog.cs
  30. 474
      src/WmsWebApi.Application/Boms/BomService.cs
  31. 700
      src/WmsWebApi.Application/OtherZll/OtherZllService.cs
  32. 404
      src/WmsWebApi.Application/PPlan/PPlanService.cs
  33. 3
      src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs
  34. 29
      src/WmsWebApi.Application/Purchase/PurchaseService.cs
  35. 3
      src/WmsWebApi.Application/StockMove/StockMoveService.cs
  36. 22
      src/WmsWebApi.Application/TbParts/PartService.cs
  37. 5
      src/WmsWebApi.Application/ZlldcjLogs/ZlldcjLogAppService.cs
  38. 64
      src/WmsWebApi.Domain/Boms/BomManager.cs
  39. 14
      src/WmsWebApi.Domain/Boms/IBomManager.cs
  40. 10
      src/WmsWebApi.Domain/OtherZll/IOtherZllManager.cs
  41. 32
      src/WmsWebApi.Domain/OtherZll/OtherZllManager.cs
  42. 10
      src/WmsWebApi.Domain/PPlan/IPPlanManager.cs
  43. 32
      src/WmsWebApi.Domain/PPlan/PPlanManager.cs
  44. 10
      src/WmsWebApi.Domain/Parts/IPartManager.cs
  45. 32
      src/WmsWebApi.Domain/Parts/PartManager.cs
  46. 10
      src/WmsWebApi.Domain/ProductRecieve/IProductRecieveManager.cs
  47. 32
      src/WmsWebApi.Domain/ProductRecieve/ProductRecieveManager.cs
  48. 10
      src/WmsWebApi.Domain/Purchase/IPurchaseManager.cs
  49. 5
      src/WmsWebApi.Domain/Purchase/PurchaseManager.cs
  50. 3
      src/WmsWebApi.Domain/StockMove/IStockMoveManager.cs
  51. 5
      src/WmsWebApi.Domain/StockMove/StockMoveManager.cs
  52. 7
      src/WmsWebApi.Domain/TbOrfers/TbOrder.cs
  53. 62
      src/WmsWebApi.Domain/WMS/TbBillExtensions.cs
  54. 3
      src/WmsWebApi.Domain/ZlldcjLogs/IZlldcjLogManager.cs
  55. 5
      src/WmsWebApi.Domain/ZlldcjLogs/WmsWebApiZLLDCJDTO.cs
  56. 5
      src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLog.cs
  57. 5
      src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogExtensions.cs
  58. 272
      src/WmsWebApi.Domain/ZlldcjLogs/ZlldcjLogManager.cs
  59. 12
      src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs
  60. 5
      src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLog.cs
  61. 5
      src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogExtensions.cs
  62. 13
      src/WmsWebApi.Domain/ZlldgbLogs/ZlldgbLogManager.cs

4
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; }
}
}

7
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
{
/// <summary>
@ -59,4 +59,5 @@ public class BomDto : EntityDto
public virtual List<BomDetailDto> items { get; set; }
}
}
}

3
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<ReturnResult> AddAsync(object content);
}
}

3
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";
}
}

4
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 {
/// <summary>
/// 其他领物料
@ -15,4 +15,6 @@ public interface IOtherZllService : IApplicationService
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
}
}

6
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; }
}
}

3
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";
}
}

20
src/WmsWebApi.Application.Contracts/PPLan/IPPlanService.cs

@ -2,17 +2,19 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace WmsWebApi.PPLan;
/// <summary>
/// 计划
/// </summary>
public interface IPPlanService : IApplicationService
namespace WmsWebApi.PPLan
{
/// <summary>
/// 是否是请求重试
/// 计划
/// </summary>
public bool IsRequestRetry { get; set; }
public interface IPPlanService : IApplicationService
{
/// <summary>
/// 是否是请求重试
/// </summary>
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
public Task<ReturnResult> AddAsync(object content);
}
}

168
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
{
/// <summary>
/// 计划订单中的订单结束日期
/// </summary>
[Display(Name = "计划订单中的订单结束日期")]
public string PEDTR { get; set; }
/// <summary>
/// 分组
/// </summary>
[Display(Name = "分组")]
public string SCHGRUP { get; set; }
/// <summary>
/// 班次
/// </summary>
[Display(Name = "班次")]
public string KAPTPROG { get; set; }
public class PPlanDto : EntityDto
{
/// <summary>
/// 计划订单中的订单结束日期
/// </summary>
[Display(Name = "计划订单中的订单结束日期")]
public string PEDTR { get; set; }
/// <summary>
/// 分组
/// </summary>
[Display(Name = "分组")]
public string SCHGRUP { get; set; }
/// <summary>
/// 班次
/// </summary>
[Display(Name = "班次")]
public string KAPTPROG { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号 ")]
public string MATNR { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
public string MAKTX { get; set; }
/// <summary>
/// 工厂
/// </summary>
[Display(Name = "工厂")]
public string WERKS { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号 ")]
public string MATNR { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
public string MAKTX { get; set; }
/// <summary>
/// 工厂
/// </summary>
[Display(Name = "工厂")]
public string WERKS { get; set; }
/// <summary>
/// 生产版本
/// </summary>
[Display(Name = "生产版本")]
public string VERID { get; set; }
/// <summary>
/// 生产顺序
/// </summary>
[Display(Name = "生产顺序")]
public string ZSCSX { get; set; }
/// <summary>
/// 机器代码
/// </summary>
[Display(Name = "机器代码")]
public string ZMACD { get; set; }
/// <summary>
/// 机器描述
/// </summary>
[Display(Name = "机器描述")]
public string ZMATX { get; set; }
/// <summary>
/// MRP 控制者(物料计划人)
/// </summary>
[Display(Name = "MRP 控制者(物料计划人)")]
public string DISPO { get; set; }
/// <summary>
/// 全部的计划订单数量
/// </summary>
[Display(Name = "全部的计划订单数量 ")]
public decimal GSMNG { get; set; } = 0;
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string ZBZSM { get; set; }
/// <summary>
/// 用户主记录中的用户名称
/// </summary>
[Display(Name = "用户主记录中的用户名称 ")]
public string XUBNAME { get; set; }
/// <summary>
/// 更改日期
/// </summary>
[Display(Name = "生产顺序")]
public string ZCDATE { get; set; }
/// <summary>
/// 更改时间
/// </summary>
[Display(Name = "更改时间")]
public string ZCTIME { get; set; }
/// <summary>
/// 生产版本
/// </summary>
[Display(Name = "生产版本")]
public string VERID { get; set; }
/// <summary>
/// 生产顺序
/// </summary>
[Display(Name = "生产顺序")]
public string ZSCSX { get; set; }
/// <summary>
/// 机器代码
/// </summary>
[Display(Name = "机器代码")]
public string ZMACD { get; set; }
/// <summary>
/// 机器描述
/// </summary>
[Display(Name = "机器描述")]
public string ZMATX { get; set; }
/// <summary>
/// MRP 控制者(物料计划人)
/// </summary>
[Display(Name = "MRP 控制者(物料计划人)")]
public string DISPO { get; set; }
/// <summary>
/// 全部的计划订单数量
/// </summary>
[Display(Name = "全部的计划订单数量 ")]
public decimal GSMNG { get; set; } = 0;
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string ZBZSM { get; set; }
/// <summary>
/// 用户主记录中的用户名称
/// </summary>
[Display(Name = "用户主记录中的用户名称 ")]
public string XUBNAME { get; set; }
/// <summary>
/// 更改日期
/// </summary>
[Display(Name = "生产顺序")]
public string ZCDATE { get; set; }
/// <summary>
/// 更改时间
/// </summary>
[Display(Name = "更改时间")]
public string ZCTIME { get; set; }
}
}

14
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";
}
}

3
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 {
/// <summary>
/// 零件
@ -15,4 +15,5 @@ public interface IPartService : IApplicationService
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
}
}

15
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; }
}
}

4
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<PartDetailDto> zzchar { get; set; }
}
}

18
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";
}
}

20
src/WmsWebApi.Application.Contracts/ProductRecieve/IProductRecieveService.cs

@ -2,17 +2,19 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace WmsWebApi.ProductRecieve;
/// <summary>
/// Agv完工收货入库
/// </summary>
public interface IProductRecieveService : IApplicationService
namespace WmsWebApi.ProductRecieve
{
/// <summary>
/// 是否是请求重试
/// Agv完工收货入库
/// </summary>
public bool IsRequestRetry { get; set; }
public interface IProductRecieveService : IApplicationService
{
/// <summary>
/// 是否是请求重试
/// </summary>
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
public Task<ReturnResult> AddAsync(object content);
}
}

48
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; }
}
}

86
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
{
/// <summary>
/// 过账日期
/// </summary>
[Display(Name = "过账日期")]
public string AccountDate { get; set; }
/// <summary>
/// 单据类型 901完工收货,902上架,903下架
/// </summary>
[Display(Name = "单据类型")]
public string BillType { get; set; }
/// <summary>
/// 接收日期
/// </summary>
[Display(Name = "接收日期")]
public string ReceiveDate { get; set; }
[Display(Name = "GUID")]
public string GUID { get; set; }
/// <summary>
/// 操作者
/// </summary>
[Display(Name = "操作者")]
public string OperName { get; set; }
/// <summary>
/// 单据时间
/// </summary>
[Display(Name = "单据时间")]
public string BillTime { get; set; }
/// <summary>
/// IWMS单号
/// </summary>
[Display(Name = "IWMS单号")]
public string SourceBillNum { get; set; }
public virtual List<PRDetailDto> items { get; set; }
public class PRDto : EntityDto
{
/// <summary>
/// 过账日期
/// </summary>
[Display(Name = "过账日期")]
public string AccountDate { get; set; }
/// <summary>
/// 单据类型 901完工收货,902上架,903下架
/// </summary>
[Display(Name = "单据类型")]
public string BillType { get; set; }
/// <summary>
/// 接收日期
/// </summary>
[Display(Name = "接收日期")]
public string ReceiveDate { get; set; }
[Display(Name = "GUID")]
public string GUID { get; set; }
/// <summary>
/// 操作者
/// </summary>
[Display(Name = "操作者")]
public string OperName { get; set; }
/// <summary>
/// 单据时间
/// </summary>
[Display(Name = "单据时间")]
public string BillTime { get; set; }
/// <summary>
/// IWMS单号
/// </summary>
[Display(Name = "IWMS单号")]
public string SourceBillNum { get; set; }
public virtual List<PRDetailDto> items { get; set; }
}
}

14
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";
}
}

3
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 {
/// <summary>
/// 采购
@ -15,4 +15,5 @@ public interface IPurchaseService : IApplicationService
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
}
}

13
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; }
}
}

3
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<PurchaseDetailDto> zzmseg { get; set; }
}
}

14
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";
}
}

20
src/WmsWebApi.Application.Contracts/StockMove/IStockMoveService.cs

@ -2,17 +2,19 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace WmsWebApi.StockMove;
/// <summary>
/// Agv出入库
/// </summary>
public interface IStockMoveService : IApplicationService
namespace WmsWebApi.StockMove
{
/// <summary>
/// 是否是请求重试
/// Agv出入库
/// </summary>
public bool IsRequestRetry { get; set; }
public interface IStockMoveService : IApplicationService
{
/// <summary>
/// 是否是请求重试
/// </summary>
public bool IsRequestRetry { get; set; }
public Task<ReturnResult> AddAsync(object content);
public Task<ReturnResult> AddAsync(object content);
}
}

3
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";
}
}

11
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; }
}
}

5
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单号
/// </summary>
[Display(Name = "IWMS单号")]
public string SourceBillNum { get; set; }
public string SourceBillNum { get; set; }
public virtual List<SSDetailDto> items { get; set; }
}
}

5
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 {
/// <summary>
/// 领物料
/// </summary>
public interface IZlldcjLogAppService :IApplicationService
public interface IZlldcjLogAppService : IApplicationService
{
/// <summary>
/// 是否是请求重试
@ -20,4 +20,5 @@ public interface IZlldcjLogAppService :IApplicationService
public Task<ReturnResult> AddAsync(object content);
public Task<ReturnResult> CloseAsync(object content);
}
}

3
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
{
}
}
}

11
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
{
/// <summary>
/// 单据号
@ -161,7 +161,8 @@ public class ZlldcjLogDto:EntityDto
/// </summary>
[Display(Name = "交货项目")]
public string POSNR { get; set; }
/*
[Display(Name = "接口类型")]
public string IType { get; set; }*/
/*
[Display(Name = "接口类型")]
public string IType { get; set; }*/
}
}

474
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;
/// <summary>
/// 是否是请求重试
/// </summary>
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<Exception>()
.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;
/// <summary>
/// 是否是请求重试
/// </summary>
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<Exception>()
.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<ReturnResult> 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<BomDto>(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<ReturnResult> 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<BomDto>(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<WmsWebApiBomDetail> bDetail = new List<WmsWebApiBomDetail>();
foreach (var item in _bom.items)
#region BOM信息更新
if (partgrouplist.Select(p => p.PARTGROUP).Contains(part.PartGroup))
{
/*var bom = new TA_BOM();
List<WmsWebApiBomDetail> bDetail = new List<WmsWebApiBomDetail>();
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();
}
}
}
}

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

@ -18,429 +18,431 @@ using WmsWebApi.Jsons;
using WmsWebApi.Options;
using WmsWebApi.Wms;
namespace WmsWebApi.OtherZll;
/// <summary>
/// 其他领物料
/// </summary>
[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;
/// <summary>
/// 是否是请求重试
/// 其他领物料
/// </summary>
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> customConfigOptions,
IOptionsMonitor<OtherZllConfigOptions> 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<Exception>()
.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;
/// <summary>
/// 是否是请求重试
/// </summary>
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> customConfigOptions,
IOptionsMonitor<OtherZllConfigOptions> 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<Exception>()
.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<ReturnResult> AddAsync([FromBody] object content)
{
var result = new ReturnResult();
List<OtherZllDto> _dtoList;
bool bTypeErr = false, bErr = false;
try
{
_dtoList = JsonConvert.DeserializeObject<List<OtherZllDto>>(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<ReturnResult> 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<OtherZllDto> _dtoList;
bool bTypeErr = false, bErr = false;
try
{
_dtoList = JsonConvert.DeserializeObject<List<OtherZllDto>>(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<string> 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<TB_BILL> _billList = new List<TB_BILL>();
List<TB_PRODUCT_RECEIVE> _recieveList = new List<TB_PRODUCT_RECEIVE>();
List<TS_STOCK_DETAIL> _stockList = new List<TS_STOCK_DETAIL>();
List<TS_STOCK_DETAIL> _stockUpdateList = new List<TS_STOCK_DETAIL>();
List<TS_STOCK_DETAIL> _stockDelList = new List<TS_STOCK_DETAIL>();
List<TL_TRANSACTION> _transList = new List<TL_TRANSACTION>();
if (_otherZllConfigOptions.IsEnableErnamFilter == true)
{
//根据配置文件过滤ERNAM
List<string> 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<TB_BILL> _billList = new List<TB_BILL>();
List<TB_PRODUCT_RECEIVE> _recieveList = new List<TB_PRODUCT_RECEIVE>();
List<TS_STOCK_DETAIL> _stockList = new List<TS_STOCK_DETAIL>();
List<TS_STOCK_DETAIL> _stockUpdateList = new List<TS_STOCK_DETAIL>();
List<TS_STOCK_DETAIL> _stockDelList = new List<TS_STOCK_DETAIL>();
List<TL_TRANSACTION> _transList = new List<TL_TRANSACTION>();
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();
}
}
}
}

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

@ -14,252 +14,254 @@ using WmsWebApi.Jsons;
using WmsWebApi.PPLan;
using WmsWebApi.Wms;
namespace WmsWebApi.PPlan;
/// <summary>
/// 计划
/// </summary>
[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;
/// <summary>
/// 是否是请求重试
/// 计划
/// </summary>
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<Exception>()
.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;
/// <summary>
/// 是否是请求重试
/// </summary>
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<Exception>()
.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<ReturnResult> AddAsync([FromBody] object content)
{
var result = new ReturnResult();
PPlanDto _planDto;
bool bUpdate = false,bOtherWork = false,bErr = false;
try
{
_planDto = JsonConvert.DeserializeObject<PPlanDto>(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<ReturnResult> 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<PPlanDto>(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();
}
}
}
}

3
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 {
/// <summary>
/// Agv完工收货入库
@ -400,4 +400,5 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
await uow.SaveChangesAsync();
}
}
}
}

29
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 {
/// <summary>
/// 采购
@ -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();
}
}
}
}

3
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 {
/// <summary>
/// Agv出入库
@ -569,4 +569,5 @@ public class StockMoveService : ApplicationService, IStockMoveService
await uow.SaveChangesAsync();
}
}
}
}

22
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
{
/// <summary>
/// 零件
/// </summary>
@ -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<PartDto>(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<PartDto>(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();
}
}
}
}

5
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 {
/// <summary>
/// 领物料
@ -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;
}
}
}

64
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<WmsWebApiBOMDTO, Guid> _bomDtoRepository;
private readonly IRepository<WmsWebApiBom, Guid> _bomRepository;
private readonly IRepository<WmsWebApiBomDetail, Guid> _bomDetailRepository;
public BomManager(
IRepository<WmsWebApiBOMDTO, Guid> bomDtoRepository,
IRepository<WmsWebApiBom, Guid> bomRepository,
IRepository<WmsWebApiBomDetail, Guid> bomDetailRepository
)
{
_bomDtoRepository = bomDtoRepository;
_bomRepository = bomRepository;
_bomDetailRepository = bomDetailRepository;
}
public async Task<WmsWebApiBOMDTO> AddAsync(WmsWebApiBOMDTO part)
public class BomManager : DomainService, IBomManager
{
private readonly IRepository<WmsWebApiBOMDTO, Guid> _bomDtoRepository;
private readonly IRepository<WmsWebApiBom, Guid> _bomRepository;
private readonly IRepository<WmsWebApiBomDetail, Guid> _bomDetailRepository;
await _bomDtoRepository.InsertAsync(part);
return part;
}
public BomManager(
IRepository<WmsWebApiBOMDTO, Guid> bomDtoRepository,
IRepository<WmsWebApiBom, Guid> bomRepository,
IRepository<WmsWebApiBomDetail, Guid> bomDetailRepository
)
{
_bomDtoRepository = bomDtoRepository;
_bomRepository = bomRepository;
_bomDetailRepository = bomDetailRepository;
}
public async Task<WmsWebApiBom> AddBomAsync(WmsWebApiBom bom)
{
await _bomRepository.InsertAsync(bom);
return bom;
}
public async Task<WmsWebApiBomDetail> AddBomDetailAsync(List<WmsWebApiBomDetail> bomDetails)
{
await _bomDetailRepository.InsertManyAsync(bomDetails);
return bomDetails[0];
public async Task<WmsWebApiBOMDTO> AddAsync(WmsWebApiBOMDTO part)
{
await _bomDtoRepository.InsertAsync(part);
return part;
}
public async Task<WmsWebApiBom> AddBomAsync(WmsWebApiBom bom)
{
await _bomRepository.InsertAsync(bom);
return bom;
}
public async Task<WmsWebApiBomDetail> AddBomDetailAsync(List<WmsWebApiBomDetail> bomDetails)
{
await _bomDetailRepository.InsertManyAsync(bomDetails);
return bomDetails[0];
}
}
}

14
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<WmsWebApiBOMDTO> AddAsync(WmsWebApiBOMDTO part);
Task<WmsWebApiBom> AddBomAsync(WmsWebApiBom bom);
Task<WmsWebApiBomDetail> AddBomDetailAsync(List<WmsWebApiBomDetail> bomDetails);
public interface IBomManager
{
Task<WmsWebApiBOMDTO> AddAsync(WmsWebApiBOMDTO part);
Task<WmsWebApiBom> AddBomAsync(WmsWebApiBom bom);
Task<WmsWebApiBomDetail> AddBomDetailAsync(List<WmsWebApiBomDetail> bomDetails);
}
}

10
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<WmsWebApiOtherZLLDTO> AddAsync(WmsWebApiOtherZLLDTO dto);
public interface IOtherZllManager
{
Task<WmsWebApiOtherZLLDTO> AddAsync(WmsWebApiOtherZLLDTO dto);
}
}

32
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<WmsWebApiOtherZLLDTO, Guid> _otherZLLDTORepository;
public OtherZllManager(
IRepository<WmsWebApiOtherZLLDTO, Guid> otherZLLDTORepository
)
public class OtherZllManager : DomainService, IOtherZllManager
{
_otherZLLDTORepository = otherZLLDTORepository;
}
private readonly IRepository<WmsWebApiOtherZLLDTO, Guid> _otherZLLDTORepository;
public async Task<WmsWebApiOtherZLLDTO> AddAsync(WmsWebApiOtherZLLDTO dto)
{
public OtherZllManager(
IRepository<WmsWebApiOtherZLLDTO, Guid> otherZLLDTORepository
)
{
_otherZLLDTORepository = otherZLLDTORepository;
}
await _otherZLLDTORepository.InsertAsync(dto);
return dto;
}
public async Task<WmsWebApiOtherZLLDTO> AddAsync(WmsWebApiOtherZLLDTO dto)
{
await _otherZLLDTORepository.InsertAsync(dto);
return dto;
}
}
}

10
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<WmsWebApiPPLANDTO> AddAsync(WmsWebApiPPLANDTO pplan);
public interface IPPlanManager
{
Task<WmsWebApiPPLANDTO> AddAsync(WmsWebApiPPLANDTO pplan);
}
}

32
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<WmsWebApiPPLANDTO, Guid> _bomDtoRepository;
public PPlanManager(
IRepository<WmsWebApiPPLANDTO, Guid> bomDtoRepository
)
public class PPlanManager : DomainService, IPPlanManager
{
_bomDtoRepository = bomDtoRepository;
}
private readonly IRepository<WmsWebApiPPLANDTO, Guid> _bomDtoRepository;
public async Task<WmsWebApiPPLANDTO> AddAsync(WmsWebApiPPLANDTO pplan)
{
public PPlanManager(
IRepository<WmsWebApiPPLANDTO, Guid> bomDtoRepository
)
{
_bomDtoRepository = bomDtoRepository;
}
await _bomDtoRepository.InsertAsync(pplan);
return pplan;
}
public async Task<WmsWebApiPPLANDTO> AddAsync(WmsWebApiPPLANDTO pplan)
{
await _bomDtoRepository.InsertAsync(pplan);
return pplan;
}
}
}

10
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<WmsWebApiPARTDTO> AddAsync(WmsWebApiPARTDTO part);
public interface IPartManager
{
Task<WmsWebApiPARTDTO> AddAsync(WmsWebApiPARTDTO part);
}
}

32
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<WmsWebApiPARTDTO, Guid> _partDtoRepository;
public PartManager(
IRepository<WmsWebApiPARTDTO, Guid> partDtoRepository
)
public class PartManager : DomainService, IPartManager
{
_partDtoRepository = partDtoRepository;
}
private readonly IRepository<WmsWebApiPARTDTO, Guid> _partDtoRepository;
public async Task<WmsWebApiPARTDTO> AddAsync(WmsWebApiPARTDTO part)
{
public PartManager(
IRepository<WmsWebApiPARTDTO, Guid> partDtoRepository
)
{
_partDtoRepository = partDtoRepository;
}
await _partDtoRepository.InsertAsync(part);
return part;
}
public async Task<WmsWebApiPARTDTO> AddAsync(WmsWebApiPARTDTO part)
{
await _partDtoRepository.InsertAsync(part);
return part;
}
}
}

10
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<WmsWebApiProductRecieveDTO> AddAsync(WmsWebApiProductRecieveDTO part);
public interface IProductRecieveManager
{
Task<WmsWebApiProductRecieveDTO> AddAsync(WmsWebApiProductRecieveDTO part);
}
}

32
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<WmsWebApiProductRecieveDTO, Guid> _partDtoRepository;
public ProductRecieveManager(
IRepository<WmsWebApiProductRecieveDTO, Guid> partDtoRepository
)
public class ProductRecieveManager : DomainService, IProductRecieveManager
{
_partDtoRepository = partDtoRepository;
}
private readonly IRepository<WmsWebApiProductRecieveDTO, Guid> _partDtoRepository;
public async Task<WmsWebApiProductRecieveDTO> AddAsync(WmsWebApiProductRecieveDTO part)
{
public ProductRecieveManager(
IRepository<WmsWebApiProductRecieveDTO, Guid> partDtoRepository
)
{
_partDtoRepository = partDtoRepository;
}
await _partDtoRepository.InsertAsync(part);
return part;
}
public async Task<WmsWebApiProductRecieveDTO> AddAsync(WmsWebApiProductRecieveDTO part)
{
await _partDtoRepository.InsertAsync(part);
return part;
}
}
}

10
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<WmsWebApiPURCHASEDTO> AddAsync(WmsWebApiPURCHASEDTO dto);
public interface IPurchaseManager
{
Task<WmsWebApiPURCHASEDTO> AddAsync(WmsWebApiPURCHASEDTO dto);
}
}

5
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<WmsWebApiPURCHASEDTO> AddAsync(WmsWebApiPURCHASEDTO dto)
{
@ -30,4 +30,5 @@ public class PurchaseManager : DomainService, IPurchaseManager
return dto;
}
}
}

3
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<WmsWebApiStockMoveDTO> AddAsync(WmsWebApiStockMoveDTO part);
}
}

5
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<WmsWebApiStockMoveDTO> AddAsync(WmsWebApiStockMoveDTO part)
{
@ -30,4 +30,5 @@ public class StockMoveManager : DomainService, IStockMoveManager
return part;
}
}
}

7
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<Guid>
public class TbOrder : BasicAggregateRoot<Guid>
{
public string OrderNumber { get; set; }
public int Status { get; set; }
}
}

62
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}行项不存在");
}
}
}
}
}

3
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<ZlldcjLog> AddAsync(List<ZlldcjLog> zlldcjLog);
Task<ZlldcjLog> CloseAsync(List<ZlldcjLog> zlldcjLogs);
Task<WmsWebApiZLLDCJDTO> AddDtoAsync(WmsWebApiZLLDCJDTO dto);
}
}

5
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<Guid>
{
@ -14,7 +14,7 @@ public class WmsWebApiZLLDCJDTO : BasicAggregateRoot<Guid>
/// 单据号
/// </summary>
[Display(Name = "单据号")]
public string ZLLDJ { get; set; }
public string ZLLDJ { get; set; }
/// <summary>
/// 单据类型
/// </summary>
@ -42,4 +42,5 @@ public class WmsWebApiZLLDCJDTO : BasicAggregateRoot<Guid>
{
this.Id = guidGenerator.Create();
}
}
}

5
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<Guid>
public class ZlldcjLog : CreationAuditedAggregateRoot<Guid>
{
/// <summary>
/// 单据号
@ -173,4 +173,5 @@ public class ZlldcjLog:CreationAuditedAggregateRoot<Guid>
/// </summary>
[Display(Name = "接口类型")]
public string IType { get; set; }
}
}

5
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
}
}
}
}

272
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<ZlldcjLog, Guid> _zlldcjLogsRepository;
private readonly IRepository<WmsWebApiZLLDCJDTO, Guid> _zlldcjDtoRepository;
private readonly ITbBillRepository _tbBillRepository;
private readonly ITmSapMoveTypeRepository _tbSapMoveTypeRepository;
private readonly ITmOtherAskRepository _tbOtherInOutAskRepository;
//private readonly ITmOtherAskRepositoryUpdate _tmOtherAskRepositoryUpdate;
public ZlldcjLogManager(
IRepository<ZlldcjLog,Guid> zlldcjLogsRepository
, IRepository<WmsWebApiZLLDCJDTO, Guid> zlldcjDtoRepository
, ITbBillRepository tbBillRepository
, ITmSapMoveTypeRepository tbSapMoveTypeRepository
, ITmOtherAskRepository tbOtherInOutAskRepository
//, ITmOtherAskRepositoryUpdate tmOtherAskRepositoryUpdate
)
{
_zlldcjLogsRepository = zlldcjLogsRepository;
_zlldcjDtoRepository = zlldcjDtoRepository;
_tbBillRepository = tbBillRepository;
_tbSapMoveTypeRepository = tbSapMoveTypeRepository;
_tbOtherInOutAskRepository = tbOtherInOutAskRepository;
}
public async Task<ZlldcjLog> AddAsync(List<ZlldcjLog> zlldcjLogs)
public class ZlldcjLogManager : DomainService, IZlldcjLogManager
{
private readonly IRepository<ZlldcjLog, Guid> _zlldcjLogsRepository;
private readonly IRepository<WmsWebApiZLLDCJDTO, Guid> _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<ZlldcjLog, Guid> zlldcjLogsRepository
, IRepository<WmsWebApiZLLDCJDTO, Guid> 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<ZlldcjLog> AddAsync(List<ZlldcjLog> zlldcjLogs)
{
tbBill.SubBillType = sapMoveType.SubBillType;
tbBill.Remark = sapMoveType.SAPBillDesc;
sapBillDesc = sapMoveType.SAPBillDesc;
List<TM_PG_OTHER_INOUT_ASK> askList = new List<TM_PG_OTHER_INOUT_ASK>();
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<TM_PG_OTHER_INOUT_ASK> askList = new List<TM_PG_OTHER_INOUT_ASK>();
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<ZlldcjLog> CloseAsync(List<ZlldcjLog> 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<ZlldcjLog> CloseAsync(List<ZlldcjLog> 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<WmsWebApiZLLDCJDTO> 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<int> AddZlldcjAsync(List<ZlldcjLog> dtos)
{
zlldcjLog.IType = "关闭";
await _zlldcjLogsRepository.InsertManyAsync(dtos);
return dtos.Count;
}
await _zlldcjLogsRepository.InsertManyAsync(zlldcjLogs);
return zlldcjLogs[0];
}
public async Task<WmsWebApiZLLDCJDTO> AddDtoAsync(WmsWebApiZLLDCJDTO dto)
{
await _zlldcjDtoRepository.InsertAsync(dto);
return dto;
}
public async Task<int> AddZlldcjAsync(List<ZlldcjLog> dtos)
{
await _zlldcjLogsRepository.InsertManyAsync(dtos);
return dtos.Count;
}
}

12
src/WmsWebApi.Domain/ZlldgbLogs/IZlldgbLogManager.cs

@ -1,9 +1,11 @@
using System.Threading.Tasks;
namespace WmsWebApi.ZlldgbLogs;
public interface IZlldgbLogManager
namespace WmsWebApi.ZlldgbLogs
{
Task<ZlldgbLog> AddAsync(ZlldgbLog zlldcjLog);
Task<ZlldgbLog> CloseAsync(ZlldgbLog zlldcjLog);
public interface IZlldgbLogManager
{
Task<ZlldgbLog> AddAsync(ZlldgbLog zlldcjLog);
Task<ZlldgbLog> CloseAsync(ZlldgbLog zlldcjLog);
}
}

5
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<Guid>
public class ZlldgbLog : CreationAuditedAggregateRoot<Guid>
{
/// <summary>
/// 单据号
@ -167,4 +167,5 @@ public class ZlldgbLog:CreationAuditedAggregateRoot<Guid>
{
this.Id = guidGenerator.Create();
}
}
}

5
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
}
}
}
}

13
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<ZlldgbLog, Guid> _zlldcjLogsRepository;
private readonly IRepository<TbOrder, Guid> _tbOrderRepository;
public ZlldgbLogManager(
IRepository<ZlldgbLog,Guid> zlldcjLogsRepository
,IRepository<TbOrder,Guid> tbOrderRepository)
IRepository<ZlldgbLog, Guid> zlldcjLogsRepository
, IRepository<TbOrder, Guid> tbOrderRepository)
{
_zlldcjLogsRepository = zlldcjLogsRepository;
_tbOrderRepository = tbOrderRepository;
}
public async Task<ZlldgbLog> AddAsync(ZlldgbLog zlldcjLog)
{
@ -61,5 +61,6 @@ public class ZlldgbLogManager:DomainService,IZlldgbLogManager
return ret;
}
}
}
Loading…
Cancel
Save