Browse Source

[fix]X12 实体定义完成

master
贾荣国Home 3 years ago
parent
commit
58fe2d9e33
  1. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs
  2. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060.cs
  3. 52
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/BSN.cs
  4. 39
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CLD.cs
  5. 31
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CTT.cs
  6. 52
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/DTM.cs
  7. 12
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/GE.cs
  8. 18
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/GS.cs
  9. 44
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL.cs
  10. 37
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_I.cs
  11. 66
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_S.cs
  12. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_T.cs
  13. 34
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GE.cs
  14. 98
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GS.cs
  15. 38
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/IEA.cs
  16. 183
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/ISA.cs
  17. 25
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs
  18. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISE.cs
  19. 34
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/LIN.cs
  20. 58
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/MEA.cs
  21. 55
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/N1.cs
  22. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/PRF.cs
  23. 44
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/REF.cs
  24. 29
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SE.cs
  25. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SN1.cs
  26. 28
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ST.cs
  27. 31
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD1.cs
  28. 32
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD3.cs
  29. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD5.cs
  30. 19
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Const.cs

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Validation;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi;

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060.cs

@ -24,5 +24,5 @@ public class ASN_X12_856_3060
/// Interchange Control Trailer
/// 报文尾
/// </summary>
public ISE ISE { get; set; }
public IEA Iea { get; set; }
}

52
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/BSN.cs

@ -1,4 +1,7 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Beginning Segment
@ -6,11 +9,56 @@
/// </summary>
public class BSN
{
public string BSN01 { get; set; }
/// <summary>
/// Transaction Set Purpose
/// "00" = Original
/// "01" = Cancellation
/// 段落目的
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string BSN01 { get; set; } = "00";
/// <summary>
/// Ship Notice Number
/// 发货通知单编号
/// </summary>
[StringLength(30, MinimumLength = 2)]
public string BSN02 { get; set; }
/// <summary>
/// Ship Notice Date
/// 发货日期
/// </summary>
[StringLength(6, MinimumLength = 6)]
public string BSN03 { get; set; }
/// <summary>
/// Ship Notice Time
/// 发货时间
/// </summary>
[StringLength(4, MinimumLength = 4)]
public string BSN04 { get; set; }
public string BSN05 { get; }
public string BSN06 { get; }
public string BSN07 { get; }
public BSN(string noticeNumber, DateTime datetime, string purpose = "00")
{
BSN01 = purpose;
BSN02 = noticeNumber;
BSN03 = datetime.ToString(X12Const.DateFormat);
BSN04 = datetime.ToString(X12Const.TimeFormat);
}
public override string ToString()
{
return "BSN"
+ X12Const.ElementSeparator + BSN01
+ X12Const.ElementSeparator + BSN02
+ X12Const.ElementSeparator + BSN03
+ X12Const.ElementSeparator + BSN04;
}
}

39
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CLD.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Load Detail
@ -6,9 +8,42 @@
/// </summary>
public class CLD
{
/// <summary>
/// Number Of Loads
/// 箱数
/// </summary>
[StringLength(5, MinimumLength = 1)]
public string CLD01 { get; set; }
/// <summary>
/// Number Of Units Shipped Total Quantity Per Container
/// 每箱零件数量
/// </summary>
[StringLength(10, MinimumLength = 1)]
public string CLD02 { get; set; }
public string CLD03 { get; set; }
/// <summary>
/// Packaging Code
/// 包装代码
/// </summary>
[StringLength(5, MinimumLength = 3)]
public string CLD03 { get; set; } = string.Empty;
public string CLD04 { get;}
public string CLD05 { get;}
public CLD(int loadQty,int unitQty)
{
CLD01 = loadQty.ToString();
CLD02 = unitQty.ToString();
}
public override string ToString()
{
return "CLD"
+ X12Const.ElementSeparator + CLD01
+ X12Const.ElementSeparator + CLD02;
}
}

31
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CTT.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Transaction Totals
@ -6,11 +8,38 @@
/// </summary>
public class CTT
{
/// <summary>
/// Number Of Line Items
/// 层级总数
/// </summary>
[StringLength(6,MinimumLength = 1)]
public string CTT01 { get; set; }
/// <summary>
/// Hash Totals
/// 零件总数
/// </summary>
[StringLength(10,MinimumLength = 1)]
public string CTT02 { get; set; }
public string CTT03 { get;}
public string CTT04 { get;}
public string CTT05 { get;}
public string CTT06 { get;}
public string CTT07 { get;}
public CTT(int hlCount,int itemCount)
{
CTT01 = hlCount.ToString();
CTT02 = itemCount.ToString();
}
public override string ToString()
{
return "CTT"
+ X12Const.ElementSeparator + CTT01
+ X12Const.ElementSeparator + CTT02 ;
}
}

52
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/DTM.cs

@ -1,4 +1,7 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Date And Time
@ -6,11 +9,52 @@
/// </summary>
public class DTM
{
public string DTM01 { get; set; }
/// <summary>
/// Date/Time Qualifier\
/// "011" - shipped date/time
/// "017" - estimated date and time of arrival
/// 日期限定符
/// </summary>
[StringLength(3, MinimumLength = 3)]
public string DTM01 { get; set; } = "011";
/// <summary>
/// 日期
/// </summary>
[StringLength(6, MinimumLength = 6)]
public string DTM02 { get; set; }
/// <summary>
/// 时间
/// </summary>
[StringLength(4, MinimumLength = 4)]
public string DTM03 { get; set; }
public string DTM04 { get;}
public string DTM05 { get; set; }
/// <summary>
/// 世纪
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string DTM05 { get; } = "20";
public string DTM04 { get; } = string.Empty;
public string DTM06 { get; }
public string DTM07 { get; }
public DTM(DateTime datetime, string type = "011")
{
DTM01 = type;
DTM02 = datetime.ToString(X12Const.DateFormat);
DTM03 = datetime.ToString(X12Const.TimeFormat);
}
public override string ToString()
{
return "DTM"
+ X12Const.ElementSeparator + DTM01
+ X12Const.ElementSeparator + DTM02
+ X12Const.ElementSeparator + DTM03
+ X12Const.ElementSeparator + DTM04
+ X12Const.ElementSeparator + DTM05;
}
}

12
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/GE.cs

@ -1,12 +0,0 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Function Group Trailer
/// 功能组尾
/// </summary>
public class GE
{
public string GE01 { get; set; }
public string GE02 { get; set; }
}

18
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/GS.cs

@ -1,18 +0,0 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Function Group Header
/// 功能组头
/// </summary>
public class GS
{
public string GS01 { get; set; }
public string GS02 { get; set; }
public string GS03 { get; set; }
public string GS04 { get; set; }
public string GS05 { get; set; }
public string GS06 { get; set; }
public string GS07 { get; set; }
public string GS08 { get; set; }
}

44
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL.cs

@ -1,4 +1,6 @@
using JetBrains.Annotations;
using System.ComponentModel.DataAnnotations;
using System.Text;
using JetBrains.Annotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
@ -8,15 +10,47 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
/// </summary>
public abstract class HL
{
public HL(LevelType hl03)
{
HL03 = hl03.ToString();
}
/// <summary>
/// Hierarchical Id Number
/// 层级编号
/// </summary>
[StringLength(12,MinimumLength = 1)]
public string HL01 { get; set; }
/// <summary>
/// Hierarchical Parent Id
/// 父级编号
/// </summary>
[StringLength(12,MinimumLength = 1)]
public string HL02 { get; set; }
/// <summary>
/// Hierarchical Level Code
/// "S" = Shipment
/// "T" = Tare
/// "I" = Item
/// 层级等级代码
/// </summary>
[StringLength(2,MinimumLength = 1)]
public string HL03 { get;}
public string HL04 { get;}
public HL(LevelType hl03,string code,string parentCode="")
{
HL01 = code;
HL02 = parentCode;
HL03 = hl03.ToString();
}
public override string ToString()
{
return "HL"
+ X12Const.ElementSeparator + HL01
+ X12Const.ElementSeparator + HL02
+ X12Const.ElementSeparator + HL03;
}
public enum LevelType
{
S,

37
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_I.cs

@ -4,13 +4,42 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_I:HL
{
public HL_I() : base(LevelType.I)
{
}
/// <summary>
/// LINE ITEM DETAIL
/// 零件号
/// </summary>
public LIN LIN { get; set; }
/// <summary>
/// ITEM DETAIL SHIPMENT
/// 数量,单位,已发累计数量
/// </summary>
public SN1 SN1 { get; set; }
/// <summary>
/// Purchase order
/// 采购订单
/// </summary>
public PRF PRF { get; set; }
/// <summary>
/// LOAD DETAIL
/// 箱数,每箱数量
/// </summary>
public CLD CLD { get; set; }
/// <summary>
/// REFERENCE IDENTIFICATION
/// 箱标签列表
/// </summary>
public List<REF> REF_LSs { get; set; }
/// <summary>
///
/// </summary>
/// <param name="code">层级代码</param>
/// <param name="parentCode">父级代码</param>
public HL_I(string code,string parentCode) : base(LevelType.I,code,parentCode)
{
}
}

66
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_S.cs

@ -4,19 +4,77 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_S:HL
{
public HL_S() : base(LevelType.S)
{
}
/// <summary>
/// Gross weight
/// 毛重
/// </summary>
public MEA MEA_G { get; set; }
/// <summary>
/// Net weight
/// 净重
/// </summary>
public MEA MEA_N { get; set; }
/// <summary>
/// CARRIER DETAILS (QUANTITY AND WEIGHT)
/// 载体细节(数量或重量)
/// </summary>
public TD1 TD1 { get; set; }
/// <summary>
/// CARRIER DETAILS (ROUTING SEQUENCE/TRANSIT TIME)
/// 载体细节(路由)
/// </summary>
public TD5 TD5 { get; set; }
/// <summary>
/// CARRIER DETAILS (EQUIPMENT)
/// 载体细节(设备)
/// </summary>
public TD3 TD3 { get; set; }
/// <summary>
/// bill of lading
/// 提货单号
/// </summary>
public REF REF_BM { get; set; }
/// <summary>
/// packing slip number
/// 装箱单号
/// </summary>
public REF REF_PK { get; set; }
/// <summary>
/// ship from
/// 发送者代码
/// </summary>
public N1 N1_SF { get; set; }
/// <summary>
/// ship to
/// 接收者代码
/// </summary>
public N1 N1_ST { get; set; }
/// <summary>
/// HIERARCHICAL LEVEL (TARE)
/// 托盘列表
/// </summary>
public List<HL_T> HL_Ts { get; set; }
/// <summary>
/// HIERARCHICAL LEVEL (ITEM)
/// 单箱列表
/// </summary>
public List<HL_I> HL_Is { get; set; }
/// <summary>
///
/// </summary>
/// <param name="code">层级代码</param>
public HL_S(string code) : base(LevelType.S,code)
{
}
}

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_T.cs

@ -4,10 +4,25 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_T:HL
{
public HL_T() : base(LevelType.T)
{
}
/// <summary>
/// label serial number
/// 器具标签号
/// </summary>
public REF REF_LS { get; set; }
/// <summary>
/// HIERARCHICAL LEVEL (ITEM)
/// 单箱列表
/// </summary>
public List<HL_I> HL_Is { get; set; }
/// <summary>
///
/// </summary>
/// <param name="code">层级代码</param>
/// <param name="parentCode">父级代码</param>
public HL_T(string code,string parentCode) : base(LevelType.T,code,parentCode)
{
}
}

34
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GE.cs

@ -0,0 +1,34 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Function Group Trailer
/// 功能组尾
/// </summary>
public class GE
{
/// <summary>
/// Number of Included Sets
/// 集合数量
/// </summary>
public string GE01 { get; set; } = "1";
/// <summary>
/// Group Control Number
/// 组编号
/// </summary>
public string GE02 { get; set; }
public GE(string code, int count = 1)
{
GE01 = count.ToString();
GE02 = code;
}
public override string ToString()
{
return "GE"
+ X12Const.ElementSeparator + GE01
+ X12Const.ElementSeparator + GE02;
}
}

98
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GS.cs

@ -0,0 +1,98 @@
using System;
using System.ComponentModel.DataAnnotations;
using Microsoft.VisualBasic;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Function Group Header
/// 功能组头
/// </summary>
public class GS
{
/// <summary>
/// Code Identifying Information Type
/// Corresponding functional group.
/// FA - Functional Acknowledgements
/// PS - Planning Schedule with Release Capability
/// SH - Ship Notice / Manifest
/// SS - Shipping Schedule
/// 组功能代码
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string GS01 { get; } = "SS";
/// <summary>
/// Sender ID Code
/// 发送者ID
/// </summary>
[StringLength(2, MinimumLength = 15)]
public string GS02 { get; set; }
/// <summary>
/// Receiver ID Code
/// 接收者ID
/// </summary>
[StringLength(2, MinimumLength = 15)]
public string GS03 { get; set; }
/// <summary>
/// Date
/// 日期
/// </summary>
[StringLength(6, MinimumLength = 6)]
public string GS04 { get; set; }
/// <summary>
/// Time
/// 时间
/// </summary>
[StringLength(4, MinimumLength = 4)]
public string GS05 { get; set; }
/// <summary>
/// Group Control Number
/// 组编号
/// </summary>
[StringLength(1, MinimumLength = 9)]
public string GS06 { get; set; }
/// <summary>
/// Transaction Type Code
/// X - ANSI X-12
/// 事务类型代码
/// </summary>
[StringLength(1, MinimumLength = 2)]
public string GS07 { get; } = "X";
/// <summary>
/// Version and Release
/// 版本号和发布号
/// 003060 – Version 3, Release 6
/// </summary>
[StringLength(1, MinimumLength = 12)]
public string GS08 { get; } = "003060";
public GS(string senderId, string receiverId, DateTime datetime, string code)
{
GS02 = senderId;
GS03 = receiverId;
GS04 = datetime.ToString(X12Const.DateFormat);
GS05 = datetime.ToString(X12Const.TimeFormat);
GS06 = code;
}
public override string ToString()
{
return "GS"
+ X12Const.ElementSeparator + GS01
+ X12Const.ElementSeparator + GS02
+ X12Const.ElementSeparator + GS03
+ X12Const.ElementSeparator + GS04
+ X12Const.ElementSeparator + GS05
+ X12Const.ElementSeparator + GS06
+ X12Const.ElementSeparator + GS07
+ X12Const.ElementSeparator + GS08;
}
}

38
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/IEA.cs

@ -0,0 +1,38 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Interchange Control Trailer
/// 报文尾
/// </summary>
public class IEA
{
/// <summary>
/// Number of Functional Groups in Transmission
/// 包含的功能组数量
/// </summary>
[StringLength(5, MinimumLength = 1)]
public string IEA01 { get; set; } = "1";
/// <summary>
/// Transmission Control Number
/// 报文编号
/// </summary>
[StringLength(9, MinimumLength = 9)]
public string IEA02 { get; set; }
public IEA(string code, int count = 1)
{
IEA01 = count.ToString();
IEA02 = code;
}
public override string ToString()
{
return "IEA"
+ X12Const.ElementSeparator + IEA01
+ X12Const.ElementSeparator + IEA02;
}
}

183
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/ISA.cs

@ -0,0 +1,183 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Reflection;
using static System.Net.Mime.MediaTypeNames;
using static AutoMapper.Internal.ExpressionFactory;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Interchange Control Header
/// 报文头
/// </summary>
public class ISA
{
/// <summary>
/// Authorization Information Qualifier
/// 授权限定符
/// 固定值
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string ISA01 { get; } = "00";
/// <summary>
/// Authorization Information
/// 授权信息
/// </summary>
[StringLength(10, MinimumLength = 10)]
public string ISA02 { get; set; } = " ";
/// <summary>
/// Security Information Qualifier
/// 安全限定符
/// 固定值
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string ISA03 { get; } = "00";
/// <summary>
/// Security Information
/// 安全信息
/// </summary>
[StringLength(10, MinimumLength = 10)]
public string ISA04 { get; set; } = " ";
/// <summary>
/// Interchange ID Qualifier
/// Sender ID Qualifier
/// 01 - Duns (Dun & Bradstreet)
/// ZZ - Mutually Defined
/// 发送者ID限定符
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string ISA05 { get; } = "01";
/// <summary>
/// Interchange Sender ID
/// 发送者ID
/// </summary>
[StringLength(15, MinimumLength = 15)]
public string ISA06 { get; set; }
/// <summary>
/// Interchange ID Qualifier.
/// Receiver ID Qualifier. Same Qualifiers as ISA05
/// 接收者ID限定符
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string ISA07 { get; } = "ZZ";
/// <summary>
/// Interchange Receiver ID
/// 接收者ID
/// </summary>
[StringLength(15, MinimumLength = 15)]
public string ISA08 { get; set; }
/// <summary>
/// Interchange Date
/// 交换日期
/// </summary>
[StringLength(6, MinimumLength = 6)]
public string ISA09 { get; set; }
/// <summary>
/// Interchange Time
/// 交换时间
/// </summary>
[StringLength(4, MinimumLength = 4)]
public string ISA10 { get; set; }
/// <summary>
/// Interchange Control Standards Identifier.
/// U - U. S. EDI Community of ASC X12, TDCC and UCS
/// 控制标准
/// </summary>
[StringLength(1, MinimumLength = 1)]
public string ISA11 { get; } = "U";
/// <summary>
/// Interchange Control Version Number
/// This version number covers the interchange control segments.
/// 00200 - Standard issued as ANSI X12.5 -1987
/// 00300 - Standard issued as ANSI X12.5 -1992
/// 00400 - Standard issued as ANSI X12.5 -1997
/// 控制版本号
/// </summary>
[StringLength(5, MinimumLength = 5)]
public string ISA12 { get; set; } = "00300";
/// <summary>
/// Interchange Control Number
/// 报文编号
/// </summary>
[StringLength(9, MinimumLength = 9)]
public string ISA13 { get; set; }
/// <summary>
/// Acknowledgement Requested
/// 0 - No acknowledgement requested.
/// 1 - Interchange acknowledgement requested
/// 是否需要回执
/// </summary>
[StringLength(1, MinimumLength = 1)]
public string ISA14 { get; set; } = "0";
/// <summary>
/// Usage Indicator
/// Code to indicate whether data enclosed by this interchange envelope is test or production.
/// T - Test
/// P – Production
/// 报文类型
/// </summary>
[StringLength(1, MinimumLength = 1)]
public string ISA15 { get; set; } = EnvType.P.ToString();
/// <summary>
/// Component Element Separator
/// 组件元素分隔符
/// </summary>
[StringLength(1, MinimumLength = 1)]
public string ISA16 { get; set; } = "|";
public ISA(string senderId, string receiverId, string date, DateTime datetime, EnvType type = EnvType.P,
string authorization = " ", string security = " ")
{
ISA06 = senderId;
ISA08 = receiverId;
ISA09 = date;
ISA10 = datetime.ToString(X12Const.DateFormat);
ISA13 = datetime.ToString(X12Const.TimeFormat);
ISA15 = type.ToString();
ISA02 = authorization;
ISA04 = security;
}
public override string ToString()
{
return "ISA"
+ X12Const.ElementSeparator + ISA01
+ X12Const.ElementSeparator + ISA02
+ X12Const.ElementSeparator + ISA03
+ X12Const.ElementSeparator + ISA04
+ X12Const.ElementSeparator + ISA05
+ X12Const.ElementSeparator + ISA06
+ X12Const.ElementSeparator + ISA07
+ X12Const.ElementSeparator + ISA08
+ X12Const.ElementSeparator + ISA09
+ X12Const.ElementSeparator + ISA10
+ X12Const.ElementSeparator + ISA11
+ X12Const.ElementSeparator + ISA12
+ X12Const.ElementSeparator + ISA13
+ X12Const.ElementSeparator + ISA14
+ X12Const.ElementSeparator + ISA15
+ X12Const.ElementSeparator + ISA16;
}
public enum EnvType
{
P,
T
}
}

25
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs

@ -1,25 +0,0 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Interchange Control Header
/// 报文头
/// </summary>
public class ISA
{
public string ISA01 { get; set; }
public string ISA02 { get; set; }
public string ISA03 { get; set; }
public string ISA04 { get; set; }
public string ISA05 { get; set; }
public string ISA06 { get; set; }
public string ISA07 { get; set; }
public string ISA08 { get; set; }
public string ISA09 { get; set; }
public string ISA10 { get; set; }
public string ISA11 { get; set; }
public string ISA12 { get; set; }
public string ISA13 { get; set; }
public string ISA14 { get; set; }
public string ISA15 { get; set; }
public string ISA16 { get; set; }
}

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISE.cs

@ -1,11 +0,0 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Interchange Control Trailer
/// 报文尾
/// </summary>
public class ISE
{
public string ISE01 { get; set; }
public string ISE02 { get; set; }
}

34
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/LIN.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Line Item Detail
@ -6,7 +8,33 @@
/// </summary>
public class LIN
{
public string LIN01 { get;}
public string LIN02 { get; set; }
public string LIN01 { get; } = string.Empty;
/// <summary>
/// Product/Service Id Qualifier
/// 零件号限定符
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string LIN02 { get; } = "BP";
/// <summary>
/// Product/Service Id
/// 零件号
/// </summary>
[StringLength(30, MinimumLength = 1)]
public string LIN03 { get; set; }
public LIN(string itemCode)
{
LIN03 = itemCode;
}
public override string ToString()
{
return "LIN"
+ X12Const.ElementSeparator + LIN01
+ X12Const.ElementSeparator + LIN02
+ X12Const.ElementSeparator + LIN03;
}
}

58
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/MEA.cs

@ -1,4 +1,7 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Measurements
@ -6,14 +9,39 @@
/// </summary>
public class MEA
{
public MEA(MeaType mea02)
{
MEA02 = mea02.ToString();
}
public string MEA01 { get; set; }
public string MEA02 { get; }
/// <summary>
/// Measurement Reference Id
/// "PD" = Physical dimensions
/// 计量参考编号
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string MEA01 { get; set; } = "PD";
/// <summary>
/// Measurement Qualifier
/// "G"= Gross weight
/// "N"= Net weight
/// 计量限定符
/// </summary>
[StringLength(3, MinimumLength = 1)]
public string MEA02 { get; private set; }
/// <summary>
/// Measurement Value
/// 计量值
/// </summary>
[StringLength(10, MinimumLength = 1)]
public string MEA03 { get; set; }
/// <summary>
/// Unit Of Measurement
/// 计量单位
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string MEA04 { get; set; }
public string MEA05 { get;}
public string MEA06 { get;}
public string MEA07 { get;}
@ -21,6 +49,22 @@ public class MEA
public string MEA09 { get;}
public string MEA10 { get;}
public MEA(MeaType type,string value,string uom)
{
MEA02 = type.ToString();
MEA03 = value;
MEA04 = uom;
}
public override string ToString()
{
return "MEA"
+ X12Const.ElementSeparator + MEA01
+ X12Const.ElementSeparator + MEA02
+ X12Const.ElementSeparator + MEA03
+ X12Const.ElementSeparator + MEA04;
}
public enum MeaType
{
G,

55
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/N1.cs

@ -1,4 +1,7 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Name
@ -6,17 +9,53 @@
/// </summary>
public class N1
{
public N1(NameType n101)
{
N101 = n101.ToString();
}
public string N101 { get; }
public string N102 { get;}
public string N103 { get; set; }
/// <summary>
/// Entity Identifier Code
/// "SF" = Ship from
/// "ST" = Ship to
/// 实体标识符代码
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string N101 { get; private set; }
public string N102 { get; } = string.Empty;
/// <summary>
/// Identification Code Qualifier
/// "92" = IACNA assigned code.
/// "1" = DUNS #.
/// 识别码限定符
/// </summary>
[StringLength(2, MinimumLength = 1)]
public string N103 { get;} = "92";
/// <summary>
/// Identification Code
/// 识别码代码
/// </summary>
[StringLength(20, MinimumLength = 5)]
public string N104 { get; set; }
public string N105 { get;}
public string N106 { get;}
public N1(NameType type,string code)
{
N101 = type.ToString();
N104 = code;
}
public override string ToString()
{
return "N1"
+ X12Const.ElementSeparator + N101
+ X12Const.ElementSeparator + N102
+ X12Const.ElementSeparator + N103
+ X12Const.ElementSeparator + N104;
}
public enum NameType
{
SF,

23
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/PRF.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Purchase Order
@ -6,11 +8,30 @@
/// </summary>
public class PRF
{
/// <summary>
/// purchase order number
/// 采购订单号
/// </summary>
[StringLength(22, MinimumLength = 1)]
public string PRF01 { get; set; }
public string PRF02 { get;}
public string PRF03 { get;}
public string PRF04 { get;}
public string PRF05 { get;}
public string PRF06 { get;}
public string PRF07 { get;}
public PRF(string poNumber)
{
PRF01 = poNumber;
}
public override string ToString()
{
return "PRF"
+ X12Const.ElementSeparator + PRF01;
}
}

44
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/REF.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Reference
@ -6,15 +8,43 @@
/// </summary>
public class REF
{
public REF(RefType ref01)
{
REF01 = ref01.ToString();
}
public string REF01 { get; }
public string REF02 { get; set; }
/// <summary>
/// Reference Identification Qualifier
/// 参考类型
/// </summary>
[StringLength(3, MinimumLength = 2)]
public string REF01 { get; private set; }
/// <summary>
/// Reference Identifier
/// 参考值
/// </summary>
[StringLength(30, MinimumLength = 1)]
public string REF02 { get; private set; } = string.Empty;
public string REF03 { get;}
public string REF04 { get;}
public REF(RefType type)
{
REF01 = type.ToString();
}
public REF(RefType type,string value):this(type)
{
REF02 = value;
}
public override string ToString()
{
return "REF"
+ X12Const.ElementSeparator + REF01
+ X12Const.ElementSeparator + REF02;
}
public enum RefType
{
BM,

29
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SE.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Transaction Set Trailer
@ -6,7 +8,30 @@
/// </summary>
public class SE
{
public string SE01 { get; set; }
/// <summary>
/// Number Of Included Segments
/// 段落数量
/// </summary>
[StringLength(9,MinimumLength = 1)]
public string SE01 { get; set; } = "1";
/// <summary>
/// Transaction Set Control Number
/// 事务编号
/// </summary>
[StringLength(9,MinimumLength = 4)]
public string SE02 { get; set; }
public SE(string transactionCode ,int segmentCount = 1)
{
SE01 = segmentCount.ToString();
SE02 = transactionCode;
}
public override string ToString()
{
return "SE"
+ X12Const.ElementSeparator + SE01
+ X12Const.ElementSeparator + SE02 ;
}
}

47
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SN1.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Item detail Shipment
@ -6,12 +8,53 @@
/// </summary>
public class SN1
{
public string SN101 { get;}
public string SN101 { get; } = string.Empty;
/// <summary>
/// Number Of Units Shipped
/// 发货数量
/// </summary>
[StringLength(10, MinimumLength = 1)]
public string SN102 { get; set; }
/// <summary>
/// Unit Of Measure Code
/// EA = Each
/// PK = Package
/// CA = Case
/// LO = Lot
/// PL = Pallet
/// 计量单位代码
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string SN103 { get; set; }
/// <summary>
/// Quantity Shipped To Date
/// 累计已发数量
/// </summary>
[StringLength(9, MinimumLength = 1)]
public string SN104 { get; set; }
public string SN105 { get;}
public string SN106 { get;}
public string SN107 { get;}
public string SN108 { get;}
public SN1(int qty,string uom,int totalQty)
{
SN102 = qty.ToString();
SN103 = uom;
SN104 = totalQty.ToString();
}
public override string ToString()
{
return "SN1"
+ X12Const.ElementSeparator + SN101
+ X12Const.ElementSeparator + SN102
+ X12Const.ElementSeparator + SN103;
}
}

28
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ST.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Transaction Set Header
@ -6,7 +8,29 @@
/// </summary>
public class ST
{
public string ST01 { get; set; }
/// <summary>
/// Transaction Set Id
/// 事务类型ID
/// </summary>
[StringLength(3, MinimumLength = 3)]
public string ST01 { get; } = "856";
/// <summary>
/// Transaction Set Control Number
/// 事务编号
/// </summary>
[StringLength(9, MinimumLength = 4)]
public string ST02 { get; set; }
public ST(string transactionCode)
{
ST02 = transactionCode;
}
public override string ToString()
{
return "ST"
+ X12Const.ElementSeparator + ST01
+ X12Const.ElementSeparator + ST02;
}
}

31
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD1.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Carrier Details (quantity & weight)
@ -6,8 +8,21 @@
/// </summary>
public class TD1
{
/// <summary>
/// Packaging Code
/// 包装代码
/// </summary>
[StringLength(5, MinimumLength = 3)]
public string TD101 { get; set; }
/// <summary>
/// Lading Quantity
/// 包装数量
/// </summary>
[StringLength(7, MinimumLength = 1)]
public string TD102 { get; set; }
public string TD103 { get;}
public string TD104 { get;}
public string TD105 { get;}
@ -16,4 +31,18 @@ public class TD1
public string TD108 { get;}
public string TD109 { get;}
public string TD110 { get;}
public TD1(string code,int qty)
{
TD101 = code;
TD102 = qty.ToString();
}
public override string ToString()
{
return "TD1"
+ X12Const.ElementSeparator + TD101
+ X12Const.ElementSeparator + TD102;
}
}

32
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD3.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Carrier Details (routing)
@ -6,13 +8,39 @@
/// </summary>
public class TD3
{
/// <summary>
/// Equipment Description Code
/// 设备描述代码
/// </summary>
[StringLength(2, MinimumLength = 2)]
public string TD301 { get; set; }
public string TD302 { get;}
public string TD302 { get; } = string.Empty;
/// <summary>
/// Equipment Number (Truck/Trailer Number)
/// 设备号(车牌号)
/// </summary>
[StringLength(6, MinimumLength = 2)]
public string TD303 { get; set; }
public string TD304 { get;}
public string TD305 { get;}
public string TD306 { get;}
public string TD307 { get;}
public string TD308 { get;}
public string TD309 { get;}
public TD3()
{
}
public override string ToString()
{
return "TD3"
+ X12Const.ElementSeparator + TD301
+ X12Const.ElementSeparator + TD302
+ X12Const.ElementSeparator + TD303;
}
}

47
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD5.cs

@ -1,4 +1,6 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Carrier Details (equipment)
@ -6,10 +8,35 @@
/// </summary>
public class TD5
{
/// <summary>
/// Routing Sequence Code
/// 路由序列号
/// </summary>
[StringLength(2, MinimumLength = 1)]
public string TD501 { get; set; }
public string TD502 { get; set; }
/// <summary>
/// Identification Code Qualifier
/// 识别码限定符
/// </summary>
[StringLength(2, MinimumLength = 1)]
public string TD502 { get; } = "02";
/// <summary>
/// Identification Code
/// 识别码(SCAC代码)
/// </summary>
[StringLength(4, MinimumLength = 2)]
public string TD503 { get; set; }
/// <summary>
/// Mode
/// 模式
/// </summary>
[StringLength(1, MinimumLength = 1)]
public string TD504 { get; set; }
public string TD505 { get;}
public string TD506 { get;}
public string TD507 { get;}
@ -20,4 +47,20 @@ public class TD5
public string TD512 { get;}
public string TD513 { get;}
public string TD514 { get;}
public TD5(string routeSequenceCode,string identificationCode,string mode)
{
TD501 = routeSequenceCode;
TD503 = identificationCode;
TD504 = mode;
}
public override string ToString()
{
return "TD5"
+ X12Const.ElementSeparator + TD501
+ X12Const.ElementSeparator + TD502
+ X12Const.ElementSeparator + TD503
+ X12Const.ElementSeparator + TD504;
}
}

19
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/X12Const.cs

@ -0,0 +1,19 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class X12Const
{
/// <summary>
/// 元素分隔符
/// </summary>
public const string ElementSeparator = "*";
/// <summary>
/// 日期格式
/// </summary>
public const string DateFormat = "yyMMdd";
/// <summary>
/// 时间格式
/// </summary>
public const string TimeFormat = "HHmm";
}
Loading…
Cancel
Save