|
|
@ -13,23 +13,23 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
|
|
|
|
|
var asnCode = scpAsn.AsnBillNum; |
|
|
|
var senderId = scpAsn.VendId; |
|
|
|
var receiverId = "receiver"; |
|
|
|
var receiverId = "IACNA_ID"; |
|
|
|
var shipTime = scpAsn.ShipTime ?? DateTime.Now; |
|
|
|
|
|
|
|
var envType = ISA.EnvType.P; |
|
|
|
var authorization = " "; |
|
|
|
var security = " "; |
|
|
|
var authorization = ""; |
|
|
|
var security = ""; |
|
|
|
//初始化ASN单
|
|
|
|
var asn = InitAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security); |
|
|
|
var asn = CreateAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security); |
|
|
|
|
|
|
|
var functionalGroupCode = "0000000000"; |
|
|
|
var functionalGroupCode = "123456789"; |
|
|
|
//初始化功能组
|
|
|
|
var functionalGroup = InitFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode); |
|
|
|
var functionalGroup = CreateFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode); |
|
|
|
|
|
|
|
var shipNoticeCode = "0001"; |
|
|
|
var datetimeType = "011"; |
|
|
|
//初始化发货单
|
|
|
|
var shipNotice = InitShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); |
|
|
|
var shipNotice = CreateShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); |
|
|
|
|
|
|
|
var gValue = 0; |
|
|
|
var gUom = "KG"; |
|
|
@ -39,9 +39,9 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
|
var identificationCode = "PSTV"; |
|
|
|
var mode = "LT"; |
|
|
|
var equipmentCode = "TL"; |
|
|
|
var equipmentNumber = "123456";//车牌号
|
|
|
|
var equipmentNumber = "123456";//TODO 车牌号
|
|
|
|
//初始化发货明细
|
|
|
|
var shipment = InitShipment(gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode, |
|
|
|
var shipment = CreateShipment(shipNotice,gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode, |
|
|
|
equipmentCode,equipmentNumber,functionalGroupCode,functionalGroupCode,senderId,receiverId); |
|
|
|
|
|
|
|
|
|
|
@ -101,50 +101,51 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
|
//装载量需要在添加托盘和尾箱后再计算
|
|
|
|
var loadingQty = shipment.Tares.Count+shipment.OrphanItems.Count; |
|
|
|
shipment.SetTD1(packagingCode, loadingQty); |
|
|
|
//添加发货明细
|
|
|
|
shipNotice.AddShipment(shipment); |
|
|
|
//设置发货单汇总
|
|
|
|
shipNotice.SetCTT(); |
|
|
|
|
|
|
|
shipNotice |
|
|
|
.AddShipment(shipment) //添加发货明细
|
|
|
|
.SetCTT() //设置发货单汇总
|
|
|
|
.SetSE(shipNoticeCode); //设置发货明细结尾
|
|
|
|
//添加发货单
|
|
|
|
functionalGroup.AddShipNotice(shipNotice); |
|
|
|
functionalGroup.SetGE(functionalGroupCode); |
|
|
|
functionalGroup |
|
|
|
.AddShipNotice(shipNotice) |
|
|
|
.SetGE(functionalGroupCode); |
|
|
|
//添加功能组
|
|
|
|
asn.AddFunctionGroup(functionalGroup); |
|
|
|
|
|
|
|
asn |
|
|
|
.AddFunctionGroup(functionalGroup) |
|
|
|
.SetIEA(asnCode); |
|
|
|
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 = " ") |
|
|
|
private ASN_X12_856_3060 CreateAsn(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); |
|
|
|
asn.SetISA(asnCode, senderId, receiverId, datetime, envType, authorization, security); |
|
|
|
return asn; |
|
|
|
} |
|
|
|
|
|
|
|
private FunctionalGroup InitFunctionalGroup(string senderId, string receiverId, DateTime datetime, |
|
|
|
private FunctionalGroup CreateFunctionalGroup(string senderId, string receiverId, DateTime datetime, |
|
|
|
string functionalGroupCode) |
|
|
|
{ |
|
|
|
var functionGroup = new FunctionalGroup(); |
|
|
|
functionGroup |
|
|
|
.SetGS(senderId, receiverId, datetime, functionalGroupCode); |
|
|
|
functionGroup.SetGS(senderId, receiverId, datetime, functionalGroupCode); |
|
|
|
return functionGroup; |
|
|
|
} |
|
|
|
|
|
|
|
private ShipNotice InitShipNotice(string shipNoticeCode, string noticeNumber, DateTime datetime, |
|
|
|
private ShipNotice CreateShipNotice(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); |
|
|
|
.SetDTM(datetime, datetimeType); |
|
|
|
shipNotice.AddSegment(4); |
|
|
|
return shipNotice; |
|
|
|
} |
|
|
|
|
|
|
|
private Shipment InitShipment(decimal gValue, string gUom, decimal nValue, string nUom, |
|
|
|
private Shipment CreateShipment(ShipNotice shipNotice, 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) |
|
|
|
{ |
|
|
@ -160,6 +161,7 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
|
.SetN1_SF(senderId) |
|
|
|
.SetN1_ST(receiverId) |
|
|
|
; |
|
|
|
shipNotice.AddSegment(10); |
|
|
|
|
|
|
|
return shipment; |
|
|
|
} |
|
|
|