Browse Source

[fix]初步完成EDI字符串的生成

master
贾荣国Home 3 years ago
parent
commit
7e518931ed
  1. 7
      WebApiService/Win_in.Sfs.Scp.WebApi.sln
  2. 1
      WebApiService/Win_in.Sfs.Scp.WebApi.sln.DotSettings
  3. 192
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/AsnFactory.cs
  4. 118
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs
  5. 13
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Win_in.Sfs.Scp.WebApi.Console.csproj
  6. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060.cs
  7. 13
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060Extensions.cs
  8. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/DTM.cs
  9. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/HL.cs
  10. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/REF.cs
  11. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroup.cs
  12. 25
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroupExtensions.cs
  13. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GE.cs
  14. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GS.cs
  15. 16
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionalGroupExtensions.cs
  16. 36
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_IExtentions.cs
  17. 68
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_SExtensions.cs
  18. 19
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_TExtensions.cs
  19. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/IEA.cs
  20. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ISA.cs
  21. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/CLD.cs
  22. 22
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/Item.cs
  23. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/ItemExtentions.cs
  24. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/LIN.cs
  25. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/PRF.cs
  26. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/SN1.cs
  27. 50
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotice.cs
  28. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNoticeExtensions.cs
  29. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/BSN.cs
  30. 16
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/CTT.cs
  31. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/FOB.cs
  32. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/SE.cs
  33. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ST.cs
  34. 88
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNotice.cs
  35. 39
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNoticeExtensions.cs
  36. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/MEA.cs
  37. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/N1.cs
  38. 31
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/Shipment.cs
  39. 85
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/ShipmentExtensions.cs
  40. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD1.cs
  41. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD3.cs
  42. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD5.cs
  43. 28
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/Tare.cs
  44. 29
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/TareExtensions.cs
  45. 42
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TransactionSet.cs
  46. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TransactionSetExtensions.cs
  47. 50
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs
  48. 50
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN_DETAIL.cs
  49. 31
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_PALLETS.cs
  50. 92
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs

7
WebApiService/Win_in.Sfs.Scp.WebApi.sln

@ -49,6 +49,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scp", "scp", "{925EA68F-25D
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "webApi", "webApi", "{A79A01B2-9532-4C6B-880F-193251F3B9F3}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "webApi", "webApi", "{A79A01B2-9532-4C6B-880F-193251F3B9F3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_in.Sfs.Scp.WebApi.Console", "src\Win_in.Sfs.Scp.WebApi.Console\Win_in.Sfs.Scp.WebApi.Console.csproj", "{FAC4C418-08A2-48C5-A966-A832FB091C78}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -127,6 +129,10 @@ Global
{98CDED94-F046-4010-88F4-700B7481169E}.Debug|Any CPU.Build.0 = Debug|Any CPU {98CDED94-F046-4010-88F4-700B7481169E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.ActiveCfg = Release|Any CPU {98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.Build.0 = Release|Any CPU {98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC4C418-08A2-48C5-A966-A832FB091C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC4C418-08A2-48C5-A966-A832FB091C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC4C418-08A2-48C5-A966-A832FB091C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC4C418-08A2-48C5-A966-A832FB091C78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -152,6 +158,7 @@ Global
{98CDED94-F046-4010-88F4-700B7481169E} = {44A92E7C-E2FC-4F37-AF3D-6B7213EF54FE} {98CDED94-F046-4010-88F4-700B7481169E} = {44A92E7C-E2FC-4F37-AF3D-6B7213EF54FE}
{925EA68F-25D1-444F-A79B-EB9BF754EC3C} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {925EA68F-25D1-444F-A79B-EB9BF754EC3C} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{A79A01B2-9532-4C6B-880F-193251F3B9F3} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {A79A01B2-9532-4C6B-880F-193251F3B9F3} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{FAC4C418-08A2-48C5-A966-A832FB091C78} = {A79A01B2-9532-4C6B-880F-193251F3B9F3}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

1
WebApiService/Win_in.Sfs.Scp.WebApi.sln.DotSettings

@ -20,4 +20,5 @@
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String> <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String> <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Barcodes/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary> </wpf:ResourceDictionary>

192
WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/AsnFactory.cs

@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Win_in.Sfs.Scp.v1.Domain.Asns;
using Win_in.Sfs.Scp.WebApi.Asns;
namespace Win_in.Sfs.Scp.WebApi.Console
{
public class AsnFactory
{
public ASN_X12_856_3060 CreateAsnX128563060(TB_ASN scpAsn,List<TS_BARCODE> barcodes)
{
var asnCode = scpAsn.AsnBillNum;
var senderId = scpAsn.VendId;
var receiverId = "receiver";
var shipTime = scpAsn.ShipTime ?? DateTime.Now;
var envType = ISA.EnvType.P;
var authorization = " ";
var security = " ";
//初始化ASN单
var asn = InitAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security);
var functionalGroupCode = "0000000000";
//初始化功能组
var functionalGroup = InitFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode);
var shipNoticeCode = "0001";
var datetimeType = "011";
//初始化发货单
var shipNotice = InitShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType);
var gValue = 0;
var gUom = "KG";
var nValue = 0;
var nUom = "KG";
var routeSequenceCode = "B";
var identificationCode = "PSTV";
var mode = "LT";
var equipmentCode = "TL";
var equipmentNumber = "123456";//车牌号
//初始化发货明细
var shipment = InitShipment(gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode,
equipmentCode,equipmentNumber,functionalGroupCode,functionalGroupCode,senderId,receiverId);
//计算与添加托盘和尾箱
var palletCodes = barcodes.Select(p => p.Extend2).Distinct().ToList();
foreach (var palletCode in palletCodes)
{
var palletBarcodes = barcodes.Where(p => p.Extend2==palletCode).ToList();
var items = new List<Item>();
var group = palletBarcodes
.GroupBy(p => new { p.PartCode, p.Qty, p.Batch, p.PoUnit, p.PoBillNum,p.PackQty})
.Select(p => new
{
p.Key.PartCode,
p.Key.Qty,
p.Key.Batch,
p.Key.PoUnit,
p.Key.PoBillNum,
p.Key.PackQty,
Labels = p.Select(p=>p.BarCode).ToList()
})
.ToList();
foreach (var b in group)
{
var accumQty = 0;//TODO 如何计算
var loadQty = b.Labels.Count;
var unitQty = b.PackQty;
var item = CreateItem(b.PartCode, loadQty * unitQty, b.PoUnit, accumQty, b.PoBillNum, loadQty, unitQty,b.Labels);
items.Add(item);
}
//如果托标签为空,当作尾箱处理
if (string.IsNullOrEmpty(palletCode))
{
foreach (var item in items)
{
shipment.AddOrphanItem(shipNotice,item);
}
}
//添加托盘
else
{
var tare = CreateTare(palletCode);
shipment.AddTare(shipNotice,tare);
foreach (var item in items)
{
tare.AddItem(shipNotice, item);
}
}
}
//TODO 如何获取包装代码,或者规则是什么?
var packagingCode = "PLT90";
//装载量需要在添加托盘和尾箱后再计算
var loadingQty = shipment.Tares.Count+shipment.OrphanItems.Count;
shipment.SetTD1(packagingCode, loadingQty);
//添加发货明细
shipNotice.AddShipment(shipment);
//设置发货单汇总
shipNotice.SetCTT();
//添加发货单
functionalGroup.AddShipNotice(shipNotice);
functionalGroup.SetGE(functionalGroupCode);
//添加功能组
asn.AddFunctionGroup(functionalGroup);
return asn;
}
private ASN_X12_856_3060 InitAsn(string asnCode, string senderId, string receiverId, DateTime datetime,
ISA.EnvType envType = ISA.EnvType.P, string authorization = " ", string security = " ")
{
var asn = new ASN_X12_856_3060();
asn.SetISA(asnCode, senderId, receiverId, datetime, envType, authorization, security)
.SetIEA(asnCode);
return asn;
}
private FunctionalGroup InitFunctionalGroup(string senderId, string receiverId, DateTime datetime,
string functionalGroupCode)
{
var functionGroup = new FunctionalGroup();
functionGroup
.SetGS(senderId, receiverId, datetime, functionalGroupCode);
return functionGroup;
}
private ShipNotice InitShipNotice(string shipNoticeCode, string noticeNumber, DateTime datetime,
string datetimeType="011", string purpose = "00")
{
var shipNotice = new ShipNotice();
shipNotice
.SetST(shipNoticeCode)
.SetBSN(noticeNumber, datetime, purpose)
.SetDTM(datetime, datetimeType)
.SetSE(shipNoticeCode);
return shipNotice;
}
private Shipment InitShipment(decimal gValue, string gUom, decimal nValue, string nUom,
string routeSequenceCode, string identificationCode, string mode, string equipmentCode,
string equipmentNumber, string bmRefValue, string pkRefValue, string senderId, string receiverId)
{
var shipment = new Shipment();
shipment
.SetHL()
.SetMEA_G(gValue, gUom)
.SetMEA_N(nValue, nUom)
.SetTD5(routeSequenceCode, identificationCode, mode)
.SetTD3(equipmentCode, equipmentNumber)
.SetREF_BM(bmRefValue)
.SetREF_PK(pkRefValue)
.SetN1_SF(senderId)
.SetN1_ST(receiverId)
;
return shipment;
}
private Tare CreateTare(string tareLabelCode)
{
var tare = new Tare();
tare.SetHL()
.SetREF_LS(tareLabelCode);
return tare;
}
private Item CreateItem(string itemCode, decimal qty, string uom, int accumQty,
string poNumber, int loadQty, decimal unitQty, List<string> itemLabelCodes)
{
var item = new Item();
item.SetHL()
.SetLIN(itemCode)
.SetSN1(qty, uom, accumQty)
.SetPRF(poNumber)
.SetCLD(loadQty, unitQty)
.SetREF_LSs(itemLabelCodes);
return item;
}
}
}

118
WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Program.cs

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using Win_in.Sfs.Scp.v1.Domain.Asns;
namespace Win_in.Sfs.Scp.WebApi.Console
{
internal class Program
{
static void Main(string[] args)
{
var asnFactory = new AsnFactory();
var scpAsn = InitTbAsn();
var barcodes = InitTsBarcodes();
var asn = asnFactory.CreateAsnX128563060(scpAsn, barcodes);
var ediString = asn.ToString();
System.Console.WriteLine(ediString);
System.Console.Read();
}
private static List<TS_BARCODE> InitTsBarcodes()
{
var barcodes = new List<TS_BARCODE>()
{
new TS_BARCODE()
{
BarCode = "A01",
PartCode = "AAAAA",
Qty=20,
Batch="20220404",
PoUnit = "EA",
PoBillNum = "PO1111",
PackQty = 20,
Extend2 = "PALLET01"
},
new TS_BARCODE()
{
BarCode = "A02",
PartCode = "AAAAA",
Qty=20,
Batch="20220404",
PoUnit = "EA",
PoBillNum = "PO1111",
PackQty = 20,
Extend2 = "PALLET01"
},
new TS_BARCODE()
{
BarCode = "B01",
PartCode = "BBBBB",
Qty=15,
Batch="20220404",
PoUnit = "EA",
PoBillNum = "PO2222",
PackQty = 15,
Extend2 = "PALLET01"
},
new TS_BARCODE()
{
BarCode = "B02",
PartCode = "BBBBB",
Qty=15,
Batch="20220404",
PoUnit = "EA",
PoBillNum = "PO2222",
PackQty = 15,
Extend2 = "PALLET01"
},
new TS_BARCODE()
{
BarCode = "C01",
PartCode = "CCCCC",
Qty=40,
Batch="20220404",
PoUnit = "KG",
PoBillNum = "PO3333",
PackQty = 40,
Extend2 = "PALLET02"
},
new TS_BARCODE()
{
BarCode = "C02",
PartCode = "CCCCC",
Qty=40,
Batch="20220404",
PoUnit = "KG",
PoBillNum = "PO3333",
PackQty = 40,
Extend2 = "PALLET02"
},
new TS_BARCODE()
{
BarCode = "C03",
PartCode = "CCCCC",
Qty=40,
Batch="20220404",
PoUnit = "KG",
PoBillNum = "PO3333",
PackQty = 23,
Extend2 = ""
},
};
return barcodes;
}
private static TB_ASN InitTbAsn()
{
var scpAsn = new TB_ASN()
{
AsnBillNum = "ASNBILLNUM",
VendId = "VENDID",
ShipTime = DateTime.Now,
};
return scpAsn;
}
}
}

13
WebApiService/src/Win_in.Sfs.Scp.WebApi.Console/Win_in.Sfs.Scp.WebApi.Console.csproj

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" />
</ItemGroup>
</Project>

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

@ -19,7 +19,7 @@ public class ASN_X12_856_3060
/// Functional Group /// Functional Group
/// 功能组列表 /// 功能组列表
/// </summary> /// </summary>
public List<FunctionalGroup> FunctionalGroups { get; set; } public List<FunctionalGroup> FunctionalGroups { get; set; } = new List<FunctionalGroup>();
/// <summary> /// <summary>
/// Interchange Control Trailer /// Interchange Control Trailer
@ -54,6 +54,6 @@ public class ASN_X12_856_3060
sb.AppendLine(functionalGroup.ToString()); sb.AppendLine(functionalGroup.ToString());
} }
sb.AppendLine(IEA.ToString()); sb.AppendLine(IEA.ToString());
return sb.ToString(); return sb.ToString().Trim();
} }
} }

13
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ASN_X12_856_3060Extensions.cs

@ -4,14 +4,23 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class ASN_X12_856_3060Extensions public static class ASN_X12_856_3060Extensions
{ {
public static void SetISA(this ASN_X12_856_3060 asn,string asnCode,string senderId, string receiverId, DateTime datetime, ISA.EnvType envType = ISA.EnvType.P, public static ASN_X12_856_3060 SetISA(this ASN_X12_856_3060 asn,string asnCode,string senderId, string receiverId, DateTime datetime, ISA.EnvType envType = ISA.EnvType.P,
string authorization = " ", string security = " ") string authorization = " ", string security = " ")
{ {
asn.ISA = new ISA(asnCode,senderId,receiverId,datetime,envType,authorization,security); asn.ISA = new ISA(asnCode,senderId,receiverId,datetime,envType,authorization,security);
return asn;
} }
public static void SetIEA(this ASN_X12_856_3060 asn,string asnCode) public static ASN_X12_856_3060 SetIEA(this ASN_X12_856_3060 asn,string asnCode)
{ {
asn.IEA = new IEA(asnCode, asn.FunctionalGroups.Count); asn.IEA = new IEA(asnCode, asn.FunctionalGroups.Count);
return asn;
} }
public static ASN_X12_856_3060 AddFunctionGroup(this ASN_X12_856_3060 asn, FunctionalGroup functionalGroup)
{
asn.FunctionalGroups.Add(functionalGroup);
return asn;
}
} }

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/DTM.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/DTM.cs

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/HL.cs

@ -8,7 +8,7 @@ namespace Win_in.Sfs.Scp.WebApi.Asns;
/// Hierarchical Level /// Hierarchical Level
/// 层级结构 /// 层级结构
/// </summary> /// </summary>
public abstract class HL public class HL
{ {
/// <summary> /// <summary>
/// Hierarchical Id Number /// Hierarchical Id Number
@ -35,7 +35,7 @@ public abstract class HL
public string HL03 { get;} public string HL03 { get;}
public string HL04 { get;} public string HL04 { get;}
public HL(LevelType hl03,string code,string parentCode="") public HL(LevelType hl03,string code="",string parentCode="")
{ {
HL01 = code; HL01 = code;
HL02 = parentCode; HL02 = parentCode;

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/REF.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Commons/REF.cs

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionalGroup.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/FunctionalGroup.cs

@ -19,7 +19,7 @@ public class FunctionalGroup
/// Transaction Set /// Transaction Set
/// 事务集合列表 /// 事务集合列表
/// </summary> /// </summary>
public List<TransactionSet> TransactionSets { get; set; } public List<ShipNotice> ShipNotices { get; set; } = new List<ShipNotice>();
/// <summary> /// <summary>
/// Function Group Trailer /// Function Group Trailer
@ -31,11 +31,11 @@ public class FunctionalGroup
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.AppendLine(GS.ToString()); sb.AppendLine(GS.ToString());
foreach (var transactionSet in TransactionSets) foreach (var shipNotice in ShipNotices)
{ {
sb.AppendLine(transactionSet.ToString()); sb.AppendLine(shipNotice.ToString());
} }
sb.AppendLine(GE.ToString()); sb.AppendLine(GE.ToString());
return sb.ToString(); return sb.ToString().Trim();
} }
} }

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

@ -0,0 +1,25 @@
using System;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class FunctionalGroupExtensions
{
public static FunctionalGroup SetGS(this FunctionalGroup functionalGroup,string senderId, string receiverId, DateTime datetime, string functionalGroupCode)
{
functionalGroup.GS = new GS(senderId, receiverId, datetime, functionalGroupCode);
return functionalGroup;
}
public static FunctionalGroup SetGE(this FunctionalGroup functionalGroup,string functionalGroupCode)
{
functionalGroup.GE = new GE(functionalGroupCode, functionalGroup.ShipNotices.Count);
return functionalGroup;
}
public static FunctionalGroup AddShipNotice(this FunctionalGroup functionalGroup, ShipNotice shipNotice)
{
functionalGroup.ShipNotices.Add(shipNotice);
return functionalGroup;
}
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GE.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GE.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HeadAndTrailers/GS.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionGroups/GS.cs

16
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FunctionalGroupExtensions.cs

@ -1,16 +0,0 @@
using System;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class FunctionalGroupExtensions
{
public static void SetGS(this FunctionalGroup functionalGroup,string senderId, string receiverId, DateTime datetime, string functionalGroupCode)
{
functionalGroup.GS = new GS(senderId, receiverId, datetime, functionalGroupCode);
}
public static void SetGE(this FunctionalGroup functionalGroup,string functionalGroupCode)
{
functionalGroup.GE = new GE(functionalGroupCode, functionalGroup.TransactionSets.Count);
}
}

36
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_IExtentions.cs

@ -1,36 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class HL_IExtentions
{
public static void SetLIN(this HL_I hli, string itemCode)
{
hli.LIN = new LIN(itemCode);
}
public static void SetSN1(this HL_I hli, int qty, string uom, int accumQty)
{
hli.SN1 = new SN1(qty, uom, accumQty);
}
public static void SetPRF(this HL_I hli, string poNumber)
{
hli.PRF = new PRF(poNumber);
}
public static void SetPRF(this HL_I hli, int loadQty, int unitQty)
{
hli.CLD = new CLD(loadQty, unitQty);
}
public static void SetREF_LSs(this HL_I hli, List<string> itemLabelCodes)
{
hli.REF_LSs = new List<REF>();
foreach (var refLs in itemLabelCodes.Select(labelCode => new REF(REF.RefType.LS, labelCode)))
{
hli.REF_LSs.Add(refLs);
}
}
}

68
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_SExtensions.cs

@ -1,68 +0,0 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.SignalR;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class HL_SExtensions
{
public static void SetMEA_G(this HL_S hls,decimal meaValue,string uom)
{
hls.MEA_G = new MEA(MEA.MeaType.G, meaValue, uom);
}
public static void SetMEA_N(this HL_S hls,decimal meaValue,string uom)
{
hls.MEA_N = new MEA(MEA.MeaType.N, meaValue, uom);
}
public static void SetTD1(this HL_S hls,string packagingCode,int loadingQty)
{
hls.TD1 = new TD1(packagingCode, loadingQty);
}
public static void SetTD5(this HL_S hls,string routeSequenceCode,string identificationCode,string mode)
{
hls.TD5 = new TD5(routeSequenceCode, identificationCode, mode);
}
public static void SetTD3(this HL_S hls,string equipmentCode,string equipmentNumber)
{
hls.TD3 = new TD3(equipmentCode,equipmentNumber);
}
public static void SetREF_BM(this HL_S hls,string refValue)
{
hls.REF_BM = new REF(REF.RefType.BM, refValue);
}
public static void SetREF_PK(this HL_S hls,string refValue)
{
hls.REF_PK = new REF(REF.RefType.PK, refValue);
}
public static void SetN1_SF(this HL_S hls, string fromCode)
{
hls.N1_SF = new N1(N1.NameType.SF, fromCode);
}
public static void SetN1_ST(this HL_S hls, string toCode)
{
hls.N1_ST = new N1(N1.NameType.ST, toCode);
}
public static void CreateHL_T(this HL_S hls,ShipNotice shipNotice)
{
var hlCode = shipNotice.AddHL();
var hlt = new HL_T(hlCode.ToString(), hls.HL01);
hls.HL_Ts.Add(hlt);
}
public static void CreateHL_I(this HL_S hls, ShipNotice shipNotice,int itemCount)
{
var hlCode = shipNotice.AddHL(itemCount);
var hli = new HL_I(hlCode.ToString(), hls.HL01);
hls.HL_Is.Add(hli);
}
}

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

@ -1,19 +0,0 @@
using System.Collections.Generic;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class HL_TExtensions
{
public static void SetREF_LS(this HL_T hlt, string tareLabelCode)
{
hlt.REF_LS = new REF(REF.RefType.LS, tareLabelCode);
}
public static void CreateHL_I(this HL_T hlt, ShipNotice shipNotice,int itemCount)
{
var hlCode = shipNotice.AddHL(itemCount);
var hli = new HL_I(hlCode.ToString(), hlt.HL01);
hlt.HL_Is.Add(hli);
}
}

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

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

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CLD.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/CLD.cs

@ -34,7 +34,7 @@ public class CLD
public string CLD05 { get;} public string CLD05 { get;}
public CLD(int loadQty,int unitQty) public CLD(int loadQty,decimal unitQty)
{ {
CLD01 = loadQty.ToString(); CLD01 = loadQty.ToString();
CLD02 = unitQty.ToString(); CLD02 = unitQty.ToString();

22
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_I.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/Item.cs

@ -3,8 +3,15 @@ using System.Text;
namespace Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_I:HL public class Item
{ {
/// <summary>
/// Hierarchical Level
/// 层级结构
/// </summary>
public HL HL { get; set; }
/// <summary> /// <summary>
/// LINE ITEM DETAIL /// LINE ITEM DETAIL
/// 零件号 /// 零件号
@ -35,19 +42,10 @@ public class HL_I:HL
/// </summary> /// </summary>
public List<REF> REF_LSs { get; set; } 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)
{
}
public override string ToString() public override string ToString()
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.AppendLine(base.ToString()); sb.AppendLine(HL.ToString());
sb.AppendLine(LIN.ToString()); sb.AppendLine(LIN.ToString());
sb.AppendLine(SN1.ToString()); sb.AppendLine(SN1.ToString());
sb.AppendLine(PRF.ToString()); sb.AppendLine(PRF.ToString());
@ -56,6 +54,6 @@ public class HL_I:HL
{ {
sb.AppendLine(refLS.ToString()); sb.AppendLine(refLS.ToString());
} }
return sb.ToString(); return sb.ToString().Trim();
} }
} }

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

@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.Linq;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class ItemExtentions
{
public static Item SetHL(this Item item)
{
item.HL = new HL(HL.LevelType.I);
return item;
}
public static Item SetLIN(this Item item, string itemCode)
{
item.LIN = new LIN(itemCode);
return item;
}
public static Item SetSN1(this Item item, decimal qty, string uom, int accumQty)
{
item.SN1 = new SN1(qty, uom, accumQty);
return item;
}
public static Item SetPRF(this Item item, string poNumber)
{
item.PRF = new PRF(poNumber);
return item;
}
public static Item SetCLD(this Item item, int loadQty, decimal unitQty)
{
item.CLD = new CLD(loadQty, unitQty);
return item;
}
public static Item SetREF_LSs(this Item item, List<string> itemLabelCodes)
{
item.REF_LSs = new List<REF>();
foreach (var refLs in itemLabelCodes.Select(labelCode => new REF(REF.RefType.LS, labelCode)))
{
item.REF_LSs.Add(refLs);
}
return item;
}
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/LIN.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/LIN.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/PRF.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/PRF.cs

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SN1.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Items/SN1.cs

@ -16,7 +16,7 @@ public class SN1
/// 发货数量 /// 发货数量
/// </summary> /// </summary>
[StringLength(10, MinimumLength = 1)] [StringLength(10, MinimumLength = 1)]
public string SN102 { get; set; } public string SN102 => Qty.ToString();
/// <summary> /// <summary>
@ -43,9 +43,11 @@ public class SN1
public string SN107 { get;} public string SN107 { get;}
public string SN108 { get;} public string SN108 { get;}
public SN1(int qty,string uom,int accumQty) public decimal Qty { get; set; }
public SN1(decimal qty,string uom,int accumQty)
{ {
SN102 = qty.ToString(); Qty = qty;
SN103 = uom; SN103 = uom;
SN104 = accumQty.ToString(); SN104 = accumQty.ToString();
} }

50
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotice.cs

@ -1,50 +0,0 @@
using System.Text;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Ship Notice
/// 发货单
/// </summary>
public class ShipNotice
{
/// <summary>
/// Beginning Segment
/// 事务头
/// </summary>
public BSN BSN { get; set; }
/// <summary>
/// Shipped Date And Time
/// 发货日期时间
/// </summary>
public DTM DTM { get; set; }
/// <summary>
/// Hierarchical Level of Shipment
/// 发货单层级
/// </summary>
public HL_S HL_S { get; set; }
/// <summary>
/// Transaction Totals
/// 事务汇总
/// </summary>
public CTT CTT { get; }
public int AddHL(int itemCount = 0)
{
return CTT.AddHL(itemCount);
}
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine(BSN.ToString());
sb.AppendLine(DTM.ToString());
sb.AppendLine(HL_S.ToString());
sb.AppendLine(CTT.ToString());
return sb.ToString();
}
}

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

@ -1,23 +0,0 @@
using System;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class ShipNoticeExtensions
{
public static void SetBSN(this ShipNotice shipNotice,string noticeNumber, DateTime datetime, string purpose = "00")
{
shipNotice.BSN = new BSN(noticeNumber, datetime, purpose);
}
public static void SetDTM(this ShipNotice shipNotice, DateTime dateTime,string datetimeType)
{
shipNotice.DTM = new DTM(dateTime, datetimeType);
}
public static void CreateHL_S(this ShipNotice shipNotice)
{
var hlCode = shipNotice.AddHL();
shipNotice.HL_S = new HL_S(hlCode.ToString());
}
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/BSN.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/BSN.cs

16
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/CTT.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/CTT.cs

@ -13,14 +13,14 @@ public class CTT
/// 层级总数 /// 层级总数
/// </summary> /// </summary>
[StringLength(6, MinimumLength = 1)] [StringLength(6, MinimumLength = 1)]
public string CTT01 => hlCount.ToString(); public string CTT01 => _hlCount.ToString();
/// <summary> /// <summary>
/// Hash Totals /// Hash Totals
/// 零件总数 /// 零件总数
/// </summary> /// </summary>
[StringLength(10, MinimumLength = 1)] [StringLength(10, MinimumLength = 1)]
public string CTT02 => hashTotal.ToString(); public string CTT02 => _hashTotal.ToString();
public string CTT03 { get;} public string CTT03 { get;}
public string CTT04 { get;} public string CTT04 { get;}
@ -28,15 +28,13 @@ public class CTT
public string CTT06 { get;} public string CTT06 { get;}
public string CTT07 { get;} public string CTT07 { get;}
private int hlCount = 0; private int _hlCount = 0;
private int hashTotal = 0; private decimal _hashTotal = 0;
public CTT(int hlCount,decimal hashTotal)
public int AddHL(int itemCount=0)
{ {
hlCount++; _hlCount = hlCount;
hashTotal += itemCount; _hashTotal = hashTotal;
return hlCount;
} }
public override string ToString() public override string ToString()

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/FOB.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/FOB.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/SE.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/SE.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ST.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ST.cs

88
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/ShipNotices/ShipNotice.cs

@ -0,0 +1,88 @@
using System.Text;
using Microsoft.AspNetCore.SignalR;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Ship Notice
/// 发货单
/// </summary>
public class ShipNotice
{
/// <summary>
/// Transaction Set Header
/// 事务集合头
/// </summary>
public ST ST { get; set; }
/// <summary>
/// Beginning Segment
/// 事务头
/// </summary>
public BSN BSN { get; set; }
/// <summary>
/// Shipped Date And Time
/// 发货日期时间
/// </summary>
public DTM DTM { get; set; }
/// <summary>
/// Hierarchical Level of Shipment
/// 发货单层级
/// </summary>
public Shipment Shipment { get; set; }
/// <summary>
/// Transaction Totals
/// 事务汇总
/// </summary>
public CTT CTT { get; set; }
/// <summary>
/// Transaction Set Trailer
/// 事务集合尾
/// </summary>
public SE SE { get; set; }
/// <summary>
/// Count of Included Segments
/// </summary>
public int SegmentCount { get;private set; }
/// <summary>
/// Count of Included Line Items
/// </summary>
public int HlCount { get; private set; } = 1;
/// <summary>
/// Hash Totals
/// </summary>
public decimal HashTotal { get; private set; }
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine(ST.ToString());
sb.AppendLine(BSN.ToString());
sb.AppendLine(DTM.ToString());
sb.AppendLine(Shipment.ToString());
sb.AppendLine(CTT.ToString());
sb.AppendLine(SE.ToString());
return sb.ToString().Trim();
}
public string GetNextHl(decimal itemCount=0)
{
HlCount++;
HashTotal += itemCount;
return HlCount.ToString();
}
public void AddSegment()
{
SegmentCount++;
}
}

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

@ -0,0 +1,39 @@
using System;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class ShipNoticeExtensions
{
public static ShipNotice SetST(this ShipNotice shipNotice,string shipNoticeCode)
{
shipNotice.ST = new ST(shipNoticeCode);
return shipNotice;
}
public static ShipNotice SetBSN(this ShipNotice shipNotice,string noticeNumber, DateTime datetime, string purpose = "00")
{
shipNotice.BSN = new BSN(noticeNumber, datetime, purpose);
return shipNotice; }
public static ShipNotice SetDTM(this ShipNotice shipNotice, DateTime dateTime,string datetimeType="011")
{
shipNotice.DTM = new DTM(dateTime, datetimeType);
return shipNotice;}
public static ShipNotice AddShipment(this ShipNotice shipNotice,Shipment shipment)
{
shipNotice.Shipment = shipment;
return shipNotice;}
public static ShipNotice SetCTT(this ShipNotice shipNotice)
{
shipNotice.CTT = new CTT(shipNotice.HlCount,shipNotice.HashTotal);
return shipNotice;
}
public static ShipNotice SetSE(this ShipNotice shipNotice, string shipNoticeCode)
{
shipNotice.SE = new SE(shipNoticeCode,shipNotice.SegmentCount);
return shipNotice; }
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/MEA.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/MEA.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/N1.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/N1.cs

31
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_S.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/Shipment.cs

@ -3,8 +3,17 @@ using System.Text;
namespace Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_S:HL /// <summary>
/// 发货明细
/// </summary>
public class Shipment
{ {
/// <summary>
/// Hierarchical Level
/// 层级结构
/// </summary>
public HL HL { get; set; }
/// <summary> /// <summary>
/// Gross weight /// Gross weight
/// 毛重 /// 毛重
@ -63,26 +72,26 @@ public class HL_S:HL
/// HIERARCHICAL LEVEL (TARE) /// HIERARCHICAL LEVEL (TARE)
/// 托盘列表 /// 托盘列表
/// </summary> /// </summary>
public List<HL_T> HL_Ts { get; set; } = new List<HL_T>(); public List<Tare> Tares { get; set; } = new List<Tare>();
/// <summary> /// <summary>
/// HIERARCHICAL LEVEL (ITEM) /// HIERARCHICAL LEVEL (ITEM)
/// 单箱列表 /// 单箱列表
/// </summary> /// </summary>
public List<HL_I> HL_Is { get; set; } = new List<HL_I>(); public List<Item> OrphanItems { get; set; } = new List<Item>();
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="code">层级代码</param> public Shipment()
public HL_S(string code) : base(LevelType.S,code)
{ {
HL = new HL(HL.LevelType.S);
} }
public override string ToString() public override string ToString()
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.AppendLine(base.ToString()); sb.AppendLine(HL.ToString());
sb.AppendLine(MEA_G.ToString()); sb.AppendLine(MEA_G.ToString());
sb.AppendLine(MEA_N.ToString()); sb.AppendLine(MEA_N.ToString());
sb.AppendLine(TD1.ToString()); sb.AppendLine(TD1.ToString());
@ -92,14 +101,14 @@ public class HL_S:HL
sb.AppendLine(REF_PK.ToString()); sb.AppendLine(REF_PK.ToString());
sb.AppendLine(N1_SF.ToString()); sb.AppendLine(N1_SF.ToString());
sb.AppendLine(N1_ST.ToString()); sb.AppendLine(N1_ST.ToString());
foreach (var hlt in HL_Ts) foreach (var tare in Tares)
{ {
sb.AppendLine(hlt.ToString()); sb.AppendLine(tare.ToString());
} }
foreach (var hli in HL_Is) foreach (var item in OrphanItems)
{ {
sb.AppendLine(hli.ToString()); sb.AppendLine(item.ToString());
} }
return sb.ToString(); return sb.ToString().Trim();
} }
} }

85
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/ShipmentExtensions.cs

@ -0,0 +1,85 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.SignalR;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class ShipmentExtensions
{
public static Shipment SetHL(this Shipment shipment)
{
shipment.HL = new HL(HL.LevelType.S,"1","");
return shipment;
}
public static Shipment SetMEA_G(this Shipment shipment,decimal meaValue,string uom)
{
shipment.MEA_G = new MEA(MEA.MeaType.G, meaValue, uom);
return shipment;
}
public static Shipment SetMEA_N(this Shipment shipment,decimal meaValue,string uom)
{
shipment.MEA_N = new MEA(MEA.MeaType.N, meaValue, uom);
return shipment;
}
public static Shipment SetTD1(this Shipment shipment,string packagingCode,int loadingQty)
{
shipment.TD1 = new TD1(packagingCode, loadingQty);
return shipment;
}
public static Shipment SetTD5(this Shipment shipment,string routeSequenceCode,string identificationCode,string mode)
{
shipment.TD5 = new TD5(routeSequenceCode, identificationCode, mode);
return shipment;
}
public static Shipment SetTD3(this Shipment shipment,string equipmentCode,string equipmentNumber)
{
shipment.TD3 = new TD3(equipmentCode,equipmentNumber);
return shipment;
}
public static Shipment SetREF_BM(this Shipment shipment,string refValue)
{
shipment.REF_BM = new REF(REF.RefType.BM, refValue);
return shipment;
}
public static Shipment SetREF_PK(this Shipment shipment,string refValue)
{
shipment.REF_PK = new REF(REF.RefType.PK, refValue);
return shipment;
}
public static Shipment SetN1_SF(this Shipment shipment, string senderId)
{
shipment.N1_SF = new N1(N1.NameType.SF, senderId);
return shipment;
}
public static Shipment SetN1_ST(this Shipment shipment, string receiverId)
{
shipment.N1_ST = new N1(N1.NameType.ST, receiverId);
return shipment;
}
public static Shipment AddTare(this Shipment shipment,ShipNotice shipNotice, Tare tare)
{
tare.HL.HL01 = shipNotice.GetNextHl();
tare.HL.HL02 = shipment.HL.HL01;
shipment.Tares.Add(tare);
return shipment;
}
public static Shipment AddOrphanItem(this Shipment shipment,ShipNotice shipNotice,Item orphanItem)
{
orphanItem.HL.HL01 = shipNotice.GetNextHl(orphanItem.SN1.Qty);
orphanItem.HL.HL02 = shipment.HL.HL01;
shipment.OrphanItems.Add(orphanItem);
return shipment;
}
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD1.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD1.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD3.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD3.cs

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TD5.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Shipments/TD5.cs

28
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/HL_T.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/Tares/Tare.cs

@ -3,9 +3,16 @@ using System.Text;
namespace Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi.Asns;
public class HL_T:HL public class Tare
{ {
/// <summary>
/// Hierarchical Level
/// 层级结构
/// </summary>
public HL HL { get; set; }
/// <summary> /// <summary>
/// label serial number /// label serial number
/// 器具标签号 /// 器具标签号
@ -16,26 +23,17 @@ public class HL_T:HL
/// HIERARCHICAL LEVEL (ITEM) /// HIERARCHICAL LEVEL (ITEM)
/// 单箱列表 /// 单箱列表
/// </summary> /// </summary>
public List<HL_I> HL_Is { get; set; } public List<Item> Items { get; set; } = new List<Item>();
/// <summary>
///
/// </summary>
/// <param name="code">层级代码</param>
/// <param name="parentCode">父级代码</param>
public HL_T(string code,string parentCode) : base(LevelType.T,code,parentCode)
{
}
public override string ToString() public override string ToString()
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.AppendLine(base.ToString()); sb.AppendLine(HL.ToString());
sb.AppendLine(REF_LS.ToString()); sb.AppendLine(REF_LS.ToString());
foreach (var hli in HL_Is) foreach (var item in Items)
{ {
sb.AppendLine(hli.ToString()); sb.AppendLine(item.ToString());
} }
return sb.ToString(); return sb.ToString().Trim();
} }
} }

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

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class TareExtensions
{
public static Tare SetHL(this Tare tare)
{
tare.HL = new HL(HL.LevelType.T);
return tare;
}
public static Tare SetREF_LS(this Tare tare, string tareLabelCode)
{
tare.REF_LS = new REF(REF.RefType.LS, tareLabelCode);
return tare;
}
public static Tare AddItem(this Tare tare, ShipNotice shipNotice, Item item)
{
item.HL.HL01 = shipNotice.GetNextHl(item.SN1.Qty);
item.HL.HL02 = tare.HL.HL01;
tare.Items.Add(item);
return tare;
}
}

42
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TransactionSet.cs

@ -1,42 +0,0 @@
using System.Collections.Generic;
using System.Text;
namespace Win_in.Sfs.Scp.WebApi.Asns;
/// <summary>
/// Transaction Set
/// 事务集合
/// </summary>
public class TransactionSet
{
/// <summary>
/// Transaction Set Header
/// 事务集合头
/// </summary>
public ST ST { get; set; }
/// <summary>
/// Ship Notice
/// 发货单列表
/// </summary>
public List<ShipNotice> ShipNotices { get; set; }
/// <summary>
/// Transaction Set Trailer
/// 事务集合尾
/// </summary>
public SE SE { get; set; }
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine(ST.ToString());
foreach (var shipNotice in ShipNotices)
{
sb.AppendLine(shipNotice.ToString());
}
sb.AppendLine(SE.ToString());
return sb.ToString();
}
}

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Asns/TransactionSetExtensions.cs

@ -1,14 +0,0 @@
namespace Win_in.Sfs.Scp.WebApi.Asns;
public static class TransactionSetExtensions
{
public static void SetST(this TransactionSet transactionSet,string transactionCode)
{
transactionSet.ST = new ST(transactionCode);
}
public static void SetSE(this TransactionSet transactionSet, string transactionCode)
{
transactionSet.SE = new SE(transactionCode, transactionSet.ShipNotices.Count);
}
}

50
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN.cs

@ -0,0 +1,50 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System;
namespace Win_in.Sfs.Scp.v1.Domain.Asns
{
public class TB_ASN
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[StringLength(50)]
[Key]
public string AsnBillNum { get; set; }//发货单号
[StringLength(50)]
public string AskBillNum { get; set; }//要货看板号
[StringLength(50)]
public string PoBillNum { get; set; }//订单编号
[StringLength(50)]
public string VendId { get; set; }//供应商编号
[StringLength(50)]
public string Site { get; set; }//地点
public int State { get; set; }//状态(3为已发货状态)
[StringLength(50)]
public string Remark { get; set; }
public DateTime? ShipTime { get; set; }//发货时间
[StringLength(50)]
public string ShipUser { get; set; }//发货人
public DateTime? ReceiveTime { get; set; }//承诺到货日期
[StringLength(50)]
public string ReceiveUser { get; set; }
public decimal? Price { get; set; }
[StringLength(50)]
public string Currency { get; set; }
[StringLength(50)]
public string PlateNumber { get; set; }
[StringLength(50)]
public string ReceivedPort { get; set; }//时间窗口,有为空的信息
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
public string SubSite { get; set; }
}
}

50
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_ASN_DETAIL.cs

@ -0,0 +1,50 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win_in.Sfs.Scp.v1.Domain.Asns
{
public partial class TB_ASN_DETAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
[StringLength(50)]
public string AsnBillNum { get; set; }//发货单号
public decimal Price { get; set; }
[StringLength(50)]
public string PoBillNum { get; set; }//订单号
public int PoLine { get; set; }//订单行号,无订单号自动取0
[StringLength(50)]
public string PartCode { get; set; }//零件号
[StringLength(50)]
public string Batch { get; set; }//批次
public DateTime? ProduceDate { get; set; }//生产日期
[StringLength(50)]
public string VendBatch { get; set; }//供应商批次
public decimal Qty { get; set; }//发货数
[StringLength(50)]
public string PoUnit { get; set; }//零件单位
[StringLength(50)]
public string LocUnit { get; set; }//零件单位
public decimal PackQty { get; set; }//标包数
public decimal UnConv { get; set; }
[StringLength(50)]
public string DockCode { get; set; }
public int? State { get; set; } //状态(3为已发货状态)
[StringLength(50)]
public string Remark { get; set; }
[StringLength(50)]
public string Currency { get; set; }
public DateTime? EndTime { get; set; }
[StringLength(50)]
public string ReceivedPort { get; set; }
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
public string SubSite { get; set; }
public string Site { get; set; }
}
}

31
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TB_PALLETS.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win_in.Sfs.Scp.v1.Domain.Asns
{
public partial class TB_PALLETS
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
[StringLength(50)]
public string AsnBillNum { get; set; }//发货单号
public string PalletNum { get; set; }//发货时间(只有年月日的字符串串)
public string BarCode { get; set; }//P+零件号+;+Q+数量
public string FullBarCode { get; set; }//箱码
public string PartCode { get; set; }//零件号(多零件号用;分割)
public string Batch { get; set; }//每种零件多少箱用;分割
public string VendId { get; set; }//供应商编号
public int Box { get; set; }//总箱数
public decimal Qty { get; set; }
//--新添加
public string VendBatch { get; set; }//供应商中文名
public string PoBillNum { get; set; }//托盘序号
public int PoBillLine { get; set; }
[Column(TypeName = "datetime2")]
public DateTime ProduceDate { get; set; }//发货时间
}
}

92
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Asns/TS_BARCODE.cs

@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win_in.Sfs.Scp.v1.Domain.Asns
{
public partial class TS_BARCODE
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[StringLength(50)]
public string BarCode { get; set; }//箱码(条码的部分信息)
[Required]
[StringLength(500)]
public string FullBarCode { get; set; }//箱码(条码的全部信息)
[Required]
[StringLength(50)]
public string PartCode { get; set; }//零件号
[StringLength(50)]
public string VendPartCode { get; set; }//供应商零件号(存在NULL)
[Required]
[StringLength(50)]
public string Batch { get; set; }//批次
[Column(TypeName = "datetime2")]
public DateTime ProduceDate { get; set; }//生产日期
public int ManageType { get; set; }
[Required]
[StringLength(50)]
public string SerialNum { get; set; }//六位流水号,以单个asn单号计数
[Column(TypeName = "money")]
public decimal Qty { get; set; }//条码零件数量
public int BarCodeType { get; set; }
[Required]
[StringLength(50)]
public string BillNum { get; set; }//发货单号
public int PoBillLine { get; set; }//订单行号(无订单号取0)
[StringLength(50)]
public string VendId { get; set; }//供应商编号
[StringLength(50)]
public string VendBatch { get; set; }//供应商批次
[Column(TypeName = "money")]
public decimal PackQty { get; set; }//标包数
[Required]
[StringLength(50)]
public string CreateOper { get; set; }//条码创建者中文名
public DateTime CreateTime { get; set; }//(创建时间)
public int State { get; set; }
[StringLength(500)]
public string Remark { get; set; }
public string PoUnit { get; set; }//零件单位
public string LocUnit { get; set; }
public string Site { get; set; }//地点
public string Qlevel { get; set; }
public string QMark { get; set; }
public string ProjectId { get; set; }//项目号
public string PoBillNum { get; set; }//订单号
public string Extend1 { get; set; }//零件名称
public string Extend2 { get; set; }//包装序号
public string Extend3 { get; set; }
[DisplayName("是否扫描")]
public bool IsScanned { get; set; }
}
}
Loading…
Cancel
Save