diff --git a/ds-wms-service/DS.Module.Core/Enums/EDIRouteEnum.cs b/ds-wms-service/DS.Module.Core/Enums/EDIRouteEnum.cs index 645989fb..dfe23ab2 100644 --- a/ds-wms-service/DS.Module.Core/Enums/EDIRouteEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/EDIRouteEnum.cs @@ -53,7 +53,7 @@ namespace DS.Module.Core /// INTTRA, /// - /// INTTRA + /// VOLTA /// VOLTA } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs index c17ba4fc..84300bbb 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs @@ -19,13 +19,18 @@ namespace DS.WMS.Core.Invoice.Dtos /// /// 发票号 /// - public string InvoiceNO { get; set; } + public string? InvoiceNO { get; set; } /// /// 发票业务编号 /// public string BillNO { get; set; } + /// + /// 流水号 + /// + public string? SN { get; set; } + /// /// 开票时间 /// @@ -102,15 +107,25 @@ namespace DS.WMS.Core.Invoice.Dtos /// public string? OperatorName { get; set; } + /// + /// 发票类型 + /// + public InvoiceType? Type { get; set; } + + /// + /// 发票类型文本 + /// + public string? TypeText => Type?.GetDescription(); + /// /// 开票方式 /// - public InvoiceMode Type { get; set; } + public InvoiceMode Mode { get; set; } /// /// 开票方式文本 /// - public string TypeText => Type.GetDescription(); + public string ModeText => Mode.GetDescription(); /// /// 是否已打印 @@ -182,12 +197,12 @@ namespace DS.WMS.Core.Invoice.Dtos /// /// 发票类别 /// - public InvoiceCategory Category { get; set; } + public string? Category { get; set; } /// - /// 发票类别文本 + /// 发票类别代码 /// - public string CategoryText => Category.GetDescription(); + public string? CategoryCode { get; set; } /// /// 开票金额(开票明细的合计) diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs b/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs index e8c70c6a..7bd93c2c 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs @@ -16,8 +16,8 @@ namespace DS.WMS.Core.Invoice.Entity /// /// 发票号 /// - [SugarColumn(ColumnDescription = "发票号", Length = 200, IsNullable = false), Required] - public string InvoiceNO { get; set; } = string.Empty; + [SugarColumn(ColumnDescription = "发票号", Length = 200, IsNullable = true)] + public string? InvoiceNO { get; set; } /// /// 发票业务编号 @@ -25,6 +25,12 @@ namespace DS.WMS.Core.Invoice.Entity [SugarColumn(ColumnDescription = "发票业务编号", Length = 20, IsNullable = false)] public string BillNO { get; set; } + /// + /// 流水号 + /// + [SugarColumn(ColumnDescription = "流水号", Length = 256, IsNullable = true)] + public string? SN { get; set; } + /// /// 开票时间 /// @@ -113,7 +119,7 @@ namespace DS.WMS.Core.Invoice.Entity /// 发票类型 /// [SugarColumn(ColumnDescription = "发票类型")] - public InvoiceType Type { get; set; } + public InvoiceType? Type { get; set; } /// /// 是否已打印 @@ -181,11 +187,17 @@ namespace DS.WMS.Core.Invoice.Entity [SugarColumn(ColumnDescription = "代开客户", Length = 200, IsNullable = true)] public string? AutualCustomerName { get; set; } + /// + /// 发票类别代码 + /// + [SugarColumn(ColumnDescription = "发票类别代码", Length = 10, IsNullable = true)] + public string? CategoryCode { get; set; } + /// /// 发票类别 /// - [SugarColumn(ColumnDescription = "发票类别")] - public InvoiceCategory Category { get; set; } + [SugarColumn(ColumnDescription = "发票类别", Length = 50, IsNullable = true)] + public string? Category { get; set; } /// /// 开票金额(开票明细的合计) diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs index 9a9097a9..c52fab4c 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs @@ -54,7 +54,7 @@ namespace DS.WMS.Core.Invoice.Method { order = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new InvoiceInfo { - invoiceType = ((int)x.Type).ToString(), + invoiceType = x.Type == null ? "1" : ((int)x.Type).ToString(), orderNo = x.BillNO, email = x.Email, buyerTaxNum = x.TaxID, @@ -67,6 +67,7 @@ namespace DS.WMS.Core.Invoice.Method skyhzh = x.Account, checker = x.Checker, payee = x.Payee, + invoiceLine = x.CategoryCode, //---------金额项--------- hjse = x.InvoiceAmount * x.TaxRate, hjje = x.InvoiceAmount - x.InvoiceAmount * x.TaxRate, diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs index 1e52c72d..92e2e886 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs @@ -42,37 +42,6 @@ namespace DS.WMS.Core.Invoice.Method var query = TenantDb.Queryable() .Select((i) => new InvoiceDto { - Id = i.Id, - InvoiceNO = i.InvoiceNO, - BillNO = i.BillNO, - InvoiceDate = i.InvoiceDate, - CustomerId = i.CustomerId, - CustomerName = i.CustomerName, - Type = i.Mode, - Category = i.Category, - InvoiceHeader = i.InvoiceHeader, - TaxID = i.TaxID, - CustomerAddress = i.CustomerAddress, - CustomerBankName = i.CustomerBankName, - CustomerPhone = i.CustomerPhone, - CustomerAccount = i.CustomerAccount, - AutualCustomerName = i.AutualCustomerName, - Currency = i.Currency, - ReceiptCurrency = i.ReceiptCurrency, - ApplyAmount = i.ApplyAmount, - InvoiceAmount = i.InvoiceAmount, - OperatorId = i.OperatorId, - IsLocked = i.IsLocked, - LockUserId = i.LockUserId, - LockTime = i.LockTime, - TaxRate = i.TaxRate, - OrgId = i.OrgId, - SaleDeptId = i.SaleDeptId, - IsCancelled = i.IsCancelled, - CancelUserId = i.CancelUserId, - CancelTime = i.CancelTime, - CreateTime = i.CreateTime, - CreateBy = i.CreateBy, Details = SqlFunc.Subqueryable().Where(d => d.ApplicationId == i.Id) .ToList(d => new ApplicationDetailDto { @@ -85,7 +54,7 @@ namespace DS.WMS.Core.Invoice.Method d.ApplicationId == i.Id && d.Category == DetailCategory.InvoiceIssuance && d.RefId == a.Id) .WhereIF(!string.IsNullOrEmpty(request.OtherQueryCondition), (d, a) => a.ApplicationNO.Contains(request.OtherQueryCondition)) .GroupBy((d, a) => a.ApplicationNO).ToList((d, a) => a.ApplicationNO) - }).MergeTable(); + }, true).MergeTable(); if (!string.IsNullOrEmpty(request.OtherQueryCondition)) query = query.Where(i => i.InvoiceNO.Contains(request.OtherQueryCondition) || i.BillNO.Contains(request.OtherQueryCondition)); diff --git a/ds-wms-service/DS.WMS.Core/Op/EDI/VOLTAEdiHelper.cs b/ds-wms-service/DS.WMS.Core/Op/EDI/VOLTAEdiHelper.cs index ddbb22fd..627489aa 100644 --- a/ds-wms-service/DS.WMS.Core/Op/EDI/VOLTAEdiHelper.cs +++ b/ds-wms-service/DS.WMS.Core/Op/EDI/VOLTAEdiHelper.cs @@ -224,6 +224,10 @@ namespace DS.WMS.Core.Op.EDI #region 格式化每行 public static List formatlengthStr(string str, int length, bool formatstr = false, bool nodelsp = false) { + //2022-12-28 JHQ 传的字段是null会导致报错,这里改为如果是NULL则默认赋空字符串。 + if (str == null) + str = ""; + str = str.Replace("\r\n", "\\"); str = str.Replace("\n", "\\"); str = str.Replace("\r", " "); @@ -303,17 +307,17 @@ namespace DS.WMS.Core.Op.EDI if (string.IsNullOrEmpty(InttrEdi.RECEIVECODE)) { error = error + "
接收方代码不能为空"; } - if (InttrEdi.filetype == "B") - { - if (InttrEdi.UseForWarderCode) - { - if (string.IsNullOrEmpty(InttrEdi.ForWarderCode)) - { error = error + "
货代代码不能为空"; } + //if (InttrEdi.filetype == "B") + //{ + // if (InttrEdi.UseForWarderCode) + // { + // if (string.IsNullOrEmpty(InttrEdi.ForWarderCode)) + // { error = error + "
货代代码不能为空"; } - if (string.IsNullOrEmpty(InttrEdi.ForWarderName)) - { error = error + "
货代称呼不能为空"; } - } - } + // if (string.IsNullOrEmpty(InttrEdi.ForWarderName)) + // { error = error + "
货代称呼不能为空"; } + // } + //} foreach (var headData in InttrEdi.BSLIST) @@ -325,9 +329,7 @@ namespace DS.WMS.Core.Op.EDI if (string.IsNullOrEmpty(headData.BLFRT)) { error = error + "
提单号:" + headData.MBLNO + " 付费方式不能为空"; } - //2023-01-04 JHQ 跟韩训涛确认,ESL这里不处理航线代码,去掉不为空校验,并在生成EDI报文时,对ESL航线代码赋空串 - //if (string.IsNullOrEmpty(headData.ESLLINECODE)) - //{ error = error + "
提单号:" + headData.MBLNO + " ESL航线代码不能为空"; } + if (InttrEdi.filetype == "E") { @@ -337,13 +339,27 @@ namespace DS.WMS.Core.Op.EDI if (string.IsNullOrEmpty(headData.VOYNO)) { error = error + "
提单号:" + headData.MBLNO + " 航次不能为空"; } - if (string.IsNullOrEmpty(headData.ETD)) + if (InttrEdi.filetype != "B" || headData.CARRIEREDICODE == "YML") { - error = error + "
提单号:" + headData.MBLNO + " 开船日期不能为空"; - return error; + if (string.IsNullOrEmpty(headData.ETD)) + { + error = error + "
提单号:" + headData.MBLNO + " 开船日期不能为空"; + return error; + } } } + if (headData.CARRIEREDICODE != "ZIM") + { + if (string.IsNullOrEmpty(headData.PLACERECEIPTID) || headData.PLACERECEIPTID.Length != 5) + { error = error + "
提单号:" + headData.MBLNO + " 收货地代码不能为空或录入不正确(必须是5位代码)"; } + + if (string.IsNullOrEmpty(headData.PLACERECEIPT)) + { error = error + "
提单号:" + headData.MBLNO + " 收货地不能为空"; } + + } + + if (string.IsNullOrEmpty(headData.PORTLOADID) || headData.PORTLOADID.Length != 5) { error = error + "
提单号:" + headData.MBLNO + " 装货港代码不能为空或录入不正确(必须是5位代码)"; } @@ -367,12 +383,6 @@ namespace DS.WMS.Core.Op.EDI { error = error + "
提单号:" + headData.MBLNO + " 目的地代码不能为空或录入不正确(必须是5位代码)"; } } - if (string.IsNullOrEmpty(headData.ESLLINECODE)) - { error = error + "
提单号:" + headData.MBLNO + " 航司航线不能为空"; } - - if (string.IsNullOrWhiteSpace(headData.CONTRACTNO)) - { error = error + "
提单号:" + headData.MBLNO + " 运费协议号不能为空"; } - if (string.IsNullOrEmpty(headData.KINDPKGS_EDI_CODE)) { error = error + "
提单号:" + headData.MBLNO + " 包装EDI代码不能为空"; } if (headData.PKGS == 0) @@ -400,6 +410,14 @@ namespace DS.WMS.Core.Op.EDI if (headData.REEFERF == null || headData.REEFERF == "") { error = error + "
提单号:" + headData.MBLNO + " 通风度不能为空"; } } + if (headData.ISSUEPLACE == null || headData.ISSUEPLACE == "") + { error = error + "
提单号:" + headData.MBLNO + "签单地点不能为空"; } + + if (headData.CARRIEREDICODE == "APL") + if (headData.ISSUETYPE == null || headData.ISSUETYPE == "") + { error = error + "
提单号:" + headData.MBLNO + "签单方式不能为空"; } + if (headData.SERVICE == "" || headData.SERVICE == null) + { error = error + "
提单号:" + headData.MBLNO + "运输条款不能为空"; } if (string.IsNullOrEmpty(headData.MARKS)) { @@ -417,6 +435,11 @@ namespace DS.WMS.Core.Op.EDI } } + if (!new string[] { "ORI", "TER", "EXP" }.Contains(headData.ISSUETYPE)) + { + error = error + "
提单号:" + headData.MBLNO + "签单方式未识别"; + } + if (string.IsNullOrEmpty(headData.DESCRIPTION)) { error = error + "
提单号:" + headData.MBLNO + " 货物描述不能为空"; @@ -446,17 +469,14 @@ namespace DS.WMS.Core.Op.EDI } else { - - //2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断,考虑判断方法判断了行数,这里暂时改外调大单行的最大字符数35改为70 if (headData.CARRIEREDICODE == "HLCU") { - error += formatlengthError("txt", headData.SHIPPER, 70, headData.MBLNO, "发货人", 6, "-", false); + error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "-", false); } else { - error += formatlengthError("txt", headData.SHIPPER, 70, headData.MBLNO, "发货人", 6, "*", false); + error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "*", false); } - } } //} @@ -475,15 +495,13 @@ namespace DS.WMS.Core.Op.EDI } else { - //2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断,考虑判断方法判断了行数,这里暂时改外调大单行的最大字符数35改为70 - if (headData.CARRIEREDICODE == "HLCU") { - error += formatlengthError("txt", headData.CONSIGNEE, 70, headData.MBLNO, "收货人", 6, "--", false); + error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "--", false); } else { - error += formatlengthError("txt", headData.CONSIGNEE, 70, headData.MBLNO, "收货人", 6, "**", false); + error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "**", false); } } } @@ -503,15 +521,13 @@ namespace DS.WMS.Core.Op.EDI } else { - //2023-04-04 经和川操作确认不对收、发、通信息判断每行35个字符判断,考虑判断方法判断了行数,这里暂时改外调大单行的最大字符数35改为70 - if (headData.CARRIEREDICODE == "HLCU") { - error += formatlengthError("txt", headData.NOTIFYPARTY, 70, headData.MBLNO, "通知人", 6, "---", false); + error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "---", false); } else { - error += formatlengthError("txt", headData.NOTIFYPARTY, 70, headData.MBLNO, "通知人", 6, "***", false); + error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "***", false); } } } @@ -534,7 +550,7 @@ namespace DS.WMS.Core.Op.EDI { if (string.IsNullOrEmpty(ctn.CTNALLCODE)) { error = error + "
提单号:" + headData.MBLNO + " 集装箱箱型EDI代码不能为空"; } - if (ctn.CTNALLCODE != null && (ctn.CTNALLCODE.IndexOf("RH") > 0 || ctn.CTNALLCODE.IndexOf("RF") > 0) && (headData.CARGOID != "R")) + if ((ctn.CTNALLCODE.IndexOf("RH") > 0 || ctn.CTNALLCODE.IndexOf("RF") > 0) && (headData.CARGOID != "R")) { { error = error + "
提单号:" + headData.MBLNO + " 集装箱箱型为冻柜,货类代码请选择冻柜"; } } @@ -630,10 +646,10 @@ namespace DS.WMS.Core.Op.EDI //跟韩工确认增加判断 if (!string.IsNullOrWhiteSpace(headData.BLFRT) && headData.BLFRT.IndexOf("PREPAID") >= 0) { - if (string.IsNullOrWhiteSpace(headData.PREPARDAT)) - { - error = error + "
提单号:" + headData.MBLNO + " 付费方式是预付,预付地点不能为空"; - } + //if (string.IsNullOrWhiteSpace(headData.PREPARDAT)) + //{ + // error = error + "
提单号:" + headData.MBLNO + " 付费方式是预付,预付地点不能为空"; + //} if (!string.IsNullOrWhiteSpace(headData.PAYABLEAT)) { @@ -642,32 +658,26 @@ namespace DS.WMS.Core.Op.EDI } else if (!string.IsNullOrWhiteSpace(headData.BLFRT) && headData.BLFRT.IndexOf("COLLECT") >= 0) { - if (string.IsNullOrWhiteSpace(headData.PAYABLEAT)) - { - error = error + "
提单号:" + headData.MBLNO + " 付费方式是到付,到付地点不能为空"; - } + //if (string.IsNullOrWhiteSpace(headData.PAYABLEAT)) + //{ + // error = error + "
提单号:" + headData.MBLNO + " 付费方式是到付,到付地点不能为空"; + //} if (!string.IsNullOrWhiteSpace(headData.PREPARDAT)) { error = error + "
提单号:" + headData.MBLNO + " 付费方式是到付,预付地点不能填写"; } } + } return error; } #endregion - #region 生成报文(订舱(InttrEdi.filetype=="B"),截单(InttrEdi.filetype=="E")) + #region 生成报文(订舱(filetype=="B"),截单(filetype=="E")) public static EdiDataResult CreateEdiVOLTA(EDIBaseModel InttrEdi) { - /* - 注意的几个问题 - 1、SERVICECONTRACTNO(服务合同号)查了原来大简云的记录,前端没有录入的编辑框,后台也没有做数据对应,一直是空着的。不确定是否影响到EDI的报文。 - */ - EdiDataResult result = new EdiDataResult { Succeeded = false }; - - - + var result = new EdiDataResult { Succeeded = false }; var filetype = "IFTMIN"; if (InttrEdi.filetype != "E") filetype = "IFTMBF"; @@ -677,22 +687,17 @@ namespace DS.WMS.Core.Op.EDI if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) filename = filename.Replace("\\", "/"); + //if (System.IO.File.Exists(filename)) + //{ + // System.IO.File.Delete(filename); + //} FileStream f = new FileStream(filename, FileMode.Create); StreamWriter r = new StreamWriter(f, Encoding.Default); var icount = 0; var bsno = ""; var isfirst = true; - foreach (var bill in InttrEdi.BSLIST) { - //2023-01-04 JHQ 跟韩训涛确认,ESL这里不处理航线代码,去掉不为空校验,并在生成EDI报文时,对ESL航线代码赋空串 - if (bill.ESLLINECODE == null) - bill.ESLLINECODE = string.Empty; - - //2022-01-04 - if (InttrEdi.ForWarderName == null) - InttrEdi.ForWarderName = string.Empty; - if (isfirst) { if (InttrEdi.filetype == "E") @@ -704,14 +709,74 @@ namespace DS.WMS.Core.Op.EDI } - //2023-03-03 修改运输条款SERVICE改为EDI的映射值,经过韩工确认 + if (bill.CARRIEREDICODE == "ONEY") + { + var sendno = bill.EDIATTNEMAIL; + + if (filetype == "E") sendno = bill.AMSCODE; + var MBLNO = bill.MBLNO; + if (MBLNO.Substring(0, 4) == "ONEY") + { + MBLNO = MBLNO.Substring(4, MBLNO.Length - 4); + } + //2023-02-28 ONE的逻辑是去掉了提单号的前4位,跟韩工已确认,与东胜7相同 + //2023-03-03 韩工给提供了新的02行的处理SENDNAME改为读取FTP配置的 + /* + r.WriteLine("02" + + ":" + MBLNO//2 REFERENCE NO. 运编号 X(35) 一般为流水号 M + + ":" + MBLNO//3 B\L NO. 提单号 X(20) 船公司的提单号 C + + ":" + bill.SERVICE//4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M + + ":" + InttrEdi.SENDNAME//5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + + ":ONEY" //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M + + ":"//7 ISSUE PARTY 签单人说明 X(35)   C + + ":"//8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C + + ":"//9 FOB BK PARTY 国外订舱单位 X(13) 国外FOB货订舱单位的代码 C + + ":"//10 B/L TRANSHIP ID 转船标识 X(1) Y/N C + + ":"//11 BATCH ID 分批 X(1) Y/N C + + ":"//12 SHIPMENT DATE 装期 9(8) CCYYMMDD C + + ":"//13 EXPIRY DATE 效期 9(8) CCYYMMDD C + + ":" + bill.CONTRACTNO//14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C + + ":"//15 CHARGE TYPE 费率本代码 X(1)   C + + ":" + bill.CONTRACTNO//16 S/C NO. 合约号 X(30)   C + + ":"//17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C + + ":"//18 SLOT CHARTER ID 舱位互用标识 X(1)   C + + ":" + sendno//19 AMS CODE AMS代码 X(15)   C + //注:QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。 + + "'"); + */ + //2023-03-03 修改运输条款SERVICE改为EDI的映射值,经过韩工确认 + r.WriteLine("02" + + ":" + MBLNO//2 REFERENCE NO. 运编号 X(35) 一般为流水号 M + + ":" + MBLNO//3 B\L NO. 提单号 X(20) 船公司的提单号 C + + ":" + bill.SERVICEEDICODE//4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M + + ":" + formatEdiStr("txt", InttrEdi.SENDCOMPANYCODE) //5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + + ":ONEY" //6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M + + ":"//7 ISSUE PARTY 签单人说明 X(35)   C + + ":"//8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C + + ":"//9 FOB BK PARTY 国外订舱单位 X(13) 国外FOB货订舱单位的代码 C + + ":"//10 B/L TRANSHIP ID 转船标识 X(1) Y/N C + + ":"//11 BATCH ID 分批 X(1) Y/N C + + ":"//12 SHIPMENT DATE 装期 9(8) CCYYMMDD C + + ":"//13 EXPIRY DATE 效期 9(8) CCYYMMDD C + + ":" + bill.CONTRACTNO//14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C + + ":"//15 CHARGE TYPE 费率本代码 X(1)   C + + ":" + bill.CONTRACTNO//16 S/C NO. 合约号 X(30)   C + + ":"//17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C + + ":"//18 SLOT CHARTER ID 舱位互用标识 X(1)   C + + ":" + sendno//19 AMS CODE AMS代码 X(15)   C + //注:QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。 + + "'"); + + } + else if (InttrEdi.filetype == "E") { + //2023-03-03 修改运输条款SERVICE改为EDI的映射值,经过韩工确认 r.WriteLine("02" + ":" + bill.ORDERNO//2 REFERENCE NO. 运编号 X(35) 一般为流水号 M + ":" + bill.MBLNO//3 B\L NO. 提单号 X(20) 船公司的提单号 C + ":" + bill.SERVICEEDICODE//4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M - + ":" + formatEdiStr("txt", InttrEdi.ForWarderName.Replace("\n", " ").Replace("\r", " "))//5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + + ":" + formatEdiStr("txt", !string.IsNullOrWhiteSpace(InttrEdi.ForWarderName) ? InttrEdi.ForWarderName.Replace("\n", " ").Replace("\r", " ") : "")//5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + ":" + InttrEdi.RECEIVECODE//6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M + ":"//7 ISSUE PARTY 签单人说明 X(35)   C + ":"//8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C @@ -734,12 +799,14 @@ namespace DS.WMS.Core.Op.EDI } else { + var sendno = bill.EDIATTNEMAIL; + //2023-03-03 修改运输条款SERVICE改为EDI的映射值,经过韩工确认 r.WriteLine("02" + ":" + bill.ORDERNO//2 REFERENCE NO. 运编号 X(35) 一般为流水号 M + ":" + bill.MBLNO//3 B\L NO. 提单号 X(20) 船公司的提单号 C + ":" + bill.SERVICEEDICODE//4 DELIVERY TERM 交货条款 X(9) CY-CY(pier-pier/port):30CY-CFS(pier/port-door):29CFS-CY(door-pier/port):28CFS-CFS(door-door):27 M - + ":" + formatEdiStr("txt", InttrEdi.ForWarderName.Replace("\n", " ").Replace("\r", " "))//5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + + ":" + formatEdiStr("txt", !string.IsNullOrWhiteSpace(InttrEdi.ForWarderName) ? InttrEdi.ForWarderName.Replace("\n", " ").Replace("\r", " ") : "")//5 BOOKING PARTY 订舱人说明 X(70) 货代方企业名称或代码 C + ":" + InttrEdi.RECEIVECODE//6 ISSUE PARTY CODE 签单人代码 X(13) 即接受订舱的人的代码 M + ":"//7 ISSUE PARTY 签单人说明 X(35)   C + ":"//8 APPLICANT 询价单位 X(13) 向船公司询价的单位代码 C @@ -750,23 +817,19 @@ namespace DS.WMS.Core.Op.EDI + ":"//13 EXPIRY DATE 效期 9(8) CCYYMMDD C + ":" + bill.CONTRACTNO//14 QUOTATION NO. 运费协议号 X(30) MAERSK为必选 C + ":"//15 CHARGE TYPE 费率本代码 X(1)   C - + ":" + bill.SERVICECONTRACTNO//16 S/C NO. 合约号 X(30)   C - /* 2023-04-10 经过测试发现会吧这个订舱编号写到备注里,这里选择去掉填写订舱编号 - + ":" + bill.ORDERNO//17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C - */ + + ":" + bill.CONTRACTNO//16 S/C NO. 合约号 X(30)   C + ":"//17 BOOKING NO. 船公司订舱编号 X(20) 船公司系统内部订舱编号 C + ":"//18 SLOT CHARTER ID 舱位互用标识 X(1)   C - + ":" + bill.EDIATTNEMAIL//21 AMS CODE AMS代码 X(15)   C - + ":" + bill.EDIATTN//22 AMS CODE AMS代码 X(15)   C - + ":" + bill.EDIATTNTEL//23 AMS CODE AMS代码 X(15)   C - //注:QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。 + + ":" + sendno//19 AMS CODE AMS代码 X(15)   C + //注:QUOTATION NO.项填本票订舱货的运价是通过向中集询价后定下的特殊运价编号。 + "'"); } icount++; var ISSUETYPE = ""; - /* 2022-01-04 这里新订舱系统的签单方式代码已变更采用新的编码来判断 + //2023-03-02 测试这里有问题,签单方式用的中文,要改成英文正本-ORIGINAL 电放-TELEX + /* if (bill.ISSUETYPE == "正本") { ISSUETYPE = "ORI"; @@ -777,28 +840,36 @@ namespace DS.WMS.Core.Op.EDI } else ISSUETYPE = "EXP"; */ + //if (bill.ISSUETYPE == "ORIGINAL") + //{ + // ISSUETYPE = "ORI"; + //} + //else if (bill.ISSUETYPE == "TELEX") + //{ + // ISSUETYPE = "TER"; + //} + //else ISSUETYPE = "EXP"; - if (bill.ISSUETYPE == "ORIGINAL") + if (new string[] { "ORI", "TER", "EXP" }.Contains(bill.ISSUETYPE)) { - //正本 - ISSUETYPE = "ORI"; + ISSUETYPE = bill.ISSUETYPE; } - else if (bill.ISSUETYPE == "TELEX") - { - //电放 - ISSUETYPE = "TER"; - } - else ISSUETYPE = "EXP"; - r.WriteLine("03:" + ISSUETYPE + ":" + bill.ISSUEPLACEID.Trim() + ":" + bill.ISSUEPLACE.Trim() + ":" + GetDateStr(bill.ISSUEDATE, "yyyyMMdd") + ":" + GetBillNum2(bill.NOBILL) + ":" + bill.PREPARDAT + ":" + bill.PAYABLEAT + "'"); icount++; - - r.WriteLine("11:" + bill.ESLLINECODE + ":" + bill.VESSEL + ":" + bill.VOYNO + ":::" + InttrEdi.RECEIVECODE + "::" + GetDateStr(bill.ETD, "yyyyMMdd") + ":::::'"); + //2024-09-13 参考韩工东胜7去掉ETD + //r.WriteLine("11:" + bill.VESSELID + ":" + bill.VESSEL + ":" + bill.VOYNO + ":::::" + GetDateStr(bill.ETD, "yyyyMMdd") + ":::::'"); + r.WriteLine("11:" + bill.VESSELID + ":" + bill.VESSEL + ":" + bill.VOYNO + "::::::::::'"); icount++; - + var DESTINATIONID = bill.DESTINATIONID; + var DESTINATION = bill.DESTINATION; + if (bill.CARRIEREDICODE == "ONEY" || bill.CARRIEREDICODE == "ZIM") + { + DESTINATIONID = ""; + DESTINATION = ""; + } r.WriteLine("12" + ":" + bill.PLACERECEIPTID//2 PLACE CODE OF RECEIPT 收货地代码 X(5) OOCL、HLC的订舱要求必选 O @@ -811,8 +882,8 @@ namespace DS.WMS.Core.Op.EDI + ":" + bill.TRANSPORT//9 TRANSFER PORT 中转港 X(35)   C + ":" + bill.PLACEDELIVERYID//10 PLACE OF DELIVERY CODE 交货地代码 X(5) OOCL的订舱要求必选 O + ":" + bill.PLACEDELIVERY//11 PLACE OF DELIVERY 交货地 X(35)   C - + ":" + bill.DESTINATIONID//12 FINAL DESTINATION CODE 目的地代码 X(5)   C - + ":" + bill.DESTINATION//13 FINAL DESTINATION CODE 目的地 X(35)   C + + ":" + DESTINATIONID//12 FINAL DESTINATION CODE 目的地代码 X(5)   C + + ":" + DESTINATION//13 FINAL DESTINATION CODE 目的地 X(35)   C + "'"); icount = icount + 1; @@ -833,23 +904,26 @@ namespace DS.WMS.Core.Op.EDI List ShippingList = formatlengthStr(Shipping, 70); - if (Shipping != "") + if (!string.IsNullOrWhiteSpace(Shipping)) { r.WriteLine("17:" + formatListStr(ShippingList, 5) + "'"); icount++; } + if (InttrEdi.filetype != "E" && !string.IsNullOrEmpty(bill.NVONO)) + { + r.WriteLine("18:NVO:" + bill.NVONO + "'"); + + } + Shipping = formatEdiStr("txt", bill.SHIPPER); - /* - 2023-04-06 ESL的EDI去掉校验后,这里需要截取需要按照最大35来截取 - ShippingList = formatlengthStr(Shipping, 75); - */ ShippingList = formatlengthStr(Shipping, 35); if (ShippingList.Count != 0 && Shipping.Length > 0) { - r.WriteLine("20::" + formatListStr(ShippingList, 6) + "'"); + //2024-09-13 韩工确认最大行数6改为9 + r.WriteLine("20::" + formatListStr(ShippingList, 9) + "'"); icount = icount + 1; } @@ -857,67 +931,89 @@ namespace DS.WMS.Core.Op.EDI Shipping = formatEdiStr("txt", bill.CONSIGNEE); - /* - 2023-04-06 ESL的EDI去掉校验后,这里需要截取需要按照最大35来截取 - ShippingList = formatlengthStr(Shipping, 75); - */ ShippingList = formatlengthStr(Shipping, 35); if (ShippingList.Count != 0 && Shipping.Length > 0) { - r.WriteLine("21::" + formatListStr(ShippingList, 6) + "'"); + //2024-09-13 韩工确认最大行数6改为9 + r.WriteLine("21::" + formatListStr(ShippingList, 9) + "'"); icount = icount + 1; } Shipping = formatEdiStr("txt", bill.NOTIFYPARTY); - /* - 2023-04-06 ESL的EDI去掉校验后,这里需要截取需要按照最大35来截取 - ShippingList = formatlengthStr(Shipping, 75); - */ ShippingList = formatlengthStr(Shipping, 35); if (ShippingList.Count != 0 && Shipping.Length > 0) { - r.WriteLine("22::" + formatListStr(ShippingList, 6) + "'"); + //2024-09-13 韩工确认最大行数6改为9 + r.WriteLine("22::" + formatListStr(ShippingList, 9) + "'"); icount = icount + 1; } - if (InttrEdi.filetype == "E") + Shipping = formatEdiStr("txt", !string.IsNullOrWhiteSpace(bill.NOTIFYPARTY2) ? bill.NOTIFYPARTY2 : ""); + ShippingList = formatlengthStr(Shipping, 35); + + if (!string.IsNullOrWhiteSpace(Shipping)) { - Shipping = formatEdiStr("txt", bill.NOTIFYPARTY2); - ShippingList = formatlengthStr(Shipping, 75); - if (Shipping != "") - { + r.WriteLine("23::" + formatListStr(ShippingList, 6) + "'"); + icount = icount + 1; - r.WriteLine("23::" + formatListStr(ShippingList, 6) + "'"); - icount = icount + 1; + } - } + Shipping = bill.AMSCONSIGNEE; + ShippingList = formatlengthStr(Shipping, 35); + + if (!string.IsNullOrWhiteSpace(Shipping)) + { + r.WriteLine("24::" + formatListStr(ShippingList, 6, true) + "'"); + icount = icount + 1; + + } + + + Shipping = bill.AMSNOTIFYPARTY; + ShippingList = formatlengthStr(Shipping, 35); + + if (!string.IsNullOrWhiteSpace(Shipping)) + { + r.WriteLine("25::" + formatListStr(ShippingList, 6, true) + "'"); + icount = icount + 1; } + var cargoid = bill.CARGOID; if (cargoid == "" || cargoid == " ") cargoid = "S"; - r.WriteLine("41:1:" + bill.HSCODE + ":" + cargoid + ":" + bill.PKGS.ToString() + ":" + bill.KINDPKGS_EDI_CODE + ":" + bill.KINDPKGS + ":" + bill.KGS.ToString("0.###") + ":" - + bill.CBM.ToString("0.###") + "::::::" + bill.KGS.ToString("0.###") + ":::'"); + var kingweight = bill.KINGTAREWEIGHT; + if (kingweight == 0) + kingweight = 100; + + r.WriteLine("41:1:" + bill.HSCODE + ":" + cargoid + ":" + bill.PKGS.ToString() + ":" + bill.KINDPKGS_EDI_CODE + ":" + bill.KINDPKGS + ":" + kingweight.ToString() + ":" + + bill.CBM.ToString() + "::::::" + bill.KGS.ToString() + ":::'"); icount = icount + 1; + if (cargoid == "R") + { r.WriteLine("43::::::::::" + bill.REEFERF + ":C:" + bill.TEMPSET + ":" + bill.TEMPMIN + ":" + bill.TEMPMAX + ":::::'"); + + icount = icount + 1; + } else if (cargoid == "D") + { r.WriteLine("43:" + bill.DCLASS + ":" + bill.DPAGE + ":" + bill.DUNNO + ":" + bill.DLABEL + "::::::::::::'"); - icount = icount + 1; - + icount = icount + 1; + } Shipping = formatEdiStr("txt", bill.MARKS); ShippingList = formatlengthStr(Shipping, 35); @@ -972,7 +1068,7 @@ namespace DS.WMS.Core.Op.EDI } } } - if (strtemp != "") + if (!string.IsNullOrWhiteSpace(strtemp)) { r.WriteLine(strtemp + "'"); icount = icount + 1; @@ -1049,7 +1145,7 @@ namespace DS.WMS.Core.Op.EDI if (InttrEdi.filetype == "E") { r.WriteLine("51:" + ctn.CNTRNO + ":" + ctn.CTNALLCODE + ":" - + ctn.SEALNO + ":" + ctn.PKGS.ToString() + ":" + ctn.KGS.ToString("0.###") + "::" + ctn.CBM.ToString("0.###") + ":" + bill.EDIATTNEMAIL + "'"); + + ctn.SEALNO + ":" + ctn.PKGS.ToString() + ":" + ctn.KGS.ToString() + "::" + ctn.CBM.ToString() + ":" + bill.EDIATTNEMAIL + "'"); icount = icount + 1; if (bill.CTNGOODSLIST != null && bill.CTNGOODSLIST.Count != 0) @@ -1057,7 +1153,7 @@ namespace DS.WMS.Core.Op.EDI foreach (var ctnhs in bill.CTNGOODSLIST) { r.WriteLine("53:" + ctnhs.HSCODE + ":" + ctnhs.PKGS.ToString() + ":" - + ctnhs.KGS.ToString("0.###") + ":" + ctnhs.CBM.ToString("0.###") + ":" + ctnhs.KINDPKGS_EDI_CODE + ":" + ctnhs.KINDPKGS + "'"); + + ctnhs.KGS.ToString() + ":" + ctnhs.CBM.ToString() + ":" + ctnhs.KINDPKGS_EDI_CODE + ":" + ctnhs.KINDPKGS + "'"); icount = icount + 1; Shipping = formatEdiStr("txt", ctnhs.DESCRIPTION); ShippingList = formatlengthStr(Shipping, 70); @@ -1068,7 +1164,7 @@ namespace DS.WMS.Core.Op.EDI for (var i = 0; i < ShippingList.Count; i++) { - if (ShippingList[i] != "") + if (!string.IsNullOrWhiteSpace(ShippingList[i])) { if (m <= 5) { @@ -1092,7 +1188,7 @@ namespace DS.WMS.Core.Op.EDI } } } - if (strtemp != "") + if (!string.IsNullOrWhiteSpace(strtemp)) { r.WriteLine(strtemp + "'"); icount = icount + 1; @@ -1101,13 +1197,20 @@ namespace DS.WMS.Core.Op.EDI } } + else + { + r.WriteLine("53:" + bill.HSCODE + ":" + ctn.PKGS.ToString() + ":" + + ctn.KGS.ToString() + ":" + ctn.CBM.ToString() + ":" + ctn.KINDPKGS_EDI_CODE + ":" + ctn.KINDPKGS + "'"); + + icount = icount + 1; + } } else { if (!string.IsNullOrEmpty(ctn.CNTRNO)) { r.WriteLine("51:" + ctn.CNTRNO + ":" + ctn.CTNALLCODE + ":" - + ctn.SEALNO + ":" + ctn.PKGS.ToString() + ":" + ctn.KGS.ToString("0.###") + ":'"); + + ctn.SEALNO + ":" + ctn.PKGS.ToString() + ":" + ctn.KGS.ToString() + ":'"); icount = icount + 1; } } @@ -1116,7 +1219,7 @@ namespace DS.WMS.Core.Op.EDI } - icount = icount + 1; + //icount = icount + 1; r.WriteLine("99:" + icount.ToString() + "'"); r.Close(); f.Close(); diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs index dd46852b..4d24312f 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs @@ -1448,7 +1448,7 @@ namespace DS.WMS.Core.Op.Method } else { - if (ediRouteEnum == EDIRouteEnum.INTTRA) + if (ediRouteEnum == EDIRouteEnum.INTTRA || ediRouteEnum == EDIRouteEnum.VOLTA) { primaryModel.ORDERNO = order.CustomerNo; } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs index 76fbdaa8..0831eb0c 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs @@ -9,7 +9,7 @@ public QueryTaskManageDto OtherQueryCondition { get; set; } - + public bool IsReCalc { get; set; } ///// ///// 业务编号(提单号或委托编号) ///// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 57742942..393674af 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -1845,6 +1845,11 @@ namespace DS.WMS.Core.TaskPlat.Method { Id = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -1954,6 +1959,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2029,6 +2039,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2072,6 +2087,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2155,6 +2175,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2193,6 +2218,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2236,6 +2266,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2276,6 +2311,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2313,6 +2353,10 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, s.CustomerNo, s.CustomerNum, @@ -2363,6 +2407,11 @@ namespace DS.WMS.Core.TaskPlat.Method { PK_ID = t.Id.SelectAll(), + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2410,9 +2459,15 @@ namespace DS.WMS.Core.TaskPlat.Method await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - var queryableTemp = queryable.Select((t, a, s) => new + ISugarQueryable queryableTemp = queryable.Select((t, a, s) => new { PK_ID = t.Id.SelectAll(), + + orderMBLNO = s.MBLNO, + orderETD = s.ETD, + orderCarrier = s.Carrier, + orderCarrierId = s.CarrierId, + s.CustomerNo, s.CustomerNum, s.BookingNo, @@ -2429,10 +2484,6 @@ namespace DS.WMS.Core.TaskPlat.Method s.DischargePort, s.CntrTotal, - - //TASK_USER_STATUS = a.Status, - //TASK_USER_STATUS_NAME = a.StatusName, - //TASK_USER_STATUS_TIME = a.StatusTime }).Distinct(); var sql = queryableTemp.ToSqlString(); @@ -2462,9 +2513,11 @@ namespace DS.WMS.Core.TaskPlat.Method RecvUserStatusTime = x.StatusTime }).ToListAsync(); - if (allRecvUserList.Count > 0) + // 一些特殊处理 + foreach (var item in result.Data) { - foreach (var item in result.Data) + // 1.任务接收人赋值 + if (allRecvUserList.Count > 0) { var recvUserList = allRecvUserList.Where(x => x.TaskId == item.Id).ToList(); @@ -2485,6 +2538,22 @@ namespace DS.WMS.Core.TaskPlat.Method item.RecvUserList = recvUserList; } + + // 2.部分字段值覆盖:提单号、ETD、船公司(如果订单的号码不为空则采用订单的号码) + if (!string.IsNullOrEmpty(item.orderMBLNO)) + { + item.MBL_NO = item.orderMBLNO; + } + if (item.orderETD != null) + { + item.ETD = item.orderETD; + } + if (!string.IsNullOrEmpty(item.orderCarrier)) + { + item.CARRIER_CODE = item.orderCarrier; + item.CARRIER_ID = item.orderCarrierId; + item.CARRIER_NAME = null; + } } } } @@ -2502,6 +2571,7 @@ namespace DS.WMS.Core.TaskPlat.Method { queryable.ClearFilter(typeof(IOrgId)); var taskTypeStr = taskType.ToString(); + var taskStatusStr = TaskStatusEnum.Cancel.ToString(); long? parentId = null; if (!string.IsNullOrEmpty(queryDto.BusinessNo)) @@ -2511,10 +2581,9 @@ namespace DS.WMS.Core.TaskPlat.Method } queryable.Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString() && t.Deleted == false) - .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) - .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, bc, s) => queryDto.BusinessNo == t.MBL_NO - || queryDto.BusinessNo == s.MBLNO + .Where((t, a) => t.STATUS != taskStatusStr && t.Deleted == false) + .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskTypeStr) + .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, bc, s) => ((t.MBL_NO != null && queryDto.BusinessNo == t.MBL_NO) || (s.MBLNO != null && queryDto.BusinessNo == s.MBLNO)) || queryDto.BusinessNo == s.CustomerNo || queryDto.BusinessNo == s.BookingNo || queryDto.BusinessNo == s.CustomerNum @@ -2540,6 +2609,10 @@ namespace DS.WMS.Core.TaskPlat.Method { queryable.ClearFilter(typeof(IOrgId)); long? parentId = null; + + var taskTypeStr = taskType.ToString(); + var taskStatusStr = TaskStatusEnum.Cancel.ToString(); + if (!string.IsNullOrEmpty(queryDto.BusinessNo)) { var parentIdTemp = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); @@ -2547,10 +2620,9 @@ namespace DS.WMS.Core.TaskPlat.Method } queryable.Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString() && t.Deleted == false) - .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) - .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO - || queryDto.BusinessNo == s.MBLNO + .Where((t, a) => t.STATUS != taskStatusStr && t.Deleted == false) + .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskTypeStr) + .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, s) => ((!string.IsNullOrEmpty(s.MBLNO) && queryDto.BusinessNo == s.MBLNO) || (string.IsNullOrEmpty(s.MBLNO) && queryDto.BusinessNo == t.MBL_NO)) || queryDto.BusinessNo == s.CustomerNo || queryDto.BusinessNo == s.CustomerNum || queryDto.BusinessNo == s.BookingNo @@ -2596,7 +2668,10 @@ namespace DS.WMS.Core.TaskPlat.Method //LastMatchTaskTime = DateTime.Now; //} - await MatchTask(); + if (queryDto.IsReCalc) + { + await MatchTask(); + } //序列化查询条件 List? whereList = null; @@ -2668,12 +2743,12 @@ namespace DS.WMS.Core.TaskPlat.Method .Where(whereList) .Where((t, a) => t.STATUS != cancelStr && t.Deleted == false) .Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || - .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), (t, a, s) => queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO - || queryDto.OtherQueryCondition.BusinessNo == s.MBLNO - || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNo - || queryDto.OtherQueryCondition.BusinessNo == s.BookingNo - || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNum - || (parentId != null && s.Id == parentId)) + .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), + (t, a, s) => ((!string.IsNullOrEmpty(s.MBLNO) && queryDto.OtherQueryCondition.BusinessNo == s.MBLNO) || (string.IsNullOrEmpty(s.MBLNO) && queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO)) + || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNo + || queryDto.OtherQueryCondition.BusinessNo == s.BookingNo + || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNum + || (parentId != null && s.Id == parentId)) .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode), (t, a, s) => queryDto.OtherQueryCondition.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id)) .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode), (t, a, s) => queryDto.OtherQueryCondition.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id)) diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs index 0789f4e7..ac1dfb28 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs @@ -97,6 +97,7 @@ namespace DS.WMS.OpApi.Controllers { var allotDataList = await tenantDb.Queryable() .Where(x => x.BusinessId == businessId && skuCodeList.Contains(x.GoodStatusCode)) + .OrderBy(x => x.Id) .Select(x => new { x.GoodStatusCode, x.UserName, x.StatusName, x.StatusTime }) .ToListAsync();