From ef4edfc11423ed38ae4028db8219f6e6d2124340 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 18 Apr 2023 09:30:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=80=E6=9D=A5?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingTruck.cs | 5 + .../BookingTruck/BookingTruckService.cs | 161 ++++++++++++------ .../BookingTruck/Dtos/BookingTruckCtnDto.cs | 12 ++ .../Service/Para/Interface/IParaService.cs | 12 +- Myshipping.Core/Myshipping.Core.xml | 18 ++ .../Service/DjyCustomer/DjyCustomerService.cs | 62 +++++++ .../DjyCustomer/IDjyCustomerService.cs | 9 + 7 files changed, 225 insertions(+), 54 deletions(-) diff --git a/Myshipping.Application/Entity/BookingTruck.cs b/Myshipping.Application/Entity/BookingTruck.cs index a7f58a81..85ea64bc 100644 --- a/Myshipping.Application/Entity/BookingTruck.cs +++ b/Myshipping.Application/Entity/BookingTruck.cs @@ -211,5 +211,10 @@ namespace Myshipping.Application.Entity /// [Description("派车流水号")] public string TruckFlowNo { get; set; } + /// + /// 任务流水号 + /// + [Description("任务流水号")] + public string TaskNo { get; set; } } } diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 34d1d715..02f4d6fb 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -65,71 +65,84 @@ namespace Myshipping.Application try { - BookingTruck entity = info.Adapt(); + var id = InnerSave(info); - if(entity == null) - throw Oops.Oh($"派车信息不能为空"); + result.succ = true; + result.msg = "保存成功"; + result.ext = id; + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"保存派车异常,原因:{ex.Message}"; + } - List entityCtnList = info.ContaList.Adapt>(); + return result; + } - if (entity.Id == 0) - { - _bookingTruckRepository.Insert(entity); - if (entityCtnList.Count > 0) - { - entityCtnList.ForEach(async ctn => - { - ctn.TruckId = entity.Id; + /// + /// 保存内部方法 + /// + /// 派车信息 + /// 返回派车Id + private async Task InnerSave(BookingTruckDto info) + { + BookingTruck entity = info.Adapt(); - await _bookingTruckContaRepository.InsertAsync(ctn); - }); - } - } - else + if (entity == null) + throw Oops.Oh($"派车信息不能为空"); + + List entityCtnList = info.ContaList.Adapt>(); + + if (entity.Id == 0) + { + _bookingTruckRepository.Insert(entity); + + if (entityCtnList.Count > 0) { - await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new - { - it.TenantId, - it.CreatedTime, - it.CreatedUserId, - it.CreatedUserName, - it.IsDeleted, - it.BookingId, - it.TruckId, - it.TruckName, - it.TruckCode, - }).ExecuteCommandAsync(); - - if (entityCtnList.Count > 0) + entityCtnList.ForEach(async ctn => { - entityCtnList.ForEach(async ctn => - { - ctn.TruckId = entity.Id; + ctn.TruckId = entity.Id; - await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new - { - it.TenantId, - it.CreatedTime, - it.CreatedUserId, - it.CreatedUserName, - it.IsDeleted, - }).ExecuteCommandAsync(); - }); - } + await _bookingTruckContaRepository.InsertAsync(ctn); + }); } - - result.succ = true; - result.msg = "保存成功"; - result.ext = entity.Id; } - catch (Exception ex) + else { - result.succ = false; - result.msg = $"保存派车异常,原因:{ex.Message}"; + await _bookingTruckRepository.AsUpdateable(entity).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.CreatedUserId, + it.CreatedUserName, + it.IsDeleted, + it.BookingId, + it.TruckId, + it.TruckName, + it.TruckCode, + }).ExecuteCommandAsync(); + + if (entityCtnList.Count > 0) + { + entityCtnList.ForEach(async ctn => + { + ctn.TruckId = entity.Id; + + await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new + { + it.TenantId, + it.CreatedTime, + it.CreatedUserId, + it.CreatedUserName, + it.IsDeleted, + }).ExecuteCommandAsync(); + }); + } } - return result; + return entity.Id; } /// @@ -472,11 +485,19 @@ namespace Myshipping.Application try { + var model = InnerCreateTruckFromBookingOrder(bookingId); + result.succ = true; + + if (model != null && model.ContaList != null && model.ContaList.Count > 0) + { + result.ext = model.ContaList; + } } catch (Exception ex) { - + result.succ = false; + result.msg = $"引入订舱详情生成派车信息异常,原因:{ex.Message}"; } return result; @@ -492,9 +513,21 @@ namespace Myshipping.Application { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + /* + 提交派车流程 + 1、先保存一遍派车信息。(需校验当前派车信息未提交,只有暂存的才能保存) + 2、调取派车任务接口推送派车任务。 + 3、派车任务推送成功后更新状态、任务ID。 + 4、返回结果。 + */ try { + //先保存 + var id = InnerSave(info); + + //更新派车订单为已提交 + //推送新增派车任务接口 } catch (Exception ex) { @@ -514,6 +547,13 @@ namespace Myshipping.Application { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + /* + 批量提交派车流程 + 1、需校验当前派车信息未提交 + 2、调取派车任务接口推送派车任务。 + 3、派车任务推送成功后更新状态、任务ID。 + 4、返回结果。 + */ try { @@ -534,6 +574,14 @@ namespace Myshipping.Application [HttpGet("/BookingTruck/Cancel")] public async Task Cancel(long id) { + /* + 撤销派车流程 + 1、确定当前派车已提交。 + 2、调取取消派车任务接口,申请撤销派车。 + 3、取消派车推送成功后更新状态。 + 4、返回结果。 + */ + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); try @@ -557,6 +605,13 @@ namespace Myshipping.Application { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + /* + 批量撤销派车流程 + 1、确定当前派车已提交。 + 2、调取取消派车任务接口,申请撤销派车。 + 3、取消派车推送成功后更新状态。 + 4、返回结果。 + */ try { diff --git a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckCtnDto.cs b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckCtnDto.cs index be0e14f5..78cc8562 100644 --- a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckCtnDto.cs +++ b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckCtnDto.cs @@ -96,5 +96,17 @@ namespace Myshipping.Application /// 备注 /// public string REMARK { get; set; } + /// + /// 车牌号 + /// + public string CarNumber { get; set; } + /// + /// 司机 + /// + public string CarDriver { get; set; } + /// + /// 司机电话 + /// + public string CarDriverTel { get; set; } } } diff --git a/Myshipping.Application/Service/Para/Interface/IParaService.cs b/Myshipping.Application/Service/Para/Interface/IParaService.cs index aced3e8e..0383d7cc 100644 --- a/Myshipping.Application/Service/Para/Interface/IParaService.cs +++ b/Myshipping.Application/Service/Para/Interface/IParaService.cs @@ -1,4 +1,5 @@ -using System; +using Myshipping.Core.Service; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -116,5 +117,14 @@ namespace Myshipping.Application /// 约号参数台账查询请求 /// 返回结果 Task GetParaContractNoPageAsync(QueryParaContractNoDto QuerySearch); + + /// + /// 检索车队参数 + /// + /// 检索值 + /// 检索类型 fleet-车队(默认);customs_broker-报关行 + /// 默认最大行数 + /// 返回回执 + //Task> QuerytDjyCustomerInfo(string queryItem, string queryType = "fleet", int top = 10); } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 3b4501bd..7bd1eef8 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -9922,6 +9922,15 @@ 类型,参考字典参数:客户属性(djy_cust_prop) + + + 检索往来单位(包含车队) + + 检索值 + 检索类型数组(可传多个) fleet-车队;customs_broker-报关行 + 默认最大行数 + 返回回执 + 订舱客户联系人输出参数 @@ -10772,6 +10781,15 @@ 服务项目 + + + 检索车队参数 + + 检索值 + 检索类型数组(可传多个) fleet-车队;customs_broker-报关行 + 默认最大行数 + 返回回执 + 钉钉客服通知群配置服务 diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs index f03806aa..9c28f78d 100644 --- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs @@ -11,6 +11,9 @@ using System.Collections.Generic; using Furion.FriendlyException; using Furion.Logging; using Microsoft.Extensions.Logging; +using System; +using System.Text.RegularExpressions; +using NPOI.Util; namespace Myshipping.Core.Service { @@ -203,5 +206,64 @@ namespace Myshipping.Core.Service return entities.XnPagedResult(); } + /// + /// 检索往来单位(包含车队) + /// + /// 检索值 + /// 检索类型数组(可传多个) fleet-车队;customs_broker-报关行 + /// 默认最大行数 + /// 返回回执 + [HttpGet("/DjyCustomer/QuerytDjyCustomerInfo")] + public async Task> QuerytDjyCustomerInfo([FromQuery] string queryItem, [FromQuery] string[] queryType, [FromQuery] int top = 10) + { + List list = new List(); + + try + { + string sqlWhere = "1=1"; + + if (!string.IsNullOrWhiteSpace(queryItem)) + { + sqlWhere += $" and (CodeName like '%{queryItem.Trim()}%' or ShortName like '%{queryItem.Trim()}%' or FullName like '%{queryItem.Trim()}%')"; + } + + if (queryType.Length > 0) + { + sqlWhere += $" and PropString REGEXP '" + string.Join("|", queryType) + "'"; + } + + var entityList = await _rep.AsQueryable().Where(sqlWhere).Take(top).OrderBy(a => a.FullName) + .ToListAsync(); + + if (entityList.Count > 0) + { + list = entityList.Adapt>(); + + var custsArg = list.Select(a => a.Id).ToArray(); + var contactList = _repContact.AsQueryable() + .Where(a => custsArg.Contains(a.CustomerId.Value)).ToList(); + + list = list.GroupJoin(contactList, l => l.Id, r => r.CustomerId.Value, (l, r) => + { + var curList = r.ToList(); + + if (curList.Count > 0) + l.Contacts = curList.Adapt>(); + + return l; + + }).ToList(); + } + + } + catch (Exception ex) + { + _logger.LogError("检索车队异常,请求:queryItem={0};queryType={1};top={2} 异常:{3}", queryItem, queryType, top, ex.Message); + + throw Oops.Bah("检索车队异常,异常{msg}", ex.Message); + } + + return list; + } } } diff --git a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs index ed6fed09..6f455931 100644 --- a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs @@ -15,5 +15,14 @@ namespace Myshipping.Core.Service Task Detail([FromQuery] GetDjyCustomerInput input); //Task List([FromQuery] QueryBookingCustomerInput input); Task> ListContact(long customerId); + + /// + /// 检索车队参数 + /// + /// 检索值 + /// 检索类型数组(可传多个) fleet-车队;customs_broker-报关行 + /// 默认最大行数 + /// 返回回执 + Task> QuerytDjyCustomerInfo(string queryItem, string[] queryType, int top = 10); } } From e2ba515a52f3dd08f7cce74213e84d6106812ad8 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 18 Apr 2023 09:38:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=B4=A7?= =?UTF-8?q?=E7=BA=B8=E6=AF=94=E5=AF=B9=EF=BC=8C=E8=AE=A2=E8=88=B1=E4=B8=BB?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=AF=94=E5=AF=B9=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingOrder.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Myshipping.Application/Entity/BookingOrder.cs b/Myshipping.Application/Entity/BookingOrder.cs index 68d16190..a92f1d71 100644 --- a/Myshipping.Application/Entity/BookingOrder.cs +++ b/Myshipping.Application/Entity/BookingOrder.cs @@ -876,6 +876,11 @@ namespace Myshipping.Application.Entity /// public string LstShipOrderCompareRltName { get; set; } + /// + /// 最后下货纸比对方式 MANUAL-手动 AUTO-自动 + /// + public string LstShipOrderCompareMode { get; set; } + /// /// 是否占舱 /// From a6be1d9a393012a5c258b14cb5577ac7ff533b8f Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 18 Apr 2023 09:43:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=B4=A7?= =?UTF-8?q?=E7=BA=B8=E6=AF=94=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Service/DataSync/DataSyncService.cs | 6 ++++-- .../TaskManagePlat/TaskShippingOrderCompareService.cs | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index e1466397..376f3808 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -359,7 +359,8 @@ namespace Myshipping.Application it.LstShipOrderCompareId, it.LstShipOrderCompareDate, it.LstShipOrderCompareRlt, - it.LstShipOrderCompareRltName + it.LstShipOrderCompareRltName, + it.LstShipOrderCompareMode }).ExecuteCommandAsync(); //记录日志 @@ -975,7 +976,8 @@ namespace Myshipping.Application it.CreatedUserName, it.LstShipOrderCompareId, it.LstShipOrderCompareDate, - it.LstShipOrderCompareRltName + it.LstShipOrderCompareRltName, + it.LstShipOrderCompareMode }).ExecuteCommandAsync(); var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == main.Id).Select(x => x.Id).ToListAsync(); await _repCtn.DeleteAsync(x => x.BILLID == main.Id); diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs index 3240deb2..f8e2a647 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs @@ -135,8 +135,12 @@ namespace Myshipping.Application if (orderInfo != null) { + orderInfo.LstShipOrderCompareDate = bDate; + if (compareResult.succ) { + orderInfo.LstShipOrderCompareMode = "MANUAL"; + if (compareResult.extra.IsExistsDiff) { orderInfo.LstShipOrderCompareRlt = "DIFF"; @@ -147,7 +151,6 @@ namespace Myshipping.Application orderInfo.LstShipOrderCompareRlt = "NO_DIFF"; orderInfo.LstShipOrderCompareRltName = "正常"; } - orderInfo.LstShipOrderCompareDate = bDate; } else { @@ -165,6 +168,7 @@ namespace Myshipping.Application it.LstShipOrderCompareDate, it.LstShipOrderCompareRlt, it.LstShipOrderCompareRltName, + it.LstShipOrderCompareMode, }).ExecuteCommandAsync(); }