Browse Source

[fix]AsnFactory 抽离Magic string

master
贾荣国 3 years ago
parent
commit
f2348c3ec9
  1. 36
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs

36
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/AsnBackgroundWorker/AsnFactory.cs

@ -8,9 +8,19 @@ namespace Win_in.Sfs.Scp.WebApi
{ {
public class AsnFactory public class AsnFactory
{ {
private const string IdentificationCode = "PSTV"; //TODO private const string Authorization = ""; //用户名
private const string TruckNumber = "000000"; //TODO 车牌号 private const string Security = ""; //密码
private const string PackagingCode = "PLT90"; //TODO 包装代码
private const string IdentificationCode = "PSTV"; //识别码(SCAC代码)
private const string PackagingCode = "PLT90"; //包装代码
private const string ShipNoticeCode = "0001"; //事务编号
private const string DatetimeType = "011"; //日期类型
private const string Uom = "KG"; //计量单位
private const string RouteSequenceCode = "B"; //路由序列号
private const string Mode = "LT"; //模式
private const string EquipmentCode = "TL"; //设备代码
private const string TruckNumber = "000000"; //车牌号
public ASN_X12_856_3060 CreateAsnX128563060(string receiver,TB_ASN scpAsn,List<TS_BARCODE> barcodes) public ASN_X12_856_3060 CreateAsnX128563060(string receiver,TB_ASN scpAsn,List<TS_BARCODE> barcodes)
{ {
@ -21,8 +31,8 @@ namespace Win_in.Sfs.Scp.WebApi
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 = Authorization;
var security = ""; var security = Security;
//初始化ASN单 //初始化ASN单
var asn = CreateAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security); var asn = CreateAsn(asnCode,senderId,receiverId,shipTime,envType,authorization,security);
@ -30,19 +40,19 @@ namespace Win_in.Sfs.Scp.WebApi
//初始化功能组 //初始化功能组
var functionalGroup = CreateFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode); var functionalGroup = CreateFunctionalGroup(senderId,receiverId,shipTime,functionalGroupCode);
var shipNoticeCode = "0001"; var shipNoticeCode = ShipNoticeCode;
var datetimeType = "011"; var datetimeType = DatetimeType;
//初始化发货单 //初始化发货单
var shipNotice = CreateShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType); var shipNotice = CreateShipNotice(shipNoticeCode,functionalGroupCode,shipTime,datetimeType);
var gValue = 0; var gValue = 0;
var gUom = "KG"; var gUom = Uom;
var nValue = 0; var nValue = 0;
var nUom = "KG"; var nUom = Uom;
var routeSequenceCode = "B"; var routeSequenceCode = RouteSequenceCode;
var identificationCode = IdentificationCode; var identificationCode = IdentificationCode;
var mode = "LT"; var mode = Mode;
var equipmentCode = "TL"; var equipmentCode = EquipmentCode;
var equipmentNumber = TruckNumber; var equipmentNumber = TruckNumber;
//初始化发货明细 //初始化发货明细
var shipment = CreateShipment(shipNotice,gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode, var shipment = CreateShipment(shipNotice,gValue,gUom,nValue,nUom,routeSequenceCode,identificationCode,mode,
@ -138,7 +148,7 @@ namespace Win_in.Sfs.Scp.WebApi
} }
private ShipNotice CreateShipNotice(string shipNoticeCode, string noticeNumber, DateTime datetime, private ShipNotice CreateShipNotice(string shipNoticeCode, string noticeNumber, DateTime datetime,
string datetimeType="011", string purpose = "00") string datetimeType, string purpose = "00")
{ {
var shipNotice = new ShipNotice(); var shipNotice = new ShipNotice();
shipNotice shipNotice

Loading…
Cancel
Save