|
@ -13,23 +13,23 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
|
|
|
|
|
|
var asnCode = scpAsn.AsnBillNum; |
|
|
var asnCode = scpAsn.AsnBillNum; |
|
|
var senderId = scpAsn.VendId; |
|
|
var senderId = scpAsn.VendId; |
|
|
var receiverId = "receiver"; |
|
|
var receiverId = "IACNA_ID"; |
|
|
var shipTime = scpAsn.ShipTime ?? DateTime.Now; |
|
|
var shipTime = scpAsn.ShipTime ?? DateTime.Now; |
|
|
|
|
|
|
|
|
var envType = ISA.EnvType.P; |
|
|
var envType = ISA.EnvType.P; |
|
|
var authorization = " "; |
|
|
var authorization = ""; |
|
|
var security = " "; |
|
|
var security = ""; |
|
|
//初始化ASN单
|
|
|
//初始化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 shipNoticeCode = "0001"; |
|
|
var datetimeType = "011"; |
|
|
var datetimeType = "011"; |
|
|
//初始化发货单
|
|
|
//初始化发货单
|
|
|
var shipNotice = InitShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); |
|
|
var shipNotice = CreateShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); |
|
|
|
|
|
|
|
|
var gValue = 0; |
|
|
var gValue = 0; |
|
|
var gUom = "KG"; |
|
|
var gUom = "KG"; |
|
@ -39,9 +39,9 @@ namespace Win_in.Sfs.Scp.WebApi.Console |
|
|
var identificationCode = "PSTV"; |
|
|
var identificationCode = "PSTV"; |
|
|
var mode = "LT"; |
|
|
var mode = "LT"; |
|
|
var equipmentCode = "TL"; |
|
|
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); |
|
|
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; |
|
|
var loadingQty = shipment.Tares.Count+shipment.OrphanItems.Count; |
|
|
shipment.SetTD1(packagingCode, loadingQty); |
|
|
shipment.SetTD1(packagingCode, loadingQty); |
|
|
//添加发货明细
|
|
|
|
|
|
shipNotice.AddShipment(shipment); |
|
|
shipNotice |
|
|
//设置发货单汇总
|
|
|
.AddShipment(shipment) //添加发货明细
|
|
|
shipNotice.SetCTT(); |
|
|
.SetCTT() //设置发货单汇总
|
|
|
|
|
|
.SetSE(shipNoticeCode); //设置发货明细结尾
|
|
|
//添加发货单
|
|
|
//添加发货单
|
|
|
functionalGroup.AddShipNotice(shipNotice); |
|
|
functionalGroup |
|
|
functionalGroup.SetGE(functionalGroupCode); |
|
|
.AddShipNotice(shipNotice) |
|
|
|
|
|
.SetGE(functionalGroupCode); |
|
|
//添加功能组
|
|
|
//添加功能组
|
|
|
asn.AddFunctionGroup(functionalGroup); |
|
|
asn |
|
|
|
|
|
.AddFunctionGroup(functionalGroup) |
|
|
|
|
|
.SetIEA(asnCode); |
|
|
return asn; |
|
|
return asn; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private ASN_X12_856_3060 InitAsn(string asnCode, string senderId, string receiverId, DateTime datetime, |
|
|
private ASN_X12_856_3060 CreateAsn(string asnCode, string senderId, string receiverId, DateTime datetime, |
|
|
ISA.EnvType envType = ISA.EnvType.P, string authorization = " ", string security = " ") |
|
|
ISA.EnvType envType = ISA.EnvType.P, string authorization = "", string security = "") |
|
|
{ |
|
|
{ |
|
|
var asn = new ASN_X12_856_3060(); |
|
|
var asn = new ASN_X12_856_3060(); |
|
|
asn.SetISA(asnCode, senderId, receiverId, datetime, envType, authorization, security) |
|
|
asn.SetISA(asnCode, senderId, receiverId, datetime, envType, authorization, security); |
|
|
.SetIEA(asnCode); |
|
|
|
|
|
return asn; |
|
|
return asn; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private FunctionalGroup InitFunctionalGroup(string senderId, string receiverId, DateTime datetime, |
|
|
private FunctionalGroup CreateFunctionalGroup(string senderId, string receiverId, DateTime datetime, |
|
|
string functionalGroupCode) |
|
|
string functionalGroupCode) |
|
|
{ |
|
|
{ |
|
|
var functionGroup = new FunctionalGroup(); |
|
|
var functionGroup = new FunctionalGroup(); |
|
|
functionGroup |
|
|
functionGroup.SetGS(senderId, receiverId, datetime, functionalGroupCode); |
|
|
.SetGS(senderId, receiverId, datetime, functionalGroupCode); |
|
|
|
|
|
return functionGroup; |
|
|
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") |
|
|
string datetimeType="011", string purpose = "00") |
|
|
{ |
|
|
{ |
|
|
var shipNotice = new ShipNotice(); |
|
|
var shipNotice = new ShipNotice(); |
|
|
shipNotice |
|
|
shipNotice |
|
|
.SetST(shipNoticeCode) |
|
|
.SetST(shipNoticeCode) |
|
|
.SetBSN(noticeNumber, datetime, purpose) |
|
|
.SetBSN(noticeNumber, datetime, purpose) |
|
|
.SetDTM(datetime, datetimeType) |
|
|
.SetDTM(datetime, datetimeType); |
|
|
.SetSE(shipNoticeCode); |
|
|
shipNotice.AddSegment(4); |
|
|
return shipNotice; |
|
|
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 routeSequenceCode, string identificationCode, string mode, string equipmentCode, |
|
|
string equipmentNumber, string bmRefValue, string pkRefValue, string senderId, string receiverId) |
|
|
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_SF(senderId) |
|
|
.SetN1_ST(receiverId) |
|
|
.SetN1_ST(receiverId) |
|
|
; |
|
|
; |
|
|
|
|
|
shipNotice.AddSegment(10); |
|
|
|
|
|
|
|
|
return shipment; |
|
|
return shipment; |
|
|
} |
|
|
} |
|
|