From 1a6e119309f54d8a8a76dfd1e85e5d0067b30ed4 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 21 Apr 2023 10:08:10 +0800 Subject: [PATCH] =?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 --- .../Entity/TaskManagePlat/TaskTruckInfo.cs | 14 ++- .../BookingTruck/BookingTruckService.cs | 95 ++++++++++++++++--- .../BookingTruck/Dtos/BookingTruckDto.cs | 8 ++ .../Dtos/BookingTruckShowBaseDto.cs | 8 ++ .../Interface/IBookingTruckService.cs | 7 +- .../Dtos/TaskManageOrderMessageMainInfo.cs | 10 ++ .../TaskManagePlat/Dtos/Truck/TaskTruckDto.cs | 8 ++ .../Dtos/Truck/TaskTruckShowBaseDto.cs | 8 ++ .../TaskManagePlat/TaskManageService.cs | 2 +- 9 files changed, 143 insertions(+), 17 deletions(-) diff --git a/Myshipping.Application/Entity/TaskManagePlat/TaskTruckInfo.cs b/Myshipping.Application/Entity/TaskManagePlat/TaskTruckInfo.cs index dadc4ea3..600b11f1 100644 --- a/Myshipping.Application/Entity/TaskManagePlat/TaskTruckInfo.cs +++ b/Myshipping.Application/Entity/TaskManagePlat/TaskTruckInfo.cs @@ -61,6 +61,12 @@ namespace Myshipping.Application.Entity /// [Description("ATTN邮箱")] public string AttnMail { get; set; } + + /// + /// ATTN传真 + /// + [Description("ATTN传真")] + public string AttnFax { get; set; } /// /// FROM /// @@ -77,6 +83,11 @@ namespace Myshipping.Application.Entity [Description("FROM邮箱")] public string FromMail { get; set; } /// + /// FROM传真 + /// + [Description("FROM传真")] + public string FromFax { get; set; } + /// /// 吨数 /// [Description("吨数")] @@ -190,7 +201,7 @@ namespace Myshipping.Application.Entity /// 是否挂机 /// [Description("是否挂机")] - public bool IsGuaJi { get; set; } + public bool IsGuaJi { get; set; } = false; /// /// 状态 /// @@ -252,5 +263,6 @@ namespace Myshipping.Application.Entity /// [Description("工厂地址")] public string FactoryAddr { get; set; } + } } diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs index 4058b976..750ba971 100644 --- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs @@ -15,6 +15,7 @@ using Myshipping.Core.Entity; using Myshipping.Core.Service; using MySqlX.XDevAPI.Common; using NetTaste; +using Newtonsoft.Json.Linq; using NPOI.OpenXmlFormats.Wordprocessing; using NPOI.SS.Formula.Functions; using Org.BouncyCastle.Crypto; @@ -41,13 +42,19 @@ namespace Myshipping.Application private readonly SqlSugarRepository _bookingTruckContaRepository; private readonly SqlSugarRepository _bookingOrderRepository; private readonly SqlSugarRepository _bookingCtnRepository; + private readonly SqlSugarRepository _bookingPrintTemplateTemplate; + private readonly SqlSugarRepository _djyUserConfigConfig; private readonly ITaskManageExternalService _taskManageExternalService; + const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list"; + public BookingTruckService(ISysCacheService cache, ILogger logger, SqlSugarRepository bookingTruckRepository, SqlSugarRepository bookingTruckContaRepository, SqlSugarRepository bookingOrderRepository, SqlSugarRepository bookingCtnRepository, + SqlSugarRepository bookingPrintTemplateTemplate, + SqlSugarRepository djyUserConfigConfig, ITaskManageExternalService taskManageExternalService) { _cache = cache; @@ -59,6 +66,8 @@ namespace Myshipping.Application _bookingCtnRepository = bookingCtnRepository; _taskManageExternalService = taskManageExternalService; + _bookingPrintTemplateTemplate = bookingPrintTemplateTemplate; + _djyUserConfigConfig = djyUserConfigConfig; } /// @@ -649,6 +658,9 @@ namespace Myshipping.Application messageInfo.Main.TaskUserId = UserManager.UserId.ToString(); messageInfo.Main.TaskUserName = UserManager.Name; + messageInfo.Main.RecvUserId = model.DispatcherId.ToString(); + messageInfo.Main.RecvUserName = model.DispatcherName; + messageInfo.Main.TaskTitle = $"{model.MBLNo}_派车任务"; messageInfo.Main.TaskDesp = $"{model.MBLNo}_派车任务"; messageInfo.Main.TaskSource = TaskSourceEnum.CUSTOMER_SUBMIT; @@ -808,6 +820,7 @@ namespace Myshipping.Application /// /// 派车主键组 /// 返回回执 + [HttpPost("/BookingTruck/CancelBatch")] public async Task CancelBatch([FromBody] long[] ids) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -867,7 +880,8 @@ namespace Myshipping.Application } catch (Exception ex) { - + result.succ = false; + result.msg = $"撤销派车异常,原因:{ex.Message}"; } return result; @@ -986,6 +1000,7 @@ namespace Myshipping.Application /// /// 派车主键 /// 返回回执 + [HttpGet("/BookingTruck/Delete")] public async Task Delete(long id) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -1023,7 +1038,8 @@ namespace Myshipping.Application /// /// 派车主键组 /// 返回回执 - public async Task DeleteBatch(long[] ids) + [HttpPost("/BookingTruck/DeleteBatch")] + public async Task DeleteBatch([FromBody]long[] ids) { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); @@ -1051,32 +1067,83 @@ namespace Myshipping.Application } catch (Exception ex) { - + result.succ = false; + result.msg = $"删除派车异常,原因:{ex.Message}"; } return result; } /// - /// 打印派车 + /// 获取订舱打印模板列表(带有当前用户打印历史排序) /// - /// 派车主键 - /// 返回回执 - [HttpGet("/BookingTruck/Print")] - public async Task Print(long id) + /// 分类代码(使用字典【booking_template_category】中的代码) + /// 打印分类,10:FastReport、20:Excel模板 + /// + [HttpGet("/BookingTruck/PrintTemplateWithHistoryList")] + public async Task PrintTemplateWithHistoryList(string cateCode, BookingPrintTemplateType printType) { - TaskManageOrderResultDto result = new TaskManageOrderResultDto(); - - try + var typeCode = printType.ToString(); + //当前公司所有已配置的模板 + var allList = await _bookingPrintTemplateTemplate.AsQueryable() + .Filter(null, true).InnerJoin((d, t) => d.Id == t.PrintTemplateId && t.SysUserId == UserManager.UserId) + .Where(d => d.TenantId == UserManager.TENANT_ID && d.CateCode.Contains(cateCode) && d.Type == typeCode) + .Select(d => new + { + d.Id, + d.CateCode, + d.CateName, + d.DisplayName + + }) + .ToListAsync(); + + var listReult = new List(); + //当前用户打印历史数据 + var printRecentListKey = $"{PRINT_LIST_TYPE_KEY}_{cateCode}_{printType}"; + var usrCfg = await _djyUserConfigConfig.AsQueryable().FirstAsync(x => x.CreatedUserId == UserManager.UserId && x.Type == printRecentListKey); + if (usrCfg != null) { + var arr = JArray.Parse(usrCfg.ConfigJson).Select(x => Convert.ToInt64(x)).ToList(); + //按顺序加入到结果 + arr.ForEach(x => + { + var find = allList.FirstOrDefault(y => y.Id == x); + if (find != null) + { + listReult.Add(find); + } + }); + + var listOut = allList.Where(x => !arr.Contains(x.Id)).ToList(); + listReult.AddRange(listOut); + + return listReult; } - catch (Exception ex) + else { - + return allList; } + } - return result; + + /// + /// 打印派车 + /// + /// 派车主键 + /// 打印模板ID + /// 分类代码(使用字典【booking_template_category】中的代码) + /// 类型,1:pdf、2:xlsx、3:docx + /// 打印类型,10:FastReport、20:Excel模板 + /// 返回回执 + [HttpGet("/BookingTruck/Print")] + public async Task Print(long id, long templateId, string cateCode, int type = 1, + BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport) + { + + + return string.Empty; } diff --git a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckDto.cs b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckDto.cs index a19969d3..cdcb1f1b 100644 --- a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckDto.cs +++ b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckDto.cs @@ -49,6 +49,10 @@ namespace Myshipping.Application /// public string AttnMail { get; set; } /// + /// ATTN传真 + /// + public string AttnFax { get; set; } + /// /// FROM /// public string FromName { get; set; } @@ -61,6 +65,10 @@ namespace Myshipping.Application /// public string FromMail { get; set; } /// + /// FROM传真 + /// + public string FromFax { get; set; } + /// /// 吨数 /// public Nullable KGS { get; set; } diff --git a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckShowBaseDto.cs b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckShowBaseDto.cs index 6fddb89d..bbca677c 100644 --- a/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckShowBaseDto.cs +++ b/Myshipping.Application/Service/BookingTruck/Dtos/BookingTruckShowBaseDto.cs @@ -44,6 +44,10 @@ namespace Myshipping.Application /// public string AttnMail { get; set; } /// + /// ATTN传真 + /// + public string AttnFax { get; set; } + /// /// FROM /// public string FromName { get; set; } @@ -56,6 +60,10 @@ namespace Myshipping.Application /// public string FromMail { get; set; } /// + /// FROM传真 + /// + public string FromFax { get; set; } + /// /// 吨数 /// public Nullable KGS { get; set; } diff --git a/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs index ca35d339..94c69900 100644 --- a/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs +++ b/Myshipping.Application/Service/BookingTruck/Interface/IBookingTruckService.cs @@ -108,8 +108,13 @@ namespace Myshipping.Application /// 打印派车 /// /// 派车主键 + /// 打印模板ID + /// 分类代码(使用字典【booking_template_category】中的代码) + /// 类型,1:pdf、2:xlsx、3:docx + /// 打印类型,10:FastReport、20:Excel模板 /// 返回回执 - Task Print(long id); + Task Print(long id, long templateId, string cateCode, int type = 1, + BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport); } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs index a0d91a8c..7c829afc 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -69,6 +69,16 @@ namespace Myshipping.Application /// public string TaskUserName { get; set; } + /// + /// 任务对应接收操作人ID + /// + public string RecvUserId { get; set; } + + /// + /// 任务对应接收操作人名称 + /// + public string RecvUserName { get; set; } + /// /// 任务对应部门代码 /// diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckDto.cs index e85742aa..79b1eac8 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckDto.cs @@ -48,6 +48,10 @@ namespace Myshipping.Application /// public string AttnMail { get; set; } /// + /// ATTN传真 + /// + public string AttnFax { get; set; } + /// /// FROM /// public string FromName { get; set; } @@ -60,6 +64,10 @@ namespace Myshipping.Application /// public string FromMail { get; set; } /// + /// FROM传真 + /// + public string FromFax { get; set; } + /// /// 吨数 /// public Nullable KGS { get; set; } diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckShowBaseDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckShowBaseDto.cs index 2b15b4f4..2d9c09da 100644 --- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckShowBaseDto.cs +++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TaskTruckShowBaseDto.cs @@ -41,6 +41,10 @@ namespace Myshipping.Application /// public string AttnMail { get; set; } /// + /// ATTN传真 + /// + public string AttnFax { get; set; } + /// /// FROM /// public string FromName { get; set; } @@ -53,6 +57,10 @@ namespace Myshipping.Application /// public string FromMail { get; set; } /// + /// FROM传真 + /// + public string FromFax { get; set; } + /// /// 吨数 /// public Nullable KGS { get; set; } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index eaf2711d..df2300ba 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -238,7 +238,7 @@ namespace Myshipping.Application TASK_TYPE = info.Main.TaskType.ToString(), }; - UserTendDto userTendInfo = GetUserTendInfo(info.Main.TaskUserId); + UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId); taskInfo.CreatedUserId = userTendInfo.userId; taskInfo.CreatedUserName = userTendInfo.userName;