From 467212915fed3625c70cc584ac51cd1ffa01b9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 30 Aug 2024 11:24:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=A0=B8=E7=AE=97=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8F=AF=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Fee/Dtos/BusinessDto.cs | 2 +- .../DS.WMS.Core/Fee/Entity/FeeRecord.cs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/BusinessDto.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/BusinessDto.cs index c9b71234..8c11118d 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/BusinessDto.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/BusinessDto.cs @@ -513,7 +513,7 @@ namespace DS.WMS.Core.Fee.Dtos /// /// 核算单位Id /// - public long SaleOrgId { get; set; } + public long? SaleOrgId { get; set; } /// /// 核算单位 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs index 73d925aa..0b0c599e 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs @@ -177,7 +177,7 @@ namespace DS.WMS.Core.Fee.Entity /// /// 审核人Id /// - [SugarColumn(ColumnDescription = "审核人Id")] + [SugarColumn(ColumnDescription = "审核人Id", IsNullable = true)] public long? AuditBy { get; set; } /// @@ -196,26 +196,31 @@ namespace DS.WMS.Core.Fee.Entity /// [SugarColumn(ColumnDescription = "是否公开费用", DefaultValue = "1")] public bool IsOpen { get; set; } = true; + /// /// 对帐编号 /// [SugarColumn(ColumnDescription = "对帐编号", IsNullable = true, Length = 50)] public string DebitNo { get; set; } + /// /// 是否对帐 /// [SugarColumn(ColumnDescription = "是否对帐", DefaultValue = "0")] public bool IsDebit { get; set; } = false; + /// /// 是否垫付费用 /// [SugarColumn(ColumnDescription = "是否垫付费用", DefaultValue = "0")] public bool IsAdvancedPay { get; set; } = false; + /// /// 是否禁开发票 /// [SugarColumn(ColumnDescription = "是否禁开发票", DefaultValue = "0")] public bool IsInvoice { get; set; } = false; + /// /// 是否销售订舱 /// @@ -353,13 +358,14 @@ namespace DS.WMS.Core.Fee.Entity /// 核算单位 /// [SugarColumn(ColumnDescription = "核算单位", IsNullable = true, Length = 50)] - public string SaleOrg { get; set; } + public string? SaleOrg { get; set; } /// /// 核算单位Id /// - [SugarColumn(ColumnDescription = "核算单位Id")] - public long SaleOrgId { get; set; } + [SugarColumn(ColumnDescription = "核算单位Id", IsNullable = true)] + public long? SaleOrgId { get; set; } + /// /// 发票自助连接 /// @@ -369,8 +375,9 @@ namespace DS.WMS.Core.Fee.Entity /// /// 提交日期 /// - [SugarColumn(ColumnDescription = "提交日期")] + [SugarColumn(ColumnDescription = "提交日期", IsNullable = true)] public DateTime? SubmitDate { get; set; } + /// /// 提交人 /// From 3e413f237112ed04bb09d3db97f1faf2a59a3f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 30 Aug 2024 14:07:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Fee/Entity/FeeRecord.cs | 2 +- .../Fee/Interface/IFeeRecordService.cs | 3 +- .../Fee/Method/FeeCustTemplateService.cs | 2 +- .../Fee/Method/FeeRecordService.cs | 51 +++++++------------ .../FolderProfile1.pubxml.user | 2 +- .../Controllers/TaskMailController.cs | 2 +- 6 files changed, 24 insertions(+), 38 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs index 0b0c599e..ecba1311 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Entity/FeeRecord.cs @@ -390,7 +390,7 @@ namespace DS.WMS.Core.Fee.Entity /// /// 排序 /// - [SugarColumn(ColumnDescription = "排序")] + [SugarColumn(ColumnDescription = "排序", IsNullable = true)] public int? OrderNo { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs index f0b3b0ee..0c3b8950 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs @@ -35,8 +35,9 @@ public interface IFeeRecordService /// 提交 /// /// 要提交的费用记录 + /// 是否排除总价为零的费用 /// - Task SaveAsync(IEnumerable items); + Task SaveAsync(IEnumerable items, bool excludeZeroFee = false); /// /// 根据费用模板引入 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCustTemplateService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCustTemplateService.cs index 4ed9d75a..dad97938 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCustTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeCustTemplateService.cs @@ -126,7 +126,7 @@ namespace DS.WMS.Core.Fee.Method if (feeList.Count > 0) { - var result = await feeService.Value.SaveAsync(feeList); + var result = await feeService.Value.SaveAsync(feeList, true); if (!result.Succeeded) { //记录失败日志 diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs index 35cfab8e..a4cee310 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -129,8 +129,9 @@ namespace DS.WMS.Core.Fee.Method /// 费用提交 /// /// 要提交的费用记录 + /// 是否排除总价为零的费用 /// - public async Task SaveAsync(IEnumerable items) + public async Task SaveAsync(IEnumerable items, bool excludeZeroFee = false) { ArgumentNullException.ThrowIfNull(items, nameof(items)); @@ -161,35 +162,17 @@ namespace DS.WMS.Core.Fee.Method foreach (var item in items) { - //-----根据箱型箱量提取数量以计算总价----- - - //如果为箱型标准 - if (string.Equals(item.Note, bool.TrueString, StringComparison.OrdinalIgnoreCase)) - { - if (item.Unit.IsNullOrEmpty()) //未设置箱型则数量则为0 - { - item.Quantity = 0; - } - else - { - var ctn = ctns.Find(x => x.CtnCode == item.Unit); - item.Quantity = ctn == null ? 0 : ctn.CtnNum.GetValueOrDefault(); - } - - continue; - } - //逐个判定处理标准 switch (item.Unit) { - //case "HOUR": //小时 - // goto default; + case "HOUR": //小时 + goto case "P"; - //case "GE": //个 - // goto default; + case "GE": //个 + goto case "P"; - //case "DAY": //天 - // goto default; + case "DAY": //天 + goto case "P"; //case "XX": //箱型 // goto default; @@ -197,8 +180,8 @@ namespace DS.WMS.Core.Fee.Method case "JJZL": //计价重量 goto case "Z"; - //case "ZJ": //总价 - // goto default; + case "ZJ": //总价 + goto case "P"; case "JZ": //净重 item.Quantity = 0; @@ -225,25 +208,27 @@ namespace DS.WMS.Core.Fee.Method break; case "P": //单票 - goto default; - - default: item.Quantity = 1; break; + + default: //查找箱型标准 + var ctn = ctns.Find(x => x.CtnCode == item.Unit); + item.Quantity = ctn == null ? 0 : ctn.CtnNum.GetValueOrDefault(); + break; } //计算税费 item.SetTax(); } - //过滤掉数量为0的费用 - items = items.Where(x => x.Quantity > 0); + if (excludeZeroFee) //过滤掉数量为0的费用 + items = items.Where(x => x.Amount != 0); DateTime dtNow = DateTime.Now; await TenantDb.Ado.BeginTranAsync(); try { - List fees = null; + List? fees = null; var feeIds = items.Where(x => x.Id > 0).Select(x => x.Id).ToArray(); //包含修改的项,需要检测费用状态再修改 if (feeIds.Length > 0) diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user index 65f6ab71..d60f05f6 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>D:\Publish\DS8\FeeApi - True|2024-08-29T08:38:26.3491372Z||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; + True|2024-08-30T03:25:14.7431645Z||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||; \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs index 63acc6ff..3db396c0 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc; namespace DS.WMS.OpApi.Controllers { /// - /// 任务邮件API + /// 邮件模板API /// public class TaskMailController : ApiController { From f1e99c8309df2ad296aecd537b5e5ce9aef26c7d Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 30 Aug 2024 14:23:27 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8F=98=E6=9B=B4=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingSlot/BookingSlotOpenEditReq.cs | 36 +++ .../Op/Dtos/BookingSlot/BookingSlotSaveLog.cs | 43 ++++ .../BookingSlot/IBookingSlotService.cs | 8 + .../Method/BookingSlot/BookingSlotService.cs | 86 +++++++ .../ITaskManageCutDateChangeService.cs | 9 +- .../TaskManageCutDateChangeService.cs | 231 +++++++++--------- .../TaskManageCutDateChangeController.cs | 14 -- 7 files changed, 296 insertions(+), 131 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotOpenEditReq.cs create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotSaveLog.cs diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotOpenEditReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotOpenEditReq.cs new file mode 100644 index 00000000..eec8c1ff --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotOpenEditReq.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + public class BookingSlotOpenEditReq + { + /// + /// 业务主键 + /// + public long Id { get; set; } + + /// + /// VGM截止日期 + /// + public Nullable VGMSubmissionCutDate { get; set; } + + /// + /// 截港时间 + /// + public Nullable CYCutDate { get; set; } + + /// + /// 样单截止日期 + /// + public Nullable SICutDate { get; set; } + + /// + /// 舱单截止时间 + /// + public Nullable ManifestCutDate { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotSaveLog.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotSaveLog.cs new file mode 100644 index 00000000..2e254c4d --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingSlot/BookingSlotSaveLog.cs @@ -0,0 +1,43 @@ +using DS.WMS.Core.Op.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + public class BookingSlotSaveLog + { + /// + /// 操作方式:新增(Create)、更新(Update)、删除(Delete) + /// + public string OperateType { get; set; } = "Update"; + /// + /// 旧值 + /// + public BookingSlotBaseSaveOutput OldOrder { get; set; } + /// + /// 新值 + /// + + public BookingSlotBaseSaveOutput NewOrder { get; set; } + + + /// + /// 业务来源代码 + /// + + public string SourceCode { get; set; } + /// + /// 业务来源 + /// + + public string SourceName { get; set; } + + /// + /// + /// + public List UpdateFields { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs index 9f0b0c9e..91e72445 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs @@ -263,5 +263,13 @@ namespace DS.WMS.Core.Op.Interface /// /// Task>> GetSlotUseToConfig(); + + /// + /// 舱位对外开放更新接口 + /// + /// 舱位更新请求 + /// 返回回执 + Task BookingSlotOpenEdit(BookingSlotOpenEditReq req); + } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index dc3a6da5..06dde2b6 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -55,6 +55,7 @@ using AngleSharp.Dom; using DS.WMS.Core.TaskPlat.Entity; using Microsoft.VisualBasic.FileIO; using Microsoft.Extensions.Logging; +using AnyDiff.Extensions; namespace DS.WMS.Core.Op.Method { @@ -4342,6 +4343,91 @@ namespace DS.WMS.Core.Op.Method } #endregion + #region 舱位对外开放更新接口 + /// + /// 舱位对外开放更新接口 + /// + /// 舱位更新请求 + /// 返回回执 + public async Task BookingSlotOpenEdit(BookingSlotOpenEditReq req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + var slot = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + + var oldSlot = slot.Adapt(); + var dic = req.GetPropertiesArray(); + var info = req.Adapt(slot); + + var newOld = slot.Adapt(); + + await tenantDb.Updateable(info).UpdateColumns(dic).EnableDiffLogEvent().ExecuteCommandAsync(); + await SaveSlotLogAsync(new BookingSlotSaveLog() + { + OperateType = "Update", + OldOrder = oldSlot, + NewOrder = newOld, + SourceCode = "OpenEdit", + SourceName = "开放对接更新", + }, tenantDb); + + return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); + } + #endregion + + #region 海运出口差异日志 + /// + /// 忽略的字段 + /// + private static readonly List IgnoreColumns = new List() + { + "CreateTime", + "CreateUserName", + "CreateBy", + "UpdateTime", + "UpdateUserName", + "UpdateBy", + "DeleteTime", + "DeleteUserName", + "DeleteBy", + "TenantId", + "TenantName", + }; + public async Task SaveSlotLogAsync(BookingSlotSaveLog req, SqlSugarScopeProvider tenantDb) + { + + var diff = req.NewOrder.Diff(req.OldOrder); + StringBuilder sb = new StringBuilder(); + foreach (var item in diff) + { + Console.WriteLine($"{item.PropertyType} - {item.Property}: {item.LeftValue} => {item.RightValue}"); + + if (item.LeftValue.IsNotNull() && item.RightValue.IsNotNull()) + { + if (IgnoreColumns.Contains(item.Property)) + continue; + if (!item.LeftValue.Equals(item.RightValue)) + { + sb.Append($"[字段:{item.Property},修改前:{item.LeftValue},修改后:{item.RightValue}]"); + } + } + } + + var log = new OpBusinessLog() + { + BusinessId = req.NewOrder.Id, + OperateType = "Update", + OldValue = JsonConvert.SerializeObject(req.OldOrder), + NewValue = JsonConvert.SerializeObject(req.NewOrder), + DiffData = sb.ToString(), + SourceCode = req.SourceCode, + SourceName = req.SourceName, + }; + + await tenantDb.Insertable(log).ExecuteCommandAsync(); + + } + #endregion } public static class LetterIndexUtil diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/CutDateChange/ITaskManageCutDateChangeService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/CutDateChange/ITaskManageCutDateChangeService.cs index f1122bca..abb3eb03 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/CutDateChange/ITaskManageCutDateChangeService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/CutDateChange/ITaskManageCutDateChangeService.cs @@ -31,12 +31,11 @@ namespace DS.WMS.Core.TaskPlat.Interface Task> SearchAndMarkBookingOrder(long taskPKId); /// - /// 自动更新订单的截单日期并转发 + /// 更新订单和舱位的截止时间 /// - /// 截止时间变更任务主键 - /// 返回回执 - Task AutoUpdateOrderCutDateAndTranmitToCustomer(long taskPKId); - + /// 数据上下文 + /// + Task ModifyBookingOrderOrSlotTask(TaskFlowDataContext dataContext); /// /// 发送邮件通知给客户 diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs index ae3b1a49..65acc6eb 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/CutDateChange/TaskManageCutDateChangeService.cs @@ -59,6 +59,8 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ITaskLogService _logService; private readonly ITaskMailService _taskMailService; private readonly ITaskAllocationService _taskAllocationService; + private readonly ISeaExportCommonService _seaExportCommonService; + private readonly IBookingSlotService _bookingSlotService; public TaskManageCutDateChangeService(IUser user, ILogger logger, ISaasDbService saasDbService, @@ -71,6 +73,8 @@ namespace DS.WMS.Core.TaskPlat.Method _userService = serviceProvider.GetRequiredService(); _taskMailService = serviceProvider.GetRequiredService(); _taskAllocationService = serviceProvider.GetRequiredService(); + _seaExportCommonService = serviceProvider.GetRequiredService(); + _bookingSlotService = serviceProvider.GetRequiredService(); } #region 通过任务主键获取截止时间变更详情 @@ -210,136 +214,127 @@ namespace DS.WMS.Core.TaskPlat.Method } #endregion - #region 自动更新订单的截单日期并转发 - /// - /// 自动更新订单的截单日期并转发 - /// - /// 截止时间变更任务主键 - /// 返回回执 - public async Task AutoUpdateOrderCutDateAndTranmitToCustomer(long taskPKId) - { - SeaExportOrderExtension orderInfo = null; - - try - { - var queryRlt = await SearchAndMarkBookingOrder(taskPKId); - - if (!queryRlt.Succeeded) - { - throw new Exception(queryRlt.Message); - } - - orderInfo = queryRlt.Data; - - //更新海运出口截单时间 - var orderRlt = UpdateBookingOrderCutDate(taskPKId, orderInfo); - - //更新舱位的截单时间 - var slotRlt = UpdateBookingSlotCutDate(taskPKId, orderInfo); - - //如果没有配置批量,则按单票发送邮件 - //var rlt = await SendEmailToCustomer(taskPKId); - - //logger.LogInformation($"taskPKId={taskPKId} 推送邮件完成,结果:{JsonConvert.SerializeObject(rlt)}"); - - } - catch(Exception ex) - { - //Logger.Log(NLog.LogLevel.Info, $"taskPKId={taskPKId} 自动更新订单的截单日期并转发失败异常,原因:{ex.Message}"); - - return DataResult.Failed( $"自动更新订单的截单日期并转发失败,原因:{ex.Message}", MultiLanguageConst.Operation_Failed); - } - - return DataResult.Successed(string.Empty, MultiLanguageConst.OperationSuccess); - } - #endregion - #region 更新订舱截单时间 /// /// 更新订舱截单时间 /// /// 任务主键 - /// 相关海运出口订舱详情 /// 返回回执 - private async Task UpdateBookingOrderCutDate(long taskPKId, SeaExportOrderExtension orderInfo) + private async Task UpdateBookingOrderCutDate(long taskPKId) { var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - //任务不考虑OrgId,这里去掉 tenantDb.QueryFilter.Clear(); try { - var queryList = await tenantDb.Queryable() - .InnerJoin((a, b) => a.Id == b.TASK_ID) - .Where((a, b) => a.Id == taskPKId) - .Select((a, b) => new { Base = a, Cut = b }) - .ToListAsync(); - - //任务主键{taskPkId}无法获取业务信息 - if (queryList.Count == 0) - throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskBaseInfoFromTaskIdNull)), taskPKId)); - - List ids = new List { orderInfo.currOrder.Id }; + var entity = tenantDb.Queryable().Filter(null, true).First(a => a.TASK_ID == taskPKId); - var cutBase = queryList.FirstOrDefault().Cut; + var cutDetail = await tenantDb.Queryable().FirstAsync(a => a.P_ID == entity.Id); - var cutDetail = await tenantDb.Queryable().FirstAsync(a => a.P_ID == cutBase.Id); + var queryRlt = await _seaExportService.SearchOrderInfo(entity.MBL_NO); - if (orderInfo.splitOrMergeFlag == 1) + if (!queryRlt.Succeeded) { - if (orderInfo.otherOrderList.Count > 0) - ids.AddRange(orderInfo.otherOrderList.Select(a => a.Id).ToList()); + logger.LogInformation($"匹配订单信息失败 mblno={entity.MBL_NO},原因:{queryRlt.Message}"); - //Logger.Log(NLog.LogLevel.Info, $"截止时间变更主键{taskPKId} MBLNO={cutDetail.MBL_NO} 检索海运出口订单匹配到拆票信息 ids={string.Join(",", ids.ToArray())}"); + return DataResult.Failed($"匹配订单信息失败 mblno={entity.MBL_NO},原因:{queryRlt.Message}"); } - foreach (var id in ids) + var orderInfo = queryRlt.Data; + + if (orderInfo.currOrder.SplitOrMergeFlag == 1) { - StringBuilder doBuilder = new StringBuilder(); + List orderIdList = new List { orderInfo.currOrder.Id }; + + if (orderInfo.otherOrderList != null && orderInfo.otherOrderList.Count > 0) + orderIdList.AddRange(orderInfo.otherOrderList.Select(t => t.Id).ToList()); - var bookingInfo = await tenantDb.Queryable().FirstAsync(a => a.Id == id); + var orderList = tenantDb.Queryable().Filter(null, true).Where(a => orderIdList.Contains(a.Id)).ToList(); - if (bookingInfo != null) + foreach (var id in orderIdList) { + var currOrder = orderList.FirstOrDefault(b => b.Id == id); + + SeaExportOpenEditReq bkModel = new SeaExportOpenEditReq + { + Id = id, + }; + + StringBuilder doBuilder = new StringBuilder(); + if (cutDetail.VGM_CUT.HasValue) { - doBuilder.Append($"VGM CUT 原:{bookingInfo.VGMCloseDate} 新:{cutDetail.VGM_CUT.Value}"); - bookingInfo.VGMCloseDate = cutDetail.VGM_CUT.Value; + doBuilder.Append($"VGM CUT 原:{currOrder.VGMCloseDate} 新:{cutDetail.VGM_CUT.Value}"); + bkModel.VGMCloseDate = cutDetail.VGM_CUT.Value; } if (cutDetail.CY_CUTOFF.HasValue) { - doBuilder.Append($"CY CUT 原:{bookingInfo.ClosingDate} 新:{cutDetail.CY_CUTOFF.Value}"); + doBuilder.Append($"CY CUT 原:{currOrder.ClosingDate} 新:{cutDetail.CY_CUTOFF.Value}"); - bookingInfo.ClosingDate = cutDetail.CY_CUTOFF.Value; + bkModel.ClosingDate = cutDetail.CY_CUTOFF.Value; } if (cutDetail.SI_CUTOFF.HasValue) { - doBuilder.Append($"SI CUT 原:{bookingInfo.CloseDocDate} 新:{cutDetail.SI_CUTOFF.Value}"); + doBuilder.Append($"SI CUT 原:{currOrder.CloseDocDate} 新:{cutDetail.SI_CUTOFF.Value}"); - bookingInfo.CloseDocDate = cutDetail.SI_CUTOFF.Value; + bkModel.CloseDocDate = cutDetail.SI_CUTOFF.Value; } - tenantDb.Updateable(bookingInfo).UpdateColumns(it => new + var bkRlt = await _seaExportCommonService.SeaExportOpenEdit(bkModel); + + if (bkRlt.Succeeded) { - it.VGMCloseDate, - it.ClosingDate, - it.CloseDocDate - }).ExecuteCommand(); + logger.LogInformation($"taskPkId={taskPKId} 提单号{currOrder.MBLNO} 更新订舱数据成功 {doBuilder.ToString()}"); + } + } + } + else + { + SeaExportOpenEditReq bkModel = new SeaExportOpenEditReq + { + Id = orderInfo.currOrder.Id, + }; + + StringBuilder doBuilder = new StringBuilder(); + + if (cutDetail.VGM_CUT.HasValue) + { + doBuilder.Append($"VGM CUT 原:{orderInfo.currOrder.VGMCloseDate} 新:{cutDetail.VGM_CUT.Value}"); + bkModel.VGMCloseDate = cutDetail.VGM_CUT.Value; + } + + if (cutDetail.CY_CUTOFF.HasValue) + { + doBuilder.Append($"CY CUT 原:{orderInfo.currOrder.ClosingDate} 新:{cutDetail.CY_CUTOFF.Value}"); - //Logger.Log(NLog.LogLevel.Info, $"截止时间变更主键{taskPKId} id={id} mblno={bookingInfo.MBLNO} 更新订舱完毕 详情 {doBuilder.ToString()}"); + bkModel.ClosingDate = cutDetail.CY_CUTOFF.Value; + } + + if (cutDetail.SI_CUTOFF.HasValue) + { + doBuilder.Append($"SI CUT 原:{orderInfo.currOrder.CloseDocDate} 新:{cutDetail.SI_CUTOFF.Value}"); + + bkModel.CloseDocDate = cutDetail.SI_CUTOFF.Value; + } + + var bkRlt = await _seaExportCommonService.SeaExportOpenEdit(bkModel); + + if (bkRlt.Succeeded) + { + logger.LogInformation($"taskPkId={taskPKId} 提单号{entity.MBL_NO} 更新订舱数据成功 {doBuilder.ToString()}"); } } } - catch(Exception ex) + catch (Exception ex) { - //Logger.Log(NLog.LogLevel.Info, $"taskPKId={taskPKId} 自动更新订单的截单日期更新订舱异常,原因:{ex.Message}"); + logger.LogInformation($"taskPKId={taskPKId} 更新订单截止时间异常,原因:{ex.Message}"); - return DataResult.Failed($"自动更新订单的截单日期更新订舱,原因:{ex.Message}", MultiLanguageConst.Operation_Failed); + return DataResult.Failed($"更新订单截止时间异常,原因:{ex.Message}", MultiLanguageConst.OperationSuccess); } - return DataResult.Successed(string.Empty, MultiLanguageConst.OperationSuccess); + return DataResult.Successed("更新成功", MultiLanguageConst.OperationSuccess); } #endregion @@ -350,7 +345,7 @@ namespace DS.WMS.Core.TaskPlat.Method /// 任务主键 /// 相关海运出口订舱详情 /// 返回回执 - private async Task UpdateBookingSlotCutDate(long taskPKId, SeaExportOrderExtension orderInfo) + private async Task UpdateBookingSlotCutDate(long taskPKId) { var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); //任务不考虑OrgId,这里去掉 @@ -358,21 +353,15 @@ namespace DS.WMS.Core.TaskPlat.Method try { - var queryList = await tenantDb.Queryable() - .InnerJoin((a, b) => a.Id == b.TASK_ID) - .Where((a, b) => a.Id == taskPKId) - .Select((a, b) => new { Base = a, Cut = b }) - .ToListAsync(); - - //任务主键{taskPkId}无法获取业务信息 - if (queryList.Count == 0) - throw new Exception(string.Format(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.TaskBaseInfoFromTaskIdNull)), taskPKId)); + var entity = tenantDb.Queryable().Filter(null, true).First(a => a.TASK_ID == taskPKId); - var cutBase = queryList.FirstOrDefault().Cut; + var cutDetail = await tenantDb.Queryable().FirstAsync(a => a.P_ID == entity.Id); - var cutDetail = await tenantDb.Queryable().FirstAsync(a => a.P_ID == cutBase.Id); + var slotOrder = await tenantDb.Queryable().FirstAsync(a => a.SlotBookingNo == entity.MBL_NO); - var slotOrder = await tenantDb.Queryable().FirstAsync(a => a.SlotBookingNo == cutBase.MBL_NO); + var slotModel = new BookingSlotOpenEditReq { + Id = slotOrder.Id, + }; StringBuilder doBuilder = new StringBuilder(); @@ -381,55 +370,73 @@ namespace DS.WMS.Core.TaskPlat.Method if (cutDetail.VGM_CUT.HasValue) { doBuilder.Append($"VGM CUT 原:{slotOrder.VGMSubmissionCutDate} 新:{cutDetail.VGM_CUT.Value}"); - slotOrder.VGMSubmissionCutDate = cutDetail.VGM_CUT.Value; + slotModel.VGMSubmissionCutDate = cutDetail.VGM_CUT.Value; } if (cutDetail.CY_CUTOFF.HasValue) { doBuilder.Append($"CY CUT 原:{slotOrder.CYCutDate} 新:{cutDetail.CY_CUTOFF.Value}"); - slotOrder.CYCutDate = cutDetail.CY_CUTOFF.Value; + slotModel.CYCutDate = cutDetail.CY_CUTOFF.Value; } if (cutDetail.SI_CUTOFF.HasValue) { doBuilder.Append($"SI CUT 原:{slotOrder.SICutDate} 新:{cutDetail.SI_CUTOFF.Value}"); - slotOrder.SICutDate = cutDetail.SI_CUTOFF.Value; + slotModel.SICutDate = cutDetail.SI_CUTOFF.Value; } if (cutDetail.MANIFEST_CUT.HasValue) { doBuilder.Append($"MANIFEST CUT 原:{slotOrder.ManifestCutDate} 新:{cutDetail.MANIFEST_CUT.Value}"); - slotOrder.ManifestCutDate = cutDetail.MANIFEST_CUT.Value; + slotModel.ManifestCutDate = cutDetail.MANIFEST_CUT.Value; } - tenantDb.Updateable(slotOrder).UpdateColumns(it => new - { - it.VGMSubmissionCutDate, - it.CYCutDate, - it.SICutDate, - it.ManifestCutDate - }).ExecuteCommand(); + var bkRlt = await _bookingSlotService.BookingSlotOpenEdit(slotModel); - //Logger.Log(NLog.LogLevel.Info, $"截止时间变更主键{taskPKId} id={cutBase.Id} mblno={slotOrder.SlotBookingNo} 更新舱位完毕 详情 {doBuilder.ToString()}"); + if (bkRlt.Succeeded) + { + logger.LogInformation($"taskPkId={taskPKId} 提单号{entity.MBL_NO} 更新舱位数据成功 {doBuilder.ToString()}"); + } } } catch (Exception ex) { - //Logger.Log(NLog.LogLevel.Info, $"taskPKId={taskPKId} 自动更新订单的截单日期更新舱位异常,原因:{ex.Message}"); + logger.LogInformation($"taskPKId={taskPKId} 更新舱位截止时间异常,原因:{ex.Message}"); - return DataResult.Failed($"自动更新订单的截单日期更新舱位,原因:{ex.Message}", MultiLanguageConst.Operation_Failed); + return DataResult.Failed($"更新舱位截止时间异常,原因:{ex.Message}", MultiLanguageConst.OperationSuccess); } - return DataResult.Successed(string.Empty, MultiLanguageConst.OperationSuccess); + return DataResult.Successed("更新成功", MultiLanguageConst.OperationSuccess); } #endregion + #region 更新订单和舱位的截止时间 + /// + /// 更新订单和舱位的截止时间 + /// + /// 数据上下文 + /// + public async Task ModifyBookingOrderOrSlotTask(TaskFlowDataContext dataContext) + { + var taskPKId = dataContext.Get(TaskFlowDataNameConst.TaskPKId); + if (taskPKId == 0) + throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskPKId)}"); + + //更新订舱 + await UpdateBookingOrderCutDate(taskPKId); + + //更新舱位 + await UpdateBookingSlotCutDate(taskPKId); + return DataResult.Successed("更细成功"); + } + #endregion + #region 发送邮件通知给客户 /// /// 发送邮件通知给客户 diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageCutDateChangeController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageCutDateChangeController.cs index 46ca5bcf..d6f9af7e 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageCutDateChangeController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageCutDateChangeController.cs @@ -51,20 +51,6 @@ namespace DS.WMS.TaskApi.Controllers } #endregion - #region 自动更新订单的截单日期并转发 - /// - /// 自动更新订单的截单日期并转发 - /// - /// 截止时间变更任务主键 - /// 返回回执 - [HttpGet] - [Route("AutoUpdateOrderCutDateAndTranmitToCustomer")] - public async Task AutoUpdateOrderCutDateAndTranmitToCustomer([FromQuery] long taskPKId) - { - return await _taskManageCutDateChangeService.AutoUpdateOrderCutDateAndTranmitToCustomer(taskPKId); - } - #endregion - #region 发送邮件通知给客户 /// /// 发送邮件通知给客户 From 324edb3561045df05d64c75977a6c7ebc26b9227 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 30 Aug 2024 14:58:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?BC=E6=B5=81=E7=A8=8B=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/TaskFlowDataNameConst.cs | 7 +- .../TaskPlat/Method/TaskManageBCService.cs | 109 ++++++++++++++---- .../TaskPlat/Method/TaskManageBaseService.cs | 16 +-- .../TaskPlat/Method/TaskManageService.cs | 9 +- .../TaskPlat/Other/TaskFlowRuner.cs | 9 +- 5 files changed, 106 insertions(+), 44 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs index 4b91a49d..cb32dee3 100644 --- a/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/TaskFlowDataNameConst.cs @@ -38,9 +38,14 @@ /// /// BC对比订单后是否存在差异 /// - /// 类型: + /// 类型:CompareResultInfo public const string BcCompareWithSeaExportResult = "BcCompareWithSeaExportResult"; + /// + /// BC是否匹配到了海运出口订单 + /// + public const string BcIsMatchSeaExport = "BcIsMatchSeaExport"; + /// /// BC文件 /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs index 6d56ab35..60684f2d 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs @@ -1184,7 +1184,7 @@ namespace DS.WMS.Core.TaskPlat.Method SeaExport = seaExport, OpCtnList = seaExportCtnList }; - var result = await CompareBcWithSeaExport(compareDto); + CompareResultInfo result = await CompareBcWithSeaExport(compareDto); dataContext.Set(TaskFlowDataNameConst.BcCompareWithSeaExportResult, result); @@ -1345,14 +1345,23 @@ namespace DS.WMS.Core.TaskPlat.Method var taskBcInfo = dataContext.Get(TaskFlowDataNameConst.TaskBCInfo) ?? throw new ArgumentException($"缺少参数:{nameof(TaskFlowDataNameConst.TaskBCInfo)}"); var result = await BcMatchSeaExport(taskBcInfo); - if (result.Succeeded && result.Data != null) + if (result.Succeeded && result.Data != null && result.Data.Id != 0) { - dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data.Id!); + // BC是否匹配到了海运出口订单=>true + dataContext.Set(TaskFlowDataNameConst.BcIsMatchSeaExport, true); + + // 订单Id + dataContext.Set(TaskFlowDataNameConst.BusinessId, result.Data.Id); await tenantDb.Updateable() .SetColumns(x => x.BOOKING_ORDER_ID == result.Data.Id) .Where(x => x.Id == taskBcInfo.Id) .ExecuteCommandAsync(); + + await tenantDb.Updateable() + .SetColumns(x => x.OUT_BS_NO == result.Data.Id) + .Where(x => x.Id == taskBcInfo.TASK_ID) + .ExecuteCommandAsync(); } return result; } @@ -1362,6 +1371,7 @@ namespace DS.WMS.Core.TaskPlat.Method private async Task> BcMatchSeaExport(TaskBCInfo taskBcInfo) { var queryable = tenantDb.Queryable(); + if (taskBcInfo.BOOKING_ORDER_ID is not null or 0) { queryable.Where(x => x.Id == taskBcInfo.BOOKING_ORDER_ID); @@ -1402,7 +1412,7 @@ namespace DS.WMS.Core.TaskPlat.Method { // 更新订单 await tenantDb.Updateable().SetColumns(x => x.MBLNO == taskBcInfo.MBL_NO).Where(x => x.Id == seaExport.Id).ExecuteCommandAsync(); - + // 赋值 seaExport.MBLNO = taskBcInfo.MBL_NO; @@ -2592,6 +2602,10 @@ namespace DS.WMS.Core.TaskPlat.Method { return DataResult.Failed("未执行:当前任务状态为已完成,请重新查询"); } + if (waitBcTask.OUT_BS_NO == null) + { + return DataResult.Failed("未执行:当前任务的业务主键为null"); + } taskBcInfo.BOOKING_ORDER_ID = waitBcTask.OUT_BS_NO; // 获取订单信息 @@ -2738,6 +2752,7 @@ namespace DS.WMS.Core.TaskPlat.Method FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription() }; + // 存库 try { @@ -2757,6 +2772,20 @@ namespace DS.WMS.Core.TaskPlat.Method throw; } + var taskService = serviceProvider.GetRequiredService(); + var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest() + { + AutoCreateNext = false, + BusinessId = (long)waitBcTask.OUT_BS_NO, + BusinessType = BusinessType.OceanShippingExport, + TaskStatus = TaskStatusEnum.Complete, + TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString() + }); + if (!rlt.Succeeded) + { + logger.LogError("手动上传BC:设置收BC任务完成时失败,message:" + rlt.Message); + } + // 触发BC任务,执行自动化操作 TaskManageOrderBCInfo messageBcInfo = taskBcInfo.Adapt(); messageBcInfo.CtnList = ctnList.Adapt>(); @@ -2801,32 +2830,70 @@ namespace DS.WMS.Core.TaskPlat.Method /// 数据上下文 public async Task BCTaskCompleteThenNext(TaskFlowDataContext dataContext) { - var businessId = dataContext.Get(TaskFlowDataNameConst.BusinessId); - if (businessId == null || businessId == 0) + // 这里获取到的是获取BC任务的基础任务 + var taskBaseInfo = dataContext.Get(TaskFlowDataNameConst.TaskBaseInfo); + if (taskBaseInfo == null) { - Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}"); - return DataResult.Failed("未获取到订单Id"); + return DataResult.Failed("未获取到BC任务对象TaskBaseInfo"); + } + + await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now); + + if (taskBaseInfo.OUT_BS_NO is null or 0) + { + logger.LogError("BCTaskCompleteThenNext:BC任务对象TaskBaseInfo的OUT_BS_NO为空或0"); + return DataResult.Failed("任务对象的业务主键为空"); } else { - var taskService = serviceProvider.GetRequiredService(); - var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest() + var req = new TaskCreationRequest { - AutoCreateNext = true, - BusinessId = (long)businessId, + BusinessId = (long)taskBaseInfo.OUT_BS_NO, BusinessType = BusinessType.OceanShippingExport, - TaskStatus = TaskStatusEnum.Complete, - TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString() - }); - if (rlt.Succeeded) - { - return DataResult.Successed("BC任务已完成,并创建下一步任务"); - } - else + TaskTypeName = TaskBaseTypeEnum.WAIT_SPACE_RELEASE.ToString(), + }; + + CompareResultInfo? compareResult = dataContext.Get(TaskFlowDataNameConst.BcCompareWithSeaExportResult); + if (compareResult != null && compareResult.IsExistsDiff) { - return DataResult.Failed(rlt.Message); + req.TaskDescription = "未放舱原因:BC对比存在差异"; } + + var taskService = serviceProvider.GetRequiredService(); + var result = await taskService.CreateTaskAsync(req, false); + if (!result.Succeeded) + return DataResult.Failed("创建下一任务时返回错误:" + result.Message, result.MultiCode); } + return DataResult.Successed("BC任务已完成,并创建下一步任务"); + + /* + //之前这里结束的待收BC任务,后面改为结束BC任务 + //var businessId = dataContext.Get(TaskFlowDataNameConst.BusinessId); + //if (businessId == null || businessId == 0) + //{ + // Logger.Log(NLog.LogLevel.Info, $"执行BCTaskCompleteThenNext时,未获取到businessId:{businessId}"); + // return DataResult.Failed("未获取到订单Id"); + //} + //else + //{ + //var taskService = serviceProvider.GetRequiredService(); + //var rlt = await taskService.SetTaskStatusAsync(new TaskUpdateRequest() + // { + // AutoCreateNext = false, + // BusinessId = (long)businessId, + // BusinessType = BusinessType.OceanShippingExport, + // TaskStatus = TaskStatusEnum.Complete, + // TaskTypeName = TaskBaseTypeEnum.WAIT_BC.ToString() + // }); + // if (rlt.Succeeded) + // { + // return DataResult.Successed("BC任务已完成,并创建下一步任务"); + // } + // else + // { + // return DataResult.Failed(rlt.Message); + // } + //} */ } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs index e50f33f8..6c60ca37 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs @@ -520,28 +520,24 @@ namespace DS.WMS.Core.TaskPlat.Method .Where(t => t.Id == taskBaseId) .FirstAsync(); - return await SetTaskStatus(taskInfo, taskBaseTypeEnum, taskStatusEnum, statusTime, bsno); + return await SetTaskStatus(taskInfo, taskStatusEnum, statusTime, bsno); } /// /// 通过任务主表对象设置任务状态() /// /// 任务主表对象 - /// 业务类型 /// 业务状态 /// 状态发生时间 /// 业务主键 - protected async Task SetTaskStatus(TaskBaseInfo taskInfo, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, long? bsno = null) + public async Task SetTaskStatus(TaskBaseInfo taskInfo, TaskStatusEnum taskStatusEnum, DateTime? statusTime, long? bsno = null) { - SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - - if (taskInfo == null) + if (taskInfo is null) { - logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum:【{taskBaseTypeEnum}】未查询到任务"); - return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData))); + throw new ArgumentNullException(nameof(taskInfo)); } - logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString()); + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); // 修改任务的状态 taskInfo.STATUS = taskStatusEnum.ToString(); @@ -553,7 +549,7 @@ namespace DS.WMS.Core.TaskPlat.Method // 如果任务状态为已完成,则查询任务完成时任务对应模块的配置中要设置的业务状态,然后进行设置 if (taskStatusEnum == TaskStatusEnum.Complete && bsno != null) { - string? statusCode = await tenantDb.Queryable().Where(x => x.ModuleType == 2 && x.TaskType == taskBaseTypeEnum.ToString()).Select(x => x.BusinessStatusCode).FirstAsync(); + string? statusCode = await tenantDb.Queryable().Where(x => x.ModuleType == 2 && x.TaskType == taskInfo.TASK_TYPE).Select(x => x.BusinessStatusCode).FirstAsync(); if (!string.IsNullOrEmpty(statusCode)) { await seaExportCommonService.Value.SetGoodsStatus(statusCode, (long)bsno, tenantDb); 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 ee7ff2bd..f4b14458 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -136,7 +136,7 @@ namespace DS.WMS.Core.TaskPlat.Method return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData))); } - return await SetTaskStatus(taskInfo, taskBaseTypeEnum, taskStatusEnum, statusTime, bsno); + return await SetTaskStatus(taskInfo, taskStatusEnum, statusTime, bsno); } @@ -2112,13 +2112,6 @@ namespace DS.WMS.Core.TaskPlat.Method TASK_USER_STATUS_TIME = a.StatusTime }).Distinct().ToQueryPageAsync(querySearch.PageCondition); - //var sql = queryable.Select((t, a) => new - //{ - // PK_ID = t.Id.SelectAll(), - // TASK_USER_STATUS = a.Status, - // TASK_USER_STATUS_NAME = a.StatusName, - // TASK_USER_STATUS_TIME = a.StatusTime - //}).Distinct().ToSqlString(); return result; } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs index 3f169dce..5cdc68e7 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs @@ -109,7 +109,7 @@ namespace DS.WMS.Core.TaskPlat } if (targetConfig == null) { - throw new Exception("targetConfig目标流程意外为null"); + throw new Exception("targetConfig目标流程意外为null"); // 不会走到这里,至少会有一条流程匹配到 } // 待执行的流程(节点列表) @@ -192,10 +192,11 @@ namespace DS.WMS.Core.TaskPlat if (executeConfig == null) { - flowLog.IsComplete = false; - flowLog.IsSuccess = false; - flowLog.Note += $"【执行时未找到符合执行条件的节点,经判断条件的节点Id如下:{string.Join(',', waitMatchConfigList.Select(x => x.Id))}】"; + //调整:没有找到待执行的节点,不认为整个流程失败或者未完成 + //flowLog.IsComplete = false; + //flowLog.IsSuccess = false; + flowLog.Note += $"【执行时未找到符合执行条件的节点,经判断条件的节点Id如下:{string.Join(',', waitMatchConfigList.Select(x => x.Id))}】"; break; }