|
|
|
@ -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<BookingTruckCtn> _bookingTruckContaRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtn> _bookingCtnRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _bookingPrintTemplateTemplate;
|
|
|
|
|
private readonly SqlSugarRepository<DjyUserConfig> _djyUserConfigConfig;
|
|
|
|
|
private readonly ITaskManageExternalService _taskManageExternalService;
|
|
|
|
|
|
|
|
|
|
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
|
|
|
|
|
|
|
|
|
|
public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger,
|
|
|
|
|
SqlSugarRepository<BookingTruck> bookingTruckRepository,
|
|
|
|
|
SqlSugarRepository<BookingTruckCtn> bookingTruckContaRepository,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository,
|
|
|
|
|
SqlSugarRepository<BookingCtn> bookingCtnRepository,
|
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> bookingPrintTemplateTemplate,
|
|
|
|
|
SqlSugarRepository<DjyUserConfig> djyUserConfigConfig,
|
|
|
|
|
ITaskManageExternalService taskManageExternalService)
|
|
|
|
|
{
|
|
|
|
|
_cache = cache;
|
|
|
|
@ -59,6 +66,8 @@ namespace Myshipping.Application
|
|
|
|
|
_bookingCtnRepository = bookingCtnRepository;
|
|
|
|
|
|
|
|
|
|
_taskManageExternalService = taskManageExternalService;
|
|
|
|
|
_bookingPrintTemplateTemplate = bookingPrintTemplateTemplate;
|
|
|
|
|
_djyUserConfigConfig = djyUserConfigConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -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
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids">派车主键组</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/BookingTruck/CancelBatch")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> 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
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">派车主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/BookingTruck/Delete")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Delete(long id)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
@ -1023,7 +1038,8 @@ namespace Myshipping.Application
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids">派车主键组</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> DeleteBatch(long[] ids)
|
|
|
|
|
[HttpPost("/BookingTruck/DeleteBatch")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 打印派车
|
|
|
|
|
/// 获取订舱打印模板列表(带有当前用户打印历史排序)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">派车主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/BookingTruck/Print")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Print(long id)
|
|
|
|
|
/// <param name="cateCode">分类代码(使用字典【booking_template_category】中的代码)</param>
|
|
|
|
|
/// <param name="printType">打印分类,10:FastReport、20:Excel模板</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingTruck/PrintTemplateWithHistoryList")]
|
|
|
|
|
public async Task<dynamic> PrintTemplateWithHistoryList(string cateCode, BookingPrintTemplateType printType)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
var typeCode = printType.ToString();
|
|
|
|
|
//当前公司所有已配置的模板
|
|
|
|
|
var allList = await _bookingPrintTemplateTemplate.AsQueryable()
|
|
|
|
|
.Filter(null, true).InnerJoin<BookingPrinttemplateRight>((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<dynamic>();
|
|
|
|
|
//当前用户打印历史数据
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 打印派车
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">派车主键</param>
|
|
|
|
|
/// <param name="templateId">打印模板ID</param>
|
|
|
|
|
/// <param name="cateCode">分类代码(使用字典【booking_template_category】中的代码)</param>
|
|
|
|
|
/// <param name="type">类型,1:pdf、2:xlsx、3:docx</param>
|
|
|
|
|
/// <param name="printType">打印类型,10:FastReport、20:Excel模板</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/BookingTruck/Print")]
|
|
|
|
|
public async Task<string> Print(long id, long templateId, string cateCode, int type = 1,
|
|
|
|
|
BookingPrintTemplateType printType = BookingPrintTemplateType.FastReport)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|