From 40565243865a3894dff45e61627dbd538ab84988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 23 Jul 2024 15:58:50 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B5=B7=E8=BF=90=E5=87=BA=E5=8F=A3?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Method/{Task => TaskInteraction}/SeaExportTaskService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ds-wms-service/DS.WMS.Core/Op/Method/{Task => TaskInteraction}/SeaExportTaskService.cs (88%) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/Task/SeaExportTaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs similarity index 88% rename from ds-wms-service/DS.WMS.Core/Op/Method/Task/SeaExportTaskService.cs rename to ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs index f69df8c5..8342c627 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/Task/SeaExportTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs @@ -1,6 +1,6 @@ using DS.WMS.Core.Fee.Method; -namespace DS.WMS.Core.Op.Method.Task +namespace DS.WMS.Core.Op.Method.TaskInteraction { /// /// 海运出口任务服务 From b6ca6a60025827a123c8062679e0b008640f2142 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 23 Jul 2024 16:59:19 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=961900-01-01=E7=AD=89=E5=BC=82=E5=B8=B8=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=85=B3=E7=B3=BB=E4=BA=BAId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Helpers/CustomContractResolver.cs | 6 +- .../Helpers/DatetimeJsonConverter.cs | 71 +++++++++++++++++++ .../Helpers/StringLongHelper.cs | 6 -- .../ServiceExtensions/DsAppWebInstall.cs | 2 + .../DS.Module.SqlSugar/SqlsugarInstall.cs | 2 +- .../Op/Dtos/BusinessOrderContactReq.cs | 4 ++ .../Op/Dtos/BusinessOrderContactRes.cs | 4 ++ 7 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 ds-wms-service/DS.Module.Core/Helpers/DatetimeJsonConverter.cs delete mode 100644 ds-wms-service/DS.Module.Core/Helpers/StringLongHelper.cs diff --git a/ds-wms-service/DS.Module.Core/Helpers/CustomContractResolver.cs b/ds-wms-service/DS.Module.Core/Helpers/CustomContractResolver.cs index 5a458bc1..0350626f 100644 --- a/ds-wms-service/DS.Module.Core/Helpers/CustomContractResolver.cs +++ b/ds-wms-service/DS.Module.Core/Helpers/CustomContractResolver.cs @@ -1,3 +1,4 @@ +using DS.Module.Core.Helpers; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; @@ -16,7 +17,10 @@ public class CustomContractResolver : CamelCasePropertyNamesContractResolver { return new JsonConverterLong(); } - + if (objectType == typeof(DateTime?) || objectType == typeof(DateTime)) + { + return new DatetimeJsonConverter(); + } return base.ResolveContractConverter(objectType); } } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.Core/Helpers/DatetimeJsonConverter.cs b/ds-wms-service/DS.Module.Core/Helpers/DatetimeJsonConverter.cs new file mode 100644 index 00000000..ee8835d3 --- /dev/null +++ b/ds-wms-service/DS.Module.Core/Helpers/DatetimeJsonConverter.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; + +namespace DS.Module.Core.Helpers +{ + /// + /// 时间转换 + /// + public class DatetimeJsonConverter : JsonConverter + { + /// + /// 是否可以转换 + /// + /// + /// + public override bool CanConvert(Type objectType) + { + return true; + } + + /// + /// 读json + /// + /// + /// + /// + /// + /// + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if ((reader.ValueType == null || reader.ValueType == typeof(DateTime?)) && reader.Value == null) + { + return null; + } + else + { + DateTime.TryParse(reader.Value != null ? reader.Value.ToString() : "", out DateTime value); + + return value; + } + } + + /// + /// 写json + /// + /// + /// + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + if (value == null) + writer.WriteValue(value); + else if (value != null) + { + var years = DateTime.Parse(value.ToString()).Year; + if (years == 1900|| years == 2000 || years == 1901 || years == 1970) + { + writer.WriteValue(""); + } + else + writer.WriteValue(value); + } + + } + } +} diff --git a/ds-wms-service/DS.Module.Core/Helpers/StringLongHelper.cs b/ds-wms-service/DS.Module.Core/Helpers/StringLongHelper.cs deleted file mode 100644 index 1469de9e..00000000 --- a/ds-wms-service/DS.Module.Core/Helpers/StringLongHelper.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace DS.Module.Core.Helpers -{ - public static class StringLongHelper - { - } -} \ No newline at end of file diff --git a/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs b/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs index 37dae804..ed9709f8 100644 --- a/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs +++ b/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs @@ -1,10 +1,12 @@ using DS.Module.Core; using DS.Module.Core.Filters; +using DS.Module.Core.Helpers; using FluentValidation.AspNetCore; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using System; namespace DS.Module.Core.ServiceExtensions; diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs index 96cc0a13..bab35f2b 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs @@ -206,7 +206,7 @@ public static class SqlsugarInstall } } if (entityInfo.PropertyName == "Deleted") - entityInfo.SetValue(false); + entityInfo.SetValue(false); } // 更新操作 diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactReq.cs index e7ab4e12..16fa7958 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactReq.cs @@ -46,6 +46,10 @@ namespace DS.WMS.Core.Op.Dtos /// public string CustomerName { get; set; } /// + /// 联系人ID + /// + public long CustomerContactId { get; set; } + /// /// 联系人 /// public string Name { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactRes.cs index 939743ec..89dc7018 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactRes.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BusinessOrderContactRes.cs @@ -44,6 +44,10 @@ namespace DS.WMS.Core.Op.Dtos /// public string CustomerName { get; set; } /// + /// 联系人ID + /// + public long CustomerContactId { get; set; } + /// /// 联系人 /// public string Name { get; set; } From e7a8c804703bec40d3d74c4cae7534a5197e4d63 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 23 Jul 2024 18:57:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=AF=B9=E8=B4=A6?= =?UTF-8?q?=E5=90=88=E8=AE=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CheckBillController.cs | 8 +- .../Check/Dtos/CheckBillBusinessRes.cs | 30 ++++++ .../DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs | 93 ++++++++++++++-- .../Check/Dtos/CheckBillTotalRes.cs | 101 ++++++++++++++++++ .../Check/Interface/ICheckBillService.cs | 4 +- .../Check/Method/CheckBillService.cs | 99 ++++++++++++++--- 6 files changed, 304 insertions(+), 31 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs create mode 100644 ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs diff --git a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs index 63e8363f..537930b1 100644 --- a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs +++ b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs @@ -57,9 +57,9 @@ public class CheckBillController : ApiController /// [HttpPost] [Route("GetCheckBillList")] - public DataResult> GetCheckBillList([FromBody] PageRequest request) + public async Task> GetCheckBillList([FromBody] PageRequest request) { - var res = _invokeService.GetCheckBillList(request); + var res = await _invokeService.GetCheckBillList(request); return res; } /// @@ -93,9 +93,9 @@ public class CheckBillController : ApiController /// [HttpPost] [Route("GetCheckBillBusinessList")] - public DataResult> GetCheckBillBusinessList([FromBody] PageRequest request) + public async Task> GetCheckBillBusinessList([FromBody] PageRequest request) { - var res = _invokeService.GetCheckBillBusinessList(request); + var res = await _invokeService.GetCheckBillBusinessList(request); return res; } diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs new file mode 100644 index 00000000..701003af --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs @@ -0,0 +1,30 @@ +using DS.WMS.Core.Check.View; +using DS.WMS.Core.Op.Dtos; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Check.Dtos +{ + /// + /// 客户对账业务明细 + /// + public class CheckBillBusinessRes + { + /// + /// 列表数据 + /// + public List List { get; set; } + + /// + /// 合计数 + /// + public int TotalCount { get; set; } + /// + /// 合计信息 + /// + public CheckBillTotalRes DataTotal { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs index b2f89e12..dadcabd0 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using DS.WMS.Core.Op.Dtos; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -50,37 +51,88 @@ namespace DS.WMS.Core.Check.Dtos /// /// RMB应收 /// - public decimal? RMBDR { get; set; } = 0; + public decimal RMBDR { get; set; } = 0; /// /// RMB应付 /// - public decimal? RMBCR { get; set; } = 0; + public decimal RMBCR { get; set; } = 0; /// /// USD应收 /// - public decimal? USDDR { get; set; } = 0; + public decimal USDDR { get; set; } = 0; /// /// USD应付 /// - public decimal? USDCR { get; set; } = 0; + public decimal USDCR { get; set; } = 0; /// /// RMB未收 /// - public decimal? BALRMBDR { get; set; } = 0; + public decimal BALRMBDR { get; set; } = 0; /// /// RMB未付 /// - public decimal? BALRMBCR { get; set; } = 0; + public decimal BALRMBCR { get; set; } = 0; /// /// USD未收 /// - public decimal? BALUSDDR { get; set; } = 0; + public decimal BALUSDDR { get; set; } = 0; /// /// USD未付 /// - public decimal? BALUSDCR { get; set; } = 0; + public decimal BALUSDCR { get; set; } = 0; + /// + /// 其他应收 + /// + public decimal OtherDR { get; set; } + /// + /// 其他应付 + /// + public decimal OtherCR { get; set; } + + + /// + /// 其他未收 + /// + public decimal BALOtherDR { get; set; } + /// + /// 其他未付 + /// + public decimal BALOtherCR { get; set; } + + /// + /// TTL应收 + /// + public decimal TTLDR { get; set; } + /// + /// TTL应付 + /// + public decimal TTLCR { get; set; } + /// + /// TTL未收 + /// + public decimal BALTTLDR { get; set; } + /// + /// TTL未付 + /// + public decimal BALTTLCR { get; set; } + /// + /// 开票RMB应收 + /// + public decimal OrderInvoiceRMBDR { get; set; } + /// + /// 开票USD应收 + /// + public decimal OrderInvoiceUSDDR { get; set; } + /// + /// 订单金额RMB应付 + /// + public decimal OrderAmountRMBCR { get; set; } + /// + /// 订单金额USD应付 + /// + public decimal OrderAmountUSDCR { get; set; } /// /// 对账时间 /// @@ -96,10 +148,31 @@ namespace DS.WMS.Core.Check.Dtos /// 对账人 /// - public string CreateByName { get; set; } + public string CreateUserName { get; set; } /// /// 备注 /// public string Note { get; set; } = ""; } + + /// + /// 客户对账列表返回 + /// + public class CheckBillListRes + { + /// + /// 列表数据 + /// + public List List { get; set; } + + /// + /// 合计数 + /// + public int TotalCount { get; set; } + /// + /// 合计信息 + /// + public CheckBillTotalRes DataTotal { get; set; } + + } } diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs new file mode 100644 index 00000000..95eaabe1 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Check.Dtos +{ + /// + /// 客户对账列表合计 + /// + public class CheckBillTotalRes + { + /// + /// RMB应收 + /// + public decimal RMBDR { get; set; } + /// + /// RMB应付 + /// + public decimal RMBCR { get; set; } + + /// + /// USD应收 + /// + public decimal USDDR { get; set; } + /// + /// USD应付 + /// + public decimal USDCR { get; set; } + + /// + /// RMB未收 + /// + public decimal BALRMBDR { get; set; } + /// + /// RMB未付 + /// + public decimal BALRMBCR { get; set; } + + /// + /// USD未收 + /// + public decimal BALUSDDR { get; set; } + /// + /// USD未付 + /// + public decimal BALUSDCR { get; set; } + /// + /// 其他应收 + /// + public decimal OtherDR { get; set; } + /// + /// 其他应付 + /// + public decimal OtherCR { get; set; } + + + /// + /// 其他未收 + /// + public decimal BALOtherDR { get; set; } + /// + /// 其他未付 + /// + public decimal BALOtherCR { get; set; } + + /// + /// TTL应收 + /// + public decimal TTLDR { get; set; } + /// + /// TTL应付 + /// + public decimal TTLCR { get; set; } + /// + /// TTL未收 + /// + public decimal BALTTLDR { get; set; } + /// + /// TTL未付 + /// + public decimal BALTTLCR { get; set; } + /// + /// 开票RMB应收 + /// + public decimal OrderInvoiceRMBDR { get; set; } + /// + /// 开票USD应收 + /// + public decimal OrderInvoiceUSDDR { get; set; } + /// + /// 订单金额RMB应付 + /// + public decimal OrderAmountRMBCR { get; set; } + /// + /// 订单金额USD应付 + /// + public decimal OrderAmountUSDCR { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs b/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs index d096ee5b..4fce7077 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs @@ -17,7 +17,7 @@ namespace DS.WMS.Core.Check.Interface /// /// /// - public DataResult> GetCheckBillList(PageRequest request); + public Task> GetCheckBillList(PageRequest request); /// @@ -31,7 +31,7 @@ namespace DS.WMS.Core.Check.Interface /// /// /// - public DataResult> GetCheckBillBusinessList(PageRequest request); + public Task> GetCheckBillBusinessList(PageRequest request); /// /// 客户对账明细对应费用列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs b/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs index 54f179e3..5a7a534a 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs @@ -18,6 +18,7 @@ using DS.WMS.Core.Op.View; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Method; +using LanguageExt.Common; using Mapster; using Microsoft.Extensions.DependencyInjection; using SqlSugar; @@ -86,16 +87,13 @@ namespace DS.WMS.Core.Check.Method .Where(whereList).Select() .ToQueryPage(request.PageCondition); return data; - } - - - + } /// /// 客户对账列表 /// /// /// - public DataResult> GetCheckBillList(PageRequest request) + public async Task> GetCheckBillList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var users = db.Queryable().Select(x => new { x.Id, x.UserName }).ToList(); @@ -116,10 +114,10 @@ namespace DS.WMS.Core.Check.Method queryData = queryData.Where(x => checkIds.Contains(x.Id)); } - var data = queryData.Mapper(it => + var result = queryData.Mapper(it => { var checkBillDetails = tenantDb.Queryable().Where(x => x.CheckId == it.Id).ToList(); - it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName; + //it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName; it.RMBDR = checkBillDetails.Sum(x => x.RMBDR); it.RMBCR = checkBillDetails.Sum(x => x.RMBCR); it.USDDR = checkBillDetails.Sum(x => x.USDDR); @@ -128,10 +126,52 @@ namespace DS.WMS.Core.Check.Method it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR); it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR); it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR); + it.OtherDR = checkBillDetails.Sum(x => x.OtherDR); + it.OtherCR = checkBillDetails.Sum(x => x.OtherCR); + it.BALOtherDR = checkBillDetails.Sum(x => x.BALOtherDR); + it.TTLDR = checkBillDetails.Sum(x => x.TTLDR); + it.TTLCR = checkBillDetails.Sum(x => x.TTLCR); + it.BALTTLDR = checkBillDetails.Sum(x => x.BALTTLDR); + it.BALTTLCR = checkBillDetails.Sum(x => x.BALTTLCR); + it.OrderInvoiceRMBDR = checkBillDetails.Sum(x => x.OrderInvoiceRMBDR); + it.OrderInvoiceUSDDR = checkBillDetails.Sum(x => x.OrderInvoiceUSDDR); + it.OrderAmountRMBCR = checkBillDetails.Sum(x => x.OrderAmountRMBCR); + it.OrderAmountUSDCR = checkBillDetails.Sum(x => x.OrderAmountUSDCR); } - ) - .ToQueryPage(request.PageCondition); - return data; + ); + var list = result.ToList(); + var data = await result.ToQueryPageAsync(request.PageCondition); + var totalData = new CheckBillTotalRes() + { + RMBDR = list.Sum(x => x.RMBDR), + RMBCR = list.Sum(x => x.RMBCR), + USDDR = list.Sum(x => x.USDDR), + USDCR = list.Sum(x => x.USDCR), + BALRMBDR = list.Sum(x => x.BALRMBDR), + BALRMBCR = list.Sum(x => x.BALRMBCR), + BALUSDDR = list.Sum(x => x.BALUSDDR), + BALUSDCR = list.Sum(x => x.BALUSDCR), + OtherDR = list.Sum(x => x.OtherDR), + OtherCR = list.Sum(x => x.OtherCR), + BALOtherDR = list.Sum(x => x.BALOtherDR), + TTLDR = list.Sum(x => x.TTLDR), + TTLCR = list.Sum(x => x.TTLCR), + BALTTLDR = list.Sum(x => x.BALTTLDR), + BALTTLCR = list.Sum(x => x.BALTTLCR), + OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR), + OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR), + OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR), + OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR), + }; + var res = new CheckBillListRes() + { + List = data.Data, + TotalCount = list.Count(), + DataTotal = totalData + }; + return await Task.FromResult(DataResult.Success(res, MultiLanguageConst.DataQuerySuccess)); + //.ToQueryPage(request.PageCondition); + //return data; } /// /// 详情 @@ -153,16 +193,45 @@ namespace DS.WMS.Core.Check.Method /// /// /// - public DataResult> GetCheckBillBusinessList(PageRequest request) + public async Task> GetCheckBillBusinessList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() - .Where(whereList) - .ToQueryPage(request.PageCondition); - return data; + var result = tenantDb.Queryable() + .Where(whereList); + var list = result.ToList(); + var data = await result.ToQueryPageAsync(request.PageCondition); + var totalData = new CheckBillTotalRes() + { + RMBDR = list.Sum(x => x.RMBDR), + RMBCR = list.Sum(x => x.RMBCR), + USDDR = list.Sum(x => x.USDDR), + USDCR = list.Sum(x => x.USDCR), + BALRMBDR = list.Sum(x => x.BALRMBDR), + BALRMBCR = list.Sum(x => x.BALRMBCR), + BALUSDDR = list.Sum(x => x.BALUSDDR), + BALUSDCR = list.Sum(x => x.BALUSDCR), + OtherDR = list.Sum(x => x.OtherDR), + OtherCR = list.Sum(x => x.OtherCR), + BALOtherDR = list.Sum(x => x.BALOtherDR), + TTLDR = list.Sum(x => x.TTLDR), + TTLCR = list.Sum(x => x.TTLCR), + BALTTLDR = list.Sum(x => x.BALTTLDR), + BALTTLCR = list.Sum(x => x.BALTTLCR), + OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR), + OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR), + OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR), + OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR), + }; + var res = new CheckBillBusinessRes() + { + List = data.Data, + TotalCount = list.Count(), + DataTotal = totalData + }; + return await Task.FromResult(DataResult.Success(res, MultiLanguageConst.DataQuerySuccess)); } /// From ac190326a6447f2218d99b8f32bd625b075601de Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Tue, 23 Jul 2024 19:08:56 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BC=96=E6=8E=92?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=97=A5=E5=BF=97=E8=B0=83=E6=95=B4=E3=80=81?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Entity/TaskFlowLogDetail.cs | 8 ++++- .../TaskPlat/Other/TaskFlowRuner.cs | 31 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowLogDetail.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowLogDetail.cs index c175b01a..0901fdc0 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowLogDetail.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskFlowLogDetail.cs @@ -29,10 +29,16 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarColumn(ColumnDescription = "执行模块主键")] public long ModuleId { get; set; } + /// + /// 执行模块名称 + /// + [SugarColumn(ColumnDescription = "执行模块名称", IsNullable = true, Length = 255)] + public string? ModuleName { get; set; } + /// /// 原始数据内容 /// - [SugarColumn(ColumnDescription = "原始数据内容", IsNullable = true)] + [SugarColumn(ColumnDescription = "原始数据内容", IsNullable = true, Length = 255)] public string? OriginDataContext { get; set; } ///// 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 4af2248c..c4cbd916 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Other/TaskFlowRuner.cs @@ -97,32 +97,49 @@ namespace DS.WMS.Core.TaskPlat valStr = obj.ToString(); } + var oldValue = configMatchCount[configItem.Id]; if (conditionItem.MatchType == 1) { if (valStr?.Equals(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true) { - configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1; + configMatchCount[configItem.Id] = oldValue + 1; + } + else + { + configMatchCount[configItem.Id] = oldValue - 1; } } else if (conditionItem.MatchType == 2) { if (valStr?.Contains(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true) { - configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1; + configMatchCount[configItem.Id] = oldValue + 1; + } + else + { + configMatchCount[configItem.Id] = oldValue - 1; } } else if (conditionItem.MatchType == 3) { if (valStr?.StartsWith(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true) { - configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1; + configMatchCount[configItem.Id] = oldValue + 1; + } + else + { + configMatchCount[configItem.Id] = oldValue - 1; } } else if (conditionItem.MatchType == 4) { if (valStr?.EndsWith(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true) { - configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1; + configMatchCount[configItem.Id] = oldValue + 1; + } + else + { + configMatchCount[configItem.Id] = oldValue - 1; } } } @@ -207,17 +224,19 @@ namespace DS.WMS.Core.TaskPlat { throw new Exception($"未找到指定流程配置,ExecuteModuleId:{configItem.ExecuteModuleId}"); } + + flowLogDetail.ModuleId = module.Id; + flowLogDetail.ModuleName = module.Name; + Assembly assembly; if (module.AssemblyName!.StartsWith("DS.WMS.Core")) { - //assembly = Assembly.GetEntryAssembly()!; assembly = Assembly.GetExecutingAssembly(); } else { assembly = Assembly.Load(module.AssemblyName!); } - //var interfaceType2 = assembly.GetType(module.InterfaceName!); var interfaceType = assembly.DefinedTypes.FirstOrDefault(x => x.Name == module.InterfaceName!); if (interfaceType == null) { From 4cb8276178b77e6f1d954cf3bfa5c0cd54bf8922 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Tue, 23 Jul 2024 19:09:49 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9A=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=88=9B=E5=BB=BA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E3=80=81=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/TaskPlat/TaskBaseTypeEnum.cs | 116 +++++++++++++----- .../Enums/TaskPlat/TaskSourceEnum.cs | 8 +- .../Dtos/TaskManageOrderMessageHeadInfo.cs | 5 + .../TaskPlat/Entity/TaskBaseInfo.cs | 6 + .../TaskPlat/Interface/ITaskManageService.cs | 10 ++ .../TaskPlat/Method/TaskManageService.cs | 93 ++++++++------ .../Controllers/TaskManageController.cs | 12 ++ 7 files changed, 183 insertions(+), 67 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs index d740bd20..f5796c0b 100644 --- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs @@ -11,175 +11,229 @@ namespace DS.Module.Core /// 重要提醒 /// [Description("重要提醒")] - CAUTION_NOTICE, + CAUTION_NOTICE = 0, /// /// BC /// [Description("BC")] - BC, + BC = 1, /// /// DRAFT /// [Description("DRAFT")] - DRAFT, + DRAFT = 2, /// /// Cancellation 订舱取消 /// [Description("Cancellation")] - CANCELLATION, + CANCELLATION = 3, /// /// SEAWAY BILL下载 /// [Description("SEAWAY BILL")] - SEAWAYBILL_DOWN, + SEAWAYBILL_DOWN = 4, /// /// 提单正本下载 /// [Description("提单正本下载")] - ORIGINAL_DOWN, + ORIGINAL_DOWN = 5, /// /// 未装载 /// [Description("未装载")] - NOT_LOADED, + NOT_LOADED = 6, /// /// 未装船 /// [Description("未装船")] - NOT_SHIPMENG, + NOT_SHIPMENG = 7, /// /// 航次账单邮件 /// [Description("航次账单")] - INVOICE_BILL_MAIL, + INVOICE_BILL_MAIL = 8, /// /// VGM对比 /// [Description("VGM对比")] - VGM_COMPARE, + VGM_COMPARE = 9, /// /// 电放通知 /// [Description("电放通知")] - TELEX_NOTICE, + TELEX_NOTICE = 10, /// /// SI回执 /// [Description("SI回执")] - SI_FEEDBACK, + SI_FEEDBACK = 11, /// /// 单票账单 /// [Description("单票账单")] - PER_BILL, + PER_BILL = 12, /// /// 换船通知 /// [Description("换船通知")] - CHANGE_SHIP, + CHANGE_SHIP = 13, /// /// 取消换船通知 /// [Description("取消换船通知")] - ABORT_CHANGE_SHIP, + ABORT_CHANGE_SHIP = 14, /// /// 下货纸 /// [Description("下货纸")] - SHIPPING_ORDER, + SHIPPING_ORDER = 15, /// /// 正本缺失 /// [Description("正本缺失")] - ORIGINAL_LOST, + ORIGINAL_LOST = 16, /// /// VGM异常 /// [Description("VGM异常")] - VGM_EXCEPT, + VGM_EXCEPT = 17, /// /// 比对下货纸 /// [Description("比对下货纸")] - SHIPPING_ORDER_COMPARE, + SHIPPING_ORDER_COMPARE = 18, /// /// 派车 /// [Description("派车")] - TRUCK_DISPATCH, + TRUCK_DISPATCH = 19, /// /// Booking Amendment /// [Description("Amendment")] - BC_MODIFY, + BC_MODIFY = 20, /// /// 截止时间变更通知 /// [Description("截止时间变更")] - CUT_MODIFY, + CUT_MODIFY = 21, /// /// Rolling Nomination(预甩货通知) /// [Description("RollingNomination")] - ROLLING_NOMINATION, + ROLLING_NOMINATION = 22, /// /// Transfer Nomination(预甩货通知) /// [Description("TransferNomination")] - TRANSFER_NOMINATION, + TRANSFER_NOMINATION = 23, /// /// VGM回执 /// [Description("VGM回执")] - VGM_FEEDBACK, + VGM_FEEDBACK = 24, /// /// VGM未提交 /// [Description("VGM未提交")] - VGM_MISSING, + VGM_MISSING = 25, /// /// 目的港未提货 /// [Description("目的港未提货")] - POD_DISCHARGE_FULL, + POD_DISCHARGE_FULL = 26, /// /// 目的港未返空箱 /// [Description("目的港未返空箱")] - POD_GATEOUT_FULL, + POD_GATEOUT_FULL = 27, /// /// 航线截止时间调整 /// [Description("航线截止时间调整")] - ROUTE_CUT_CHANGE, + ROUTE_CUT_CHANGE = 28, /// /// 装货港未提箱 /// [Description("装货港未提箱")] - POL_CTN_NOT_PICKUP, + POL_CTN_NOT_PICKUP = 29, /// /// 运输计划已变更 /// [Description("运输计划已变更")] - TRNAS_PLAN_HAS_CHANGE, + TRNAS_PLAN_HAS_CHANGE = 30, + + + + + /// + /// 待审单 + /// + [Description("待审单")] + WAIT_ORDER_AUDIT = 31, + /// + /// 待收BC + /// + [Description("待收BC")] + WAIT_BC = 32, + /// + /// 待订舱 + /// + [Description("待订舱")] + WAIT_BOOKING = 33, + /// + /// 待放舱 + /// + [Description("待放舱")] + WAIT_SPACE_RELEASE = 34, + /// + /// 待提单确认 + /// + [Description("待提单确认")] + WAIT_BILL_CONFIRM = 35, + /// + /// 待提交SI + /// + [Description("待提交SI")] + WAIT_SI = 36, + /// + /// 待处理Draft + /// + [Description("待处理Draft")] + WAIT_DRAFT = 37, + /// + /// 待签出提单 + /// + [Description("待签出提单")] + WAIT_CHECKOUT_BILL = 38, + /// + /// 待派车 + /// + [Description("待派车")] + WAIT_TRUCK_DISPATCH = 39, + /// + /// 待提交VGM + /// + [Description("待提交VGM")] + WAIT_VGM = 40 } } diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs index 582e8fd8..05ea112c 100644 --- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs @@ -59,6 +59,12 @@ namespace DS.Module.Core /// 系统 /// [Description("系统")] - SYSTEM + SYSTEM, + + /// + /// 工作流 + /// + [Description("系统")] + WORK_FLOW, } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageHeadInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageHeadInfo.cs index 3b7b1cf6..b0e8dda4 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageHeadInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageHeadInfo.cs @@ -13,6 +13,11 @@ namespace DS.WMS.Core.TaskPlat.Dtos ///08dabd4e-dcc3-471a-8031-cf066ed0a8f4 public string GID { get; set; } = Guid.NewGuid().ToString(); + /// + /// 业务主键 + /// + public long? BSNO { get; set; } + /// /// 报文类型 TASK-任务 /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs index 4bdc780f..e87ff106 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs @@ -65,6 +65,12 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarColumn(ColumnDescription = "外业务类型 BOOK_ORDER-订舱 MAIL_RECV-邮件接收", IsNullable = true, Length = 40)] public string? OUT_BUSI_TYPE { get; set; } + /// + /// 外业务主键 + /// + [SugarColumn(ColumnDescription = "外业务主键", IsNullable = true)] + public long? OUT_BS_NO { get; set; } + /// /// 基础业务类型 /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs index e57e4d51..c24b8811 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -20,5 +20,15 @@ namespace DS.WMS.Core.TaskPlat.Interface /// /// 返回回执 Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null); + + + /// + /// 设置任务状态 + /// + /// 业务主键 + /// 业务类型 + /// 业务状态 + /// 状态发生时间 + Task SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime); } } 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 55e7ac6a..8c47d9d0 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -41,6 +41,40 @@ namespace DS.WMS.Core.TaskPlat.Method this.environment = environment; //_codeCtnService = codeCtnService; } + /// + /// 设置任务状态 + /// + /// 业务主键 + /// 业务类型 + /// 业务状态 + /// 状态发生时间 + public async Task SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime) + { + SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + TaskBaseInfo taskInfo = await tenantDb.Queryable() + .OrderByDescending(a => a.CreateTime) + .FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_BASE_TYPE == taskBaseTypeEnum.ToString()); + + if (taskInfo == null) + { + _logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum:【{taskBaseTypeEnum}】未查询到任务"); + return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData))); + } + + _logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString()); + taskInfo.STATUS = taskStatusEnum.ToString(); + + await tenantDb.Updateable(taskInfo).UpdateColumns(x => new + { + x.UpdateBy, + x.UpdateTime, + x.UpdateUserName, + x.STATUS + }).ExecuteCommandAsync(); + + return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess))); + } public async Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null) { @@ -55,22 +89,35 @@ namespace DS.WMS.Core.TaskPlat.Method SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - var taskInfo = await tenantDb.Queryable() - .OrderByDescending(a => a.CreateTime) - .FirstAsync(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}"); + TaskBaseInfo taskInfo = null; - _logger.LogInformation("批次={no} 接收到创建任务报文 结束查询任务 {msg}", batchNo, taskInfo == null ? "不存在" : "存在"); + // 如果业务主键不为空,则通过业务主键进行重复判断 + if (info.Head.BSNO is not null or 0) + { + taskInfo = await tenantDb.Queryable() + .OrderByDescending(a => a.CreateTime) + .FirstAsync(t => t.OUT_BS_NO == info.Head.BSNO); + } + // 否则通过Head.GID进行判断 + else + { + taskInfo = await tenantDb.Queryable() + .OrderByDescending(a => a.CreateTime) + .FirstAsync(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}"); - /* - 只要任务最后一次处理任务的状态是已取消、已完成,就可以重入新的任务 - */ - if (taskInfo != null && taskInfo.STATUS != TaskStatusEnum.Cancel.ToString() && taskInfo.STATUS != TaskStatusEnum.Complete.ToString()) + } + + // 只要任务最后一次处理任务的状态是已取消、已完成,就可以重入新的任务 + if (taskInfo != null + && taskInfo.STATUS != TaskStatusEnum.Cancel.ToString() + && taskInfo.STATUS != TaskStatusEnum.Complete.ToString()) { _logger.LogInformation("批次={no} 状态已存在,不能重复创建任务 status={status}", batchNo, taskInfo.STATUS); - - //throw new Exception($"状态已存在,不能重复创建任务"); + throw new Exception($"状态已存在,不能重复创建任务"); } + _logger.LogInformation("批次={no} 接收到创建任务报文 结束查询任务 {msg}", batchNo, taskInfo == null ? "不存在" : "存在"); + //如果文件路径不为空 判断文件是否真实存在 if (!string.IsNullOrWhiteSpace(info.Main.FilePath) && !File.Exists(info.Main.FilePath)) { @@ -108,7 +155,7 @@ namespace DS.WMS.Core.TaskPlat.Method CUSTOMER_NAME = info.Main.CustomerName, BATCH_STATIC = info.Main.BatchStatic, DJYUserId = info.Head.DJYUserId, - + OUT_BS_NO = info.Head.BSNO, }; long taskReqUserId = 0; @@ -588,30 +635,6 @@ namespace DS.WMS.Core.TaskPlat.Method #region 私有方法 - static object? GetNestedDynamicPropertyValue(dynamic obj, string propertyPath) - { - var properties = propertyPath.Split('.'); - dynamic currentObj = obj; - foreach (var property in properties) - { - if (currentObj is IDictionary dictionary) - { - if (dictionary.TryGetValue(property, out var value)) - { - currentObj = value; - } - else - { - return null; - } - } - else - { - return null; - } - } - return currentObj; - } /// /// 保存文件并返回文件完整路径 diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs index 3308288f..1c2e4305 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -54,6 +54,18 @@ public class TaskManageController : ApiController return result; } + + /// + /// 设置任务状态 + /// + [HttpPost("SetTaskStatus")] + [ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous] + public async Task SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime) + { + var result = await taskManageService.SetTaskStatus(bsno, taskBaseTypeEnum, taskStatusEnum, statusTime); + return result; + } + // /TaskManage/CreateBCTaskJob // /TaskManage/CreateDRAFTTaskJob // /TaskManage/CreateAdvisoryTaskJob