From 901a86f7efd0d12c534e0de37f5e8f911259b83a Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Sun, 23 Apr 2023 16:38:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingTruck/BookingTruckService.cs | 22 +++++++++++++++---- Myshipping.Core/Myshipping.Core.xml | 8 +++++++ .../Service/User/ISysUserService.cs | 7 ++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index be19c04d..f9c13cbf 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -56,6 +56,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookingExcelTemplateRepository; private readonly SqlSugarRepository _sysUserRepository; private readonly ITaskManageExternalService _taskManageExternalService; + private readonly ISysUserService _sysUserService; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; const string PRINT_DATASOURCE_KEY = "booking_order"; @@ -69,6 +70,7 @@ namespace Myshipping.Application SqlSugarRepository djyUserConfigConfig, SqlSugarRepository bookingExcelTemplateRepository, SqlSugarRepository sysUserRepository, + ISysUserService sysUserService, ITaskManageExternalService taskManageExternalService) { _cache = cache; @@ -84,6 +86,7 @@ namespace Myshipping.Application _djyUserConfigConfig = djyUserConfigConfig; _bookingExcelTemplateRepository = bookingExcelTemplateRepository; _sysUserRepository = sysUserRepository; + _sysUserService = sysUserService; } /// @@ -259,7 +262,7 @@ namespace Myshipping.Application try { - var model = InnerCreateTruckFromBookingOrder(bookingId); + var model = await InnerCreateTruckFromBookingOrder(bookingId); result.succ = true; result.ext = model; @@ -445,7 +448,7 @@ namespace Myshipping.Application } - private BookingTruckShowDto InnerCreateTruckFromBookingOrder(long bookingId) + private async Task InnerCreateTruckFromBookingOrder(long bookingId) { BookingTruckShowDto model = null; @@ -466,11 +469,22 @@ namespace Myshipping.Application model.MBLNo = orderInfo.MBLNO; model.Vessel = orderInfo.VESSEL; model.VoyNo = orderInfo.VOYNO; + model.YARDCONTRACT = orderInfo.YARDCONTRACT; + model.YARDCONTRACTTEL = orderInfo.YARDCONTRACTTEL; + model.TruckTime = DateTime.Now; model.FromName = UserManager.Name; model.FromTel = UserManager.TEl; model.FromMail = UserManager.Email; + var userPosInfo = await _sysUserService.QueryUserByPos("", "PCDD"); + + if(userPosInfo.Count > 0) + { + model.DispatcherId = userPosInfo.FirstOrDefault().SysEmpId; + model.DispatcherName = userPosInfo.FirstOrDefault().SysEmpName; + } + if (orderInfo.KGS.HasValue) { //计算总吨数 @@ -542,7 +556,7 @@ namespace Myshipping.Application try { - var model = InnerCreateTruckFromBookingOrder(bookingId); + var model = await InnerCreateTruckFromBookingOrder(bookingId); result.succ = true; result.ext = model; @@ -568,7 +582,7 @@ namespace Myshipping.Application try { - var model = InnerCreateTruckFromBookingOrder(bookingId); + var model = await InnerCreateTruckFromBookingOrder(bookingId); result.succ = true; diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 1aeba5b0..9671aa48 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -15274,6 +15274,14 @@ 所属租户 + + + 通过职位获取用户信息 + + + 职位代码 PCDD-调度 + 返回用户详情 + 用户数据范围 diff --git a/Myshipping.Core/Service/User/ISysUserService.cs b/Myshipping.Core/Service/User/ISysUserService.cs index c7f7d9f4..4584aea4 100644 --- a/Myshipping.Core/Service/User/ISysUserService.cs +++ b/Myshipping.Core/Service/User/ISysUserService.cs @@ -32,4 +32,11 @@ public interface ISysUserService void CheckDataScopeByUserId(long userId); void CheckDataScope(long orgId); Task> GetTenantUser(string name,long? tenantId); + /// + /// 通过职位获取用户信息 + /// + /// + /// 职位代码 PCDD-调度 + /// 返回用户详情 + Task> QueryUserByPos(string name, string pos); } From 1ca90e9d40dc631d7c94ed4b479b64d6a5a03253 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Sun, 23 Apr 2023 17:15:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingTruck/BookingTruckService.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index f9c13cbf..0ab98fe9 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -31,6 +31,7 @@ using System.ComponentModel; using System.IO; using System.Linq; using System.Net.Http; +using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -57,6 +58,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _sysUserRepository; private readonly ITaskManageExternalService _taskManageExternalService; private readonly ISysUserService _sysUserService; + private readonly IDjyCustomerService _djyCustomerService; const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; const string PRINT_DATASOURCE_KEY = "booking_order"; @@ -70,7 +72,7 @@ namespace Myshipping.Application SqlSugarRepository djyUserConfigConfig, SqlSugarRepository bookingExcelTemplateRepository, SqlSugarRepository sysUserRepository, - ISysUserService sysUserService, + ISysUserService sysUserService, IDjyCustomerService djyCustomerService, ITaskManageExternalService taskManageExternalService) { _cache = cache; @@ -87,6 +89,7 @@ namespace Myshipping.Application _bookingExcelTemplateRepository = bookingExcelTemplateRepository; _sysUserRepository = sysUserRepository; _sysUserService = sysUserService; + _djyCustomerService = djyCustomerService; } /// @@ -477,14 +480,43 @@ namespace Myshipping.Application model.FromTel = UserManager.TEl; model.FromMail = UserManager.Email; + //这里岗位是调度的信息,如果默认只有一条记录,取第一条,其他情况不返回默认值 var userPosInfo = await _sysUserService.QueryUserByPos("", "PCDD"); - if(userPosInfo.Count > 0) + if(userPosInfo.Count == 1) { model.DispatcherId = userPosInfo.FirstOrDefault().SysEmpId; model.DispatcherName = userPosInfo.FirstOrDefault().SysEmpName; } + var yardList = await _djyCustomerService.QuerytDjyCustomerInfo("", new string[] { "yard" }, 999); + + if(yardList.Count > 0) + { + if((string.IsNullOrWhiteSpace(model.YARDCONTRACT) || string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL)) + && !string.IsNullOrWhiteSpace(model.YARD)) + { + var yardInfo = yardList.Select(a => + { + return new { KNum = a.ShortName.IndexOf(model.YARD), + Equls = a.ShortName.Equals(model.YARD, StringComparison.OrdinalIgnoreCase) ? 1 : 0, + Obj = a }; + }).Where(a=>a.KNum >= 0) + .OrderByDescending(a => a.Equls) + .ThenBy(a=>a.KNum) + .FirstOrDefault().Obj; + + if(yardInfo != null) + { + if (string.IsNullOrWhiteSpace(model.YARDCONTRACT)) + model.YARDCONTRACT = yardInfo.Chief?.Trim(); + + if (string.IsNullOrWhiteSpace(model.YARDCONTRACTTEL)) + model.YARDCONTRACTTEL = yardInfo.Tel?.Trim(); + } + } + } + if (orderInfo.KGS.HasValue) { //计算总吨数 From 09903bfceb2360693d47066e1496d4fdf7be6310 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Sun, 23 Apr 2023 17:17:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B4=BE=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingTruck/BookingTruckService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 0ab98fe9..7f0c4d12 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -517,6 +517,9 @@ namespace Myshipping.Application } } + model.InYardContact = orderInfo.YARDCONTRACT; + model.InYardContractTel = orderInfo.YARDCONTRACTTEL; + if (orderInfo.KGS.HasValue) { //计算总吨数