|
|
|
@ -53,7 +53,9 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<TaskStatManageInfo> _taskStatManageInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskOriginalDownloadHisInfo> _taskOriginalDownloadHisInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskChargesHisInfo> _taskChargesHisInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly ILogger<BookingOrderService> _logger;
|
|
|
|
@ -72,6 +74,7 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<TaskStatManageInfo> taskStatManageInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskOriginalDownloadHisInfo> taskOriginalDownloadHisInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskChargesHisInfo> taskChargesHisInfoRepository,
|
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository,
|
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig,
|
|
|
|
|
ISysCacheService cache,
|
|
|
|
|
ILogger<BookingOrderService> logger)
|
|
|
|
@ -87,6 +90,7 @@ namespace Myshipping.Application
|
|
|
|
|
_taskStatManageInfoRepository = taskStatManageInfoRepository;
|
|
|
|
|
_taskOriginalDownloadHisInfoRepository = taskOriginalDownloadHisInfoRepository;
|
|
|
|
|
_taskChargesHisInfoRepository = taskChargesHisInfoRepository;
|
|
|
|
|
_bookingOrderRepository = bookingOrderRepository;
|
|
|
|
|
|
|
|
|
|
_webAccountConfig = webAccountConfig;
|
|
|
|
|
_cache = cache;
|
|
|
|
@ -1099,12 +1103,13 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 提单纸页数计算
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提单纸页数计算
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="PKIds">任务主键数组</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpPost("/TaskManage/LaraPaperCalc")]
|
|
|
|
|
public async Task<List<LaraPaperCalcInfo>> LaraPaperCalc(string[] PKIds)
|
|
|
|
|
{
|
|
|
|
|
List<LaraPaperCalcInfo> list = new List<LaraPaperCalcInfo>();
|
|
|
|
@ -1122,18 +1127,40 @@ namespace Myshipping.Application
|
|
|
|
|
if (mblnoList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//根据主单号获取任务类型是DRAFT的任务,取时间最新的
|
|
|
|
|
var taskList = _taskBaseInfoRepository.AsQueryable()
|
|
|
|
|
.LeftJoin(_taskFileInfoRepository.AsQueryable(), (tsk, file) => tsk.PK_ID == file.TASK_PKID)
|
|
|
|
|
.Where((tsk, file) => PKIds.Contains(tsk.PK_ID) && tsk.TASK_TYPE == TaskBusiTypeEnum.DRAFT.ToString() && file != null)
|
|
|
|
|
.OrderByDescending(tsk => tsk.CreatedTime)
|
|
|
|
|
var fileList = _taskBaseInfoRepository.EntityContext.Queryable<TaskBaseInfo>()
|
|
|
|
|
.InnerJoin<TaskFileInfo>((tsk, file) => tsk.PK_ID == file.TASK_PKID)
|
|
|
|
|
.Where((tsk, file) =>
|
|
|
|
|
tsk.TASK_TYPE == TaskBusiTypeEnum.DRAFT.ToString() && mblnoList.Contains(tsk.MBL_NO))
|
|
|
|
|
.Select((tsk, file) => new { tsk = tsk, file = file }).ToList();
|
|
|
|
|
|
|
|
|
|
var calcList = fileList.GroupBy(t => t.tsk.PK_ID)
|
|
|
|
|
.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var currList = a.ToList();
|
|
|
|
|
|
|
|
|
|
return new
|
|
|
|
|
{
|
|
|
|
|
tsk = currList.FirstOrDefault().tsk,
|
|
|
|
|
clist = a.Select(x => x.file).ToList()
|
|
|
|
|
};
|
|
|
|
|
}).OrderByDescending(t => t.tsk.CreatedTime).ToList();
|
|
|
|
|
|
|
|
|
|
list = mblnoList.Select((mbl,idx) => {
|
|
|
|
|
|
|
|
|
|
list = mblnoList.Select((mbl, idx) =>
|
|
|
|
|
{
|
|
|
|
|
var calcInfo = new LaraPaperCalcInfo();
|
|
|
|
|
|
|
|
|
|
calcInfo.MBLNo = mbl;
|
|
|
|
|
calcInfo.Indx = idx + 1;
|
|
|
|
|
|
|
|
|
|
var files = calcList.FirstOrDefault(t => t.tsk.MBL_NO.Equals(mbl, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (files != null)
|
|
|
|
|
{
|
|
|
|
|
calcInfo.DraftNum = files.clist.Select(t => t.FILE_NAME.GetPageNum()).Sum();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
calcInfo.PaperNum = calcInfo.DraftNum * 3;
|
|
|
|
|
|
|
|
|
|
return calcInfo;
|
|
|
|
|
}).ToList();
|
|
|
|
@ -1141,12 +1168,87 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"完成任务异常,{0}", ex.Message);
|
|
|
|
|
throw Oops.Bah($"提单纸页数计算异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求提单纸登记
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKIds">任务主键</param>
|
|
|
|
|
/// <param name="model">提单纸登记请求参数</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> LaraPaperRegistPost(string taskPKIds, LaraPaperRegistPostDto model)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} LARA提单纸登记开始", batchNo, taskPKIds);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"请求提单纸登记异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region LARA提单纸登记
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// LARA提单纸登记
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="PKIds">任务主键数组</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> LaraPaperRegist(string[] PKIds)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} ids={ids} LARA提单纸登记开始", batchNo, string.Join(",", PKIds));
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"LARA提单纸登记异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class DraftPaperExtension
|
|
|
|
|
{
|
|
|
|
|
public static int GetPageNum(this string Name)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(Name))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
string s = Regex.Replace(Name.Substring(Name.LastIndexOf('-') + 1), "\\.[a-zA-Z]+", "");
|
|
|
|
|
|
|
|
|
|
return int.Parse(s);
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"文件名{0} 取页数异常,{1}", Name, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|