|
|
|
@ -21,6 +21,7 @@ using Myshipping.Core.Entity;
|
|
|
|
|
using Myshipping.Core.Helper;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
|
using NetTaste;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using Npoi.Mapper;
|
|
|
|
@ -34,7 +35,9 @@ using NPOI.SS.Formula.Functions;
|
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using NPOI.XSSF.Model;
|
|
|
|
|
using Org.BouncyCastle.Asn1.Tsp;
|
|
|
|
|
using Org.BouncyCastle.Asn1.X500;
|
|
|
|
|
using Org.BouncyCastle.Asn1.X9;
|
|
|
|
|
using SixLabors.ImageSharp.Processing.Processors.Transforms;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
@ -76,6 +79,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<TaskChargesHisInfo> _taskChargesHisInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskLARAPaperInfo> _taskLARAPaperInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskPerBillBaseInfo> _taskPerBillBaseInfoRepository;
|
|
|
|
|
private readonly SqlSugarRepository<TaskStoreMsgInfo> _taskStoreMsgInfoRepository;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
|
|
|
|
|
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
|
|
|
|
@ -88,6 +92,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly ILogger<BookingOrderService> _logger;
|
|
|
|
|
|
|
|
|
|
private readonly INamedServiceProvider<IBookingOrderService> _namedBookingOrderServiceProvider;
|
|
|
|
|
|
|
|
|
|
const string CONST_WEB_ACCOUNT_TYPE = "CmaWeb";
|
|
|
|
|
const string CONST_BOOK_ORIGINAL_DOWN_URL_CODE = "bookOriginalDownUrl";
|
|
|
|
@ -95,6 +100,11 @@ namespace Myshipping.Application
|
|
|
|
|
const string CONST_WEB_LARA_ACCOUNT_TYPE = "LaraWeb";
|
|
|
|
|
const string CONST_LARA_DOWN_URL_CODE = "LaraPaperPostUrl";
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "YunJia";
|
|
|
|
|
|
|
|
|
|
//LARA纸计算常量
|
|
|
|
|
const int LARA_PARER_DRAFT_VAR = 3;
|
|
|
|
|
|
|
|
|
|
public TaskManageService(SqlSugarRepository<TaskBaseInfo> taskBaseInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskSIFeedBackInfo> taskSIFeedBackInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskSIFeedBackContaInfo> taskSIFeedBackContaInfoRepository,
|
|
|
|
@ -113,6 +123,8 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<BookingStatus> bookingStatusRepository,
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> djyUserMailAccountRepository,
|
|
|
|
|
SqlSugarRepository<TaskPerBillBaseInfo> taskPerBillBaseInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskStoreMsgInfo> taskStoreMsgInfoRepository,
|
|
|
|
|
INamedServiceProvider<IBookingOrderService> namedBookingOrderServiceProvider,
|
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig,
|
|
|
|
|
ISysCacheService cache,
|
|
|
|
|
ILogger<BookingOrderService> logger)
|
|
|
|
@ -135,6 +147,9 @@ namespace Myshipping.Application
|
|
|
|
|
_bookingStatusRepository = bookingStatusRepository;
|
|
|
|
|
_djyUserMailAccountRepository = djyUserMailAccountRepository;
|
|
|
|
|
_taskPerBillBaseInfoRepository = taskPerBillBaseInfoRepository;
|
|
|
|
|
_taskStoreMsgInfoRepository = taskStoreMsgInfoRepository;
|
|
|
|
|
|
|
|
|
|
_namedBookingOrderServiceProvider = namedBookingOrderServiceProvider;
|
|
|
|
|
|
|
|
|
|
_webAccountConfig = webAccountConfig;
|
|
|
|
|
_cache = cache;
|
|
|
|
@ -367,6 +382,21 @@ namespace Myshipping.Application
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (info.Main.SerialMsgInfo != null)
|
|
|
|
|
{
|
|
|
|
|
var storeInfo = new TaskStoreMsgInfo
|
|
|
|
|
{
|
|
|
|
|
PK_ID = IDGen.NextID().ToString(),
|
|
|
|
|
TASK_PKID = taskInfo.PK_ID,
|
|
|
|
|
MSG_JSON = info.Main.SerialMsgInfo.SerialMsg,
|
|
|
|
|
MSG_TYPE = info.Main.SerialMsgInfo.SerialType,
|
|
|
|
|
CreatedTime = taskInfo.CreatedTime,
|
|
|
|
|
UpdatedTime = taskInfo.CreatedTime,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await _taskStoreMsgInfoRepository.InsertAsync(storeInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "新增任务成功";
|
|
|
|
|
}
|
|
|
|
@ -3025,33 +3055,35 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
TaskVgmCompareDto md = l.Adapt<TaskVgmCompareDto>();
|
|
|
|
|
|
|
|
|
|
md.compareDiffList = new List<string>();
|
|
|
|
|
|
|
|
|
|
if (currInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if(!l.SEALNO.Equals(currInfo.SEAL_NO))
|
|
|
|
|
if(l.SEALNO != currInfo.SEAL_NO)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CTNCODE.Equals(currInfo.CONTA_TYPE))
|
|
|
|
|
if (l.CTNCODE != currInfo.CONTA_TYPE)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CTNALL.Equals(currInfo.CONTA_TYPE_NAME))
|
|
|
|
|
if (l.CTNALL != currInfo.CONTA_TYPE_NAME)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName));
|
|
|
|
|
}
|
|
|
|
|
if (!l.KGS.Equals(currInfo.KGS))
|
|
|
|
|
if (l.KGS != currInfo.KGS)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS));
|
|
|
|
|
}
|
|
|
|
|
if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT))
|
|
|
|
|
if (l.TAREWEIGHT != currInfo.TAREWEIGHT)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS))
|
|
|
|
|
if (l.WEIGHKGS != currInfo.WEIGHKGS)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE))
|
|
|
|
|
if (l.WEIGHTYPE != currInfo.WEIGHTYPE)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType));
|
|
|
|
|
}
|
|
|
|
@ -3079,33 +3111,35 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
TaskVgmCompareDto md = l.Adapt<TaskVgmCompareDto>();
|
|
|
|
|
|
|
|
|
|
md.compareDiffList = new List<string>();
|
|
|
|
|
|
|
|
|
|
if (currInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if (!l.SEAL_NO.Equals(currInfo.SEALNO))
|
|
|
|
|
if (l.SEAL_NO != currInfo.SEALNO)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CONTA_TYPE.Equals(currInfo.CTNCODE))
|
|
|
|
|
if (l.CONTA_TYPE != currInfo.CTNCODE)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CONTA_TYPE_NAME.Equals(currInfo.CTNALL))
|
|
|
|
|
if (l.CONTA_TYPE_NAME != currInfo.CTNALL)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName));
|
|
|
|
|
}
|
|
|
|
|
if (!l.KGS.Equals(currInfo.KGS))
|
|
|
|
|
if (l.KGS != currInfo.KGS)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS));
|
|
|
|
|
}
|
|
|
|
|
if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT))
|
|
|
|
|
if (l.TAREWEIGHT != currInfo.TAREWEIGHT)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS))
|
|
|
|
|
if (l.WEIGHKGS != currInfo.WEIGHKGS)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE))
|
|
|
|
|
if (l.WEIGHTYPE != currInfo.WEIGHTYPE)
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType));
|
|
|
|
|
}
|
|
|
|
@ -3404,6 +3438,683 @@ namespace Myshipping.Application
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 手工批量重新比对BC
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手工批量重新比对BC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="PKIds">任务主键数组</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpPost("/TaskManage/ManualReCompareBC")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> ManualReCompareBC(string[] PKIds)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} ids={ids} 手工批量重新比对BC开始", batchNo, string.Join(",", PKIds));
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 获取任务完成,Num={Num}", batchNo, taskList.Count);
|
|
|
|
|
|
|
|
|
|
var list = new List<TaskManageOrderResultDto>();
|
|
|
|
|
|
|
|
|
|
taskList.ForEach(async tsk =>
|
|
|
|
|
{
|
|
|
|
|
var rlt = await InnerSingleManualReCompareBC(tsk);
|
|
|
|
|
|
|
|
|
|
list.Add(rlt);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list.Any(t => !t.succ))
|
|
|
|
|
{
|
|
|
|
|
result.msg = "失败";
|
|
|
|
|
result.succ = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.msg = "成功";
|
|
|
|
|
result.succ = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("手工批量重新比对BC异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 手工单票重新比对BC
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手工单票重新比对BC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">任务详情</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerSingleManualReCompareBC(TaskBaseInfo model)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、通过任务的报文表获取BC的报文。
|
|
|
|
|
*/
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var storeInfo = await _taskStoreMsgInfoRepository.AsQueryable()
|
|
|
|
|
.Where(t => t.TASK_PKID == model.PK_ID && t.MSG_TYPE == TaskStoreMsgTypeEnum.BC_MSG.ToString()).FirstAsync();
|
|
|
|
|
|
|
|
|
|
if(storeInfo == null)
|
|
|
|
|
throw Oops.Oh("MBL_NO={0},获取{1}报文失败", model.MBL_NO,TaskStoreMsgTypeEnum.BC_MSG.GetDescription());
|
|
|
|
|
|
|
|
|
|
var rtl = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(storeInfo.MSG_JSON);
|
|
|
|
|
|
|
|
|
|
string msg = string.Empty;
|
|
|
|
|
//2023-02-02 测试过程中发现JSON数据格式有了变化,这里增加兼容
|
|
|
|
|
if(rtl.mesage != null)
|
|
|
|
|
{
|
|
|
|
|
msg = JSON.Serialize(rtl.mesage);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg = storeInfo.MSG_JSON;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(msg))
|
|
|
|
|
throw Oops.Oh("MBL_NO={0},解析{1}报文详情异常", model.MBL_NO, TaskStoreMsgTypeEnum.BC_MSG.GetDescription());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bookOrderList = _bookingOrderRepository.EntityContext.Queryable<BookingOrder>()
|
|
|
|
|
.InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID)
|
|
|
|
|
.Where((bk, ctn) => bk.Id == long.Parse(model.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
.Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList();
|
|
|
|
|
|
|
|
|
|
//获取订舱详情与BC进行比对
|
|
|
|
|
var orderInfo = bookOrderList.FirstOrDefault().bk;
|
|
|
|
|
|
|
|
|
|
List<BookingCtn> ctnList = new List<BookingCtn>();
|
|
|
|
|
|
|
|
|
|
if (bookOrderList.Any(t => t.ctn != null))
|
|
|
|
|
ctnList = bookOrderList.Select(t => t.ctn).ToList();
|
|
|
|
|
|
|
|
|
|
if (orderInfo == null)
|
|
|
|
|
throw Oops.Oh("MBL_NO={0},获取订舱详情失败", model.MBL_NO);
|
|
|
|
|
|
|
|
|
|
TaskBCStoreResultInfo bcStoreInfo = JSON.Deserialize<TaskBCStoreResultInfo>(msg);
|
|
|
|
|
|
|
|
|
|
//BC比较
|
|
|
|
|
var compareResult = InnerCompareBC(bcStoreInfo,orderInfo, ctnList);
|
|
|
|
|
|
|
|
|
|
if(!compareResult.succ)
|
|
|
|
|
{
|
|
|
|
|
//更新任务的反馈结果
|
|
|
|
|
model.RESULT_NOTE = compareResult.msg;
|
|
|
|
|
model.UpdatedTime = DateTime.Now;
|
|
|
|
|
model.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
model.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName,
|
|
|
|
|
it.RESULT_NOTE,
|
|
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//置任务状态为完成
|
|
|
|
|
model.STATUS = TaskStatusEnum.Complete.ToString();
|
|
|
|
|
model.STATUS_NAME = TaskStatusEnum.Complete.GetDescription();
|
|
|
|
|
model.COMPLETE_DATE = DateTime.Now;
|
|
|
|
|
model.COMPLETE_DEAL = TaskCompleteDealEnum.MANUAL.ToString();
|
|
|
|
|
model.COMPLETE_DEAL_NAME = TaskCompleteDealEnum.MANUAL.GetDescription();
|
|
|
|
|
|
|
|
|
|
model.UpdatedTime = DateTime.Now;
|
|
|
|
|
model.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
model.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _taskBaseInfoRepository.AsUpdateable(model).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName,
|
|
|
|
|
it.STATUS,
|
|
|
|
|
it.STATUS_NAME,
|
|
|
|
|
it.COMPLETE_DATE,
|
|
|
|
|
it.COMPLETE_DEAL,
|
|
|
|
|
it.COMPLETE_DEAL_NAME
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//更新订舱的ETD(记个日志)
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bcStoreInfo.ETD))
|
|
|
|
|
{
|
|
|
|
|
DateTime etd = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
if(DateTime.TryParse(bcStoreInfo.ETD,out etd))
|
|
|
|
|
{
|
|
|
|
|
orderInfo.ETD = etd;
|
|
|
|
|
orderInfo.UpdatedTime = DateTime.Now;
|
|
|
|
|
orderInfo.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
orderInfo.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _bookingOrderRepository.AsUpdateable(orderInfo).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName,
|
|
|
|
|
it.ETD
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//【预留】异步推送后台任务(订舱自动放舱-BookingFangCang)
|
|
|
|
|
//【预留】异步推送后台任务(下货纸-Xiahuozhi)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "处理成功";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"手工重新比对BC异常,{ex.Message}";
|
|
|
|
|
|
|
|
|
|
//throw Oops.Bah("手工重新比对BC异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 单票比对BC
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 单票比对BC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bcStoreInfo">BC回执详情</param>
|
|
|
|
|
/// <param name="orderInfo">订舱详情</param>
|
|
|
|
|
/// <param name="ctnList">订舱集装箱列表</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
private TaskManageOrderResultDto InnerCompareBC(TaskBCStoreResultInfo bcStoreInfo,BookingOrder orderInfo,List<BookingCtn> ctnList)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto { succ = true};
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<Tuple<bool, string>> rltTupleList = new List<Tuple<bool, string>>();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
迁移过来的注释
|
|
|
|
|
2021-9-28,需求再变,BC需要再次比对约号
|
|
|
|
|
2021-7-19 需求修改:BC不需要再对比约号
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//约号
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(orderInfo.CONTRACTNO))
|
|
|
|
|
{
|
|
|
|
|
if ((string.IsNullOrWhiteSpace(bcStoreInfo.BJH) || !Regex.IsMatch(orderInfo.CONTRACTNO, $"\\b{bcStoreInfo.BJH.Trim()}\\b"))
|
|
|
|
|
&& (string.IsNullOrWhiteSpace(bcStoreInfo.FWHT) || !Regex.IsMatch(orderInfo.CONTRACTNO, $"\\b{bcStoreInfo.FWHT.Trim()}\\b")))
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "约号不一致"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bcStoreInfo.BJH) || !string.IsNullOrWhiteSpace(bcStoreInfo.FWHT))
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "约号不一致"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 集装箱
|
|
|
|
|
//集装箱
|
|
|
|
|
if (bcStoreInfo.CntrTotal != orderInfo.CNTRTOTAL)
|
|
|
|
|
{
|
|
|
|
|
//集装箱型
|
|
|
|
|
var ediCtnList = _cache.GetAllMappingCtn().GetAwaiter().GetResult()
|
|
|
|
|
.Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(t.CarrierCode) && t.CarrierCode.Equals(orderInfo.CARRIERID, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
var storeCtnList = bcStoreInfo.CntrTotal.Split(new char[] { ';' }).Select(t =>
|
|
|
|
|
{
|
|
|
|
|
var currArg = t.Split(new char[] { 'x' });
|
|
|
|
|
|
|
|
|
|
return new { Code = currArg[1]?.Trim(), Num = int.Parse(currArg[0]?.Trim()) };
|
|
|
|
|
}).GroupBy(t => t.Code)
|
|
|
|
|
.Select(t =>
|
|
|
|
|
{
|
|
|
|
|
return new { Code = t.Key, Num = t.Sum(x => x.Num) };
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var orderCtnListctnList = ctnList.Select(t =>
|
|
|
|
|
{
|
|
|
|
|
var mapCtn = ediCtnList.FirstOrDefault(x => x.Code.Equals(t.CTNCODE));
|
|
|
|
|
|
|
|
|
|
if (mapCtn != null && !string.IsNullOrWhiteSpace(mapCtn.MapCode))
|
|
|
|
|
return new { Code = mapCtn.MapCode, Num = t.CTNNUM.HasValue ? t.CTNNUM.Value : 1 };
|
|
|
|
|
|
|
|
|
|
return new { Code = t.CTNCODE, Num = t.CTNNUM.HasValue ? t.CTNNUM.Value : 1 };
|
|
|
|
|
}).GroupBy(t => t.Code)
|
|
|
|
|
.Select(t =>
|
|
|
|
|
{
|
|
|
|
|
return new { Code = t.Key, Num = t.Sum(x => x.Num) };
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
if (storeCtnList.Count != orderCtnListctnList.Count)
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "箱型箱量不一致"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var totalList = storeCtnList.GroupJoin(orderCtnListctnList, l => l.Code, r => r.Code, (l, r) =>
|
|
|
|
|
{
|
|
|
|
|
var rModel = r.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (rModel == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (l.Num != rModel.Num)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
if (totalList.Any(t => !t))
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "箱型箱量不一致"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//船名
|
|
|
|
|
if (bcStoreInfo.Vessel != orderInfo.VESSEL?.Trim())
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "船名不一致"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//航次
|
|
|
|
|
if (bcStoreInfo.Voyno?.Replace("1MA", "") != orderInfo.VOYNO?.Trim()
|
|
|
|
|
&& bcStoreInfo.Voyno2 != orderInfo.VOYNO?.Trim() && bcStoreInfo.Voyno3 != orderInfo.VOYNO?.Trim())
|
|
|
|
|
{
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "航次不一致"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//2021-10-12,增加最小、最大、运输温度,湿度,通风 的比较
|
|
|
|
|
//2021-11-23,备注中含有NOR,不比较温度湿度等信息
|
|
|
|
|
|
|
|
|
|
2023-02-02 这里补充了一下EDIREMARK的判断,用正则匹配NOR信息。NOR(冻代干集装箱)
|
|
|
|
|
*/
|
|
|
|
|
if (orderInfo.CARGOID == "R" && (string.IsNullOrWhiteSpace(orderInfo.SOREMARK) || !Regex.IsMatch(orderInfo.SOREMARK, "\\bNOR\\b")))
|
|
|
|
|
{
|
|
|
|
|
//最低温度
|
|
|
|
|
var compareReult = CompareTemperatureNum(orderInfo.TEMPMIN, bcStoreInfo.TempMin, "temp");
|
|
|
|
|
|
|
|
|
|
if (!compareReult.Item1)
|
|
|
|
|
rltTupleList.Add(compareReult);
|
|
|
|
|
|
|
|
|
|
//最高温度
|
|
|
|
|
compareReult = CompareTemperatureNum(orderInfo.TEMPMAX, bcStoreInfo.TempMax, "temp", "最高温度");
|
|
|
|
|
|
|
|
|
|
if (!compareReult.Item1)
|
|
|
|
|
rltTupleList.Add(compareReult);
|
|
|
|
|
|
|
|
|
|
//运输温度
|
|
|
|
|
compareReult = CompareTemperatureNum(orderInfo.TEMPSET, bcStoreInfo.TempTransport, "temp", "运输温度");
|
|
|
|
|
|
|
|
|
|
if (!compareReult.Item1)
|
|
|
|
|
rltTupleList.Add(compareReult);
|
|
|
|
|
|
|
|
|
|
//湿度
|
|
|
|
|
compareReult = CompareTemperatureNum(orderInfo.HUMIDITY, bcStoreInfo.Humidity, "humidity", "湿度");
|
|
|
|
|
|
|
|
|
|
if (!compareReult.Item1)
|
|
|
|
|
rltTupleList.Add(compareReult);
|
|
|
|
|
|
|
|
|
|
//通风
|
|
|
|
|
compareReult = CompareTemperatureNum(orderInfo.REEFERF, bcStoreInfo.VentilationCubicMeter, "vent", "通风");
|
|
|
|
|
|
|
|
|
|
if (!compareReult.Item1)
|
|
|
|
|
rltTupleList.Add(compareReult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 2021-12-3,捷丰要求加卸货港和目的地校验,规则:
|
|
|
|
|
* A:大简云里卸货港字段‘,’之前的字符和BC里卸货港‘,’之前的字段。
|
|
|
|
|
* 1.一致,自动发送下货纸
|
|
|
|
|
* 2.不一致,生成待处理下货纸任务。
|
|
|
|
|
* B:bc如果有最终交货地 那么要和系统目的港对比;最终交货地空白 就不用对比这个地方
|
|
|
|
|
*/
|
|
|
|
|
string orderPortDischarge = orderInfo.PORTDISCHARGE.Split(new char[] { ',' }).FirstOrDefault()?.Trim();
|
|
|
|
|
string storePortDischarge = bcStoreInfo.PortDischargeEName.Split(new char[] { ',' }).FirstOrDefault()?.Trim();
|
|
|
|
|
|
|
|
|
|
if (orderPortDischarge != storePortDischarge)
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "卸货港不一致"));
|
|
|
|
|
|
|
|
|
|
string orderDest = orderInfo.DESTINATION.Split(new char[] { ',' }).FirstOrDefault()?.Trim();
|
|
|
|
|
string storeDest = bcStoreInfo.ZZJHD.Split(new char[] { ',' }).FirstOrDefault()?.Trim();
|
|
|
|
|
|
|
|
|
|
if (orderDest != storeDest)
|
|
|
|
|
rltTupleList.Add(new Tuple<bool, string>(false, "目的地不一致"));
|
|
|
|
|
|
|
|
|
|
if (rltTupleList.Any(t => !t.Item1))
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = string.Join(";", rltTupleList.Select(t => t.Item2).ToArray());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("{0}单票比对BC异常,{1}",nameof(InnerCompareBC), ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 对比温度
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对比温度
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="orderTemperature">订舱数值</param>
|
|
|
|
|
/// <param name="storeTemperature">回执数值</param>
|
|
|
|
|
/// <param name="operType">操作类型 temp-温度 humidity-湿度 vent-通风</param>
|
|
|
|
|
/// <param name="showName">显示名称</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
private Tuple<bool, string> CompareTemperatureNum(string orderTemperature,string storeTemperature,string operType = "temp",string showName = "最低温度")
|
|
|
|
|
{
|
|
|
|
|
decimal orderTemp = int.MaxValue;
|
|
|
|
|
decimal storeTemp = int.MaxValue;
|
|
|
|
|
|
|
|
|
|
decimal.TryParse(orderTemperature, out orderTemp);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(storeTemperature))
|
|
|
|
|
{
|
|
|
|
|
if (operType == "temp")
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(Regex.Match(storeTemperature, "(\\-?([0-9]?|[0-9]+)\\.?[0-9]+)(?=C)").Value, out storeTemp);
|
|
|
|
|
}
|
|
|
|
|
else if (operType == "humidity")
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(Regex.Match(storeTemperature, "\\[0-9]+").Value, out storeTemp);
|
|
|
|
|
}
|
|
|
|
|
else if (operType == "vent")
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(storeTemperature, out storeTemp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (storeTemp != int.MaxValue && orderTemp != int.MaxValue)
|
|
|
|
|
{
|
|
|
|
|
if (storeTemp != orderTemp)
|
|
|
|
|
return new Tuple<bool, string>(false, $"{showName}不一致");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (storeTemp != int.MaxValue || orderTemp != int.MaxValue)
|
|
|
|
|
return new Tuple<bool, string>(false, $"{showName}不一致");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Tuple<bool, string>(true, "");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下载截单EDI
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下载截单EDI
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">任务主键</param>
|
|
|
|
|
/// <param name="orderNo">订单号</param>
|
|
|
|
|
/// <param name="useForwarderCode">是否使用货代代码</param>
|
|
|
|
|
/// <param name="forwarderCode">货代代码</param>
|
|
|
|
|
/// <param name="forwarderName">货代称呼</param>
|
|
|
|
|
/// <param name="fileRole">文件功能 (9原始,1 更新,5 退舱 )</param>
|
|
|
|
|
/// <param name="sendType">发送类型 E-截单</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpGet("/TaskManage/DownloadClosingEDI")]
|
|
|
|
|
public async Task<IActionResult> DownloadClosingEDI([FromQuery] string taskPKId, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode,
|
|
|
|
|
[FromQuery] string forwarderCode, [FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType)
|
|
|
|
|
{
|
|
|
|
|
if (sendType?.ToUpper() != "E")
|
|
|
|
|
throw Oops.Oh($"sendType只接收E-截单");
|
|
|
|
|
|
|
|
|
|
var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId);
|
|
|
|
|
|
|
|
|
|
if (taskInfo == null)
|
|
|
|
|
throw Oops.Oh($"任务信息获取失败");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
|
|
|
|
|
throw Oops.Oh($"任务信息的订舱主键不存在");
|
|
|
|
|
|
|
|
|
|
if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.SI_FEEDBACK.ToString())
|
|
|
|
|
throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.SI_FEEDBACK.GetDescription()}");
|
|
|
|
|
|
|
|
|
|
BookingOrder bookingOrder = null;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
|
|
|
|
|
bookingOrder = _bookingOrderRepository.AsQueryable().First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO));
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,MBLNO={taskInfo.MBL_NO}");
|
|
|
|
|
|
|
|
|
|
var model = new BookingOrClosingEDIOrderDto
|
|
|
|
|
{
|
|
|
|
|
Id = bookingOrder.Id,
|
|
|
|
|
orderNo = orderNo,
|
|
|
|
|
useForwarderCode = useForwarderCode,
|
|
|
|
|
forwarderCode = forwarderCode,
|
|
|
|
|
forwarderName = forwarderName,
|
|
|
|
|
fileRole = fileRole,
|
|
|
|
|
send = false,
|
|
|
|
|
sendType = sendType
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
|
|
|
|
|
|
var filePath = await bookingOrderService.InnerBookingOrClosingEDI(model);
|
|
|
|
|
|
|
|
|
|
var fileInfo = new FileInfo(filePath);
|
|
|
|
|
|
|
|
|
|
var result = new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileInfo.Name };
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 发送截单EDI
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发送截单EDI
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">任务主键</param>
|
|
|
|
|
/// <param name="orderNo">订单号</param>
|
|
|
|
|
/// <param name="useForwarderCode">是否使用货代代码</param>
|
|
|
|
|
/// <param name="forwarderCode">货代代码</param>
|
|
|
|
|
/// <param name="forwarderName">货代称呼</param>
|
|
|
|
|
/// <param name="fileRole">文件功能 (9原始,1 更新,5 退舱 )</param>
|
|
|
|
|
/// <param name="sendType">发送类型 E-截单</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpGet("/TaskManage/SendClosingEDI")]
|
|
|
|
|
public async Task<string> SendClosingEDI([FromQuery] string taskPKId, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode,
|
|
|
|
|
[FromQuery] string forwarderCode, [FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType)
|
|
|
|
|
{
|
|
|
|
|
if (sendType?.ToUpper() != "E")
|
|
|
|
|
throw Oops.Oh($"sendType只接收E-截单");
|
|
|
|
|
|
|
|
|
|
var taskInfo = _taskBaseInfoRepository.AsQueryable().First(t => t.PK_ID == taskPKId);
|
|
|
|
|
|
|
|
|
|
if (taskInfo == null)
|
|
|
|
|
throw Oops.Oh($"任务信息获取失败");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
|
|
|
|
|
throw Oops.Oh($"任务信息的订舱主键不存在");
|
|
|
|
|
|
|
|
|
|
if (taskInfo.TASK_TYPE != TaskBusiTypeEnum.SI_FEEDBACK.ToString())
|
|
|
|
|
throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.SI_FEEDBACK.GetDescription()}");
|
|
|
|
|
|
|
|
|
|
BookingOrder bookingOrder = null;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(taskInfo.BOOK_ORDER_NO))
|
|
|
|
|
bookingOrder = _bookingOrderRepository.AsQueryable().First(t => t.Id == long.Parse(taskInfo.BOOK_ORDER_NO));
|
|
|
|
|
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,MBLNO={taskInfo.MBL_NO}");
|
|
|
|
|
|
|
|
|
|
var model = new BookingOrClosingEDIOrderDto
|
|
|
|
|
{
|
|
|
|
|
Id = bookingOrder.Id,
|
|
|
|
|
orderNo = orderNo,
|
|
|
|
|
useForwarderCode = useForwarderCode,
|
|
|
|
|
forwarderCode = forwarderCode,
|
|
|
|
|
forwarderName = forwarderName,
|
|
|
|
|
fileRole = fileRole,
|
|
|
|
|
send = true,
|
|
|
|
|
sendType = sendType
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
|
|
|
|
|
|
return await bookingOrderService.InnerBookingOrClosingEDI(model);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计算LARA纸计算页数
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算LARA纸计算页数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">请求LARA纸详情</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpPost("/TaskManage/CalcLaraPageNumbers")]
|
|
|
|
|
public async Task<List<LaraPaperRegistPostDto>> CalcLaraPageNumbers(CalcLaraPageNumbersDto model)
|
|
|
|
|
{
|
|
|
|
|
List<LaraPaperRegistPostDto> list = new List<LaraPaperRegistPostDto>();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
LARA计算方法
|
|
|
|
|
|
|
|
|
|
1、判断是否为首次加载,model.moveType为空时表示首次加载,触发InitCalcLaraPageNumbers方法。
|
|
|
|
|
2、如果 model.moveType有值时,判断是调整行位置,根据指定的行位置重新计算编号。
|
|
|
|
|
*/
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrWhiteSpace(model.moveType))
|
|
|
|
|
{
|
|
|
|
|
list = InnerCalcLaraPageNumbers(model,true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
list = InnerCalcLaraPageNumbers(model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("计算LARA纸计算页数异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计算LARA纸
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计算LARA纸
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">请求LARA纸详情</param>
|
|
|
|
|
/// <param name="isInit">是否初始化 true-初始化</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private List<LaraPaperRegistPostDto> InnerCalcLaraPageNumbers(CalcLaraPageNumbersDto model,bool isInit = false)
|
|
|
|
|
{
|
|
|
|
|
List<LaraPaperRegistPostDto> list = new List<LaraPaperRegistPostDto>();
|
|
|
|
|
|
|
|
|
|
//如果判断不是首次加载,需要将移动的行从列表移动到指定位置后,重新计算。
|
|
|
|
|
if(!isInit)
|
|
|
|
|
{
|
|
|
|
|
model.paperList = model.paperList.Select(t =>
|
|
|
|
|
{
|
|
|
|
|
if (t.SortNo == model.origIndex.Value)
|
|
|
|
|
{
|
|
|
|
|
//up
|
|
|
|
|
if(model.currIndex < model.origIndex)
|
|
|
|
|
{
|
|
|
|
|
t.SortNo = (decimal)model.currIndex.Value - 0.1m;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
t.SortNo = (decimal)model.currIndex.Value + 0.1m;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
|
}).OrderBy(t => t.SortNo)
|
|
|
|
|
.Select((t, idx) =>
|
|
|
|
|
{
|
|
|
|
|
t.SortNo = (decimal)idx + 1;
|
|
|
|
|
return t;
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mNumberTo = int.Parse(model.numberTo.TrimStart('0'));
|
|
|
|
|
|
|
|
|
|
if (mNumberTo > 0)
|
|
|
|
|
{
|
|
|
|
|
int lastNumberTo = 0;
|
|
|
|
|
int lastNumberFrom = 0;
|
|
|
|
|
|
|
|
|
|
model.paperList.OrderBy(t => t.SortNo).ToList().ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
LaraPaperRegistPostDto info = new LaraPaperRegistPostDto();
|
|
|
|
|
|
|
|
|
|
info.SortNo = t.SortNo;
|
|
|
|
|
info.DraftNum = t.DraftNum;
|
|
|
|
|
info.TaskId = t.TaskId;
|
|
|
|
|
info.ORDNO = t.ORDNO;
|
|
|
|
|
info.MBLNO = t.MBLNO;
|
|
|
|
|
info.ISSUETYPE = t.ISSUETYPE;
|
|
|
|
|
|
|
|
|
|
if (t.SortNo == 1)
|
|
|
|
|
{
|
|
|
|
|
lastNumberFrom = mNumberTo + 1;
|
|
|
|
|
info.NumberFrom = (lastNumberFrom).ToString().PadLeft(9, '0');
|
|
|
|
|
|
|
|
|
|
var currNumberTo = (t.DraftNum * LARA_PARER_DRAFT_VAR) + mNumberTo;
|
|
|
|
|
|
|
|
|
|
info.NumberTo = currNumberTo.ToString().PadLeft(9, '0');
|
|
|
|
|
info.PageSum = currNumberTo - lastNumberFrom + 1;
|
|
|
|
|
|
|
|
|
|
lastNumberTo = currNumberTo;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lastNumberFrom = lastNumberTo + 1;
|
|
|
|
|
info.NumberFrom = (lastNumberFrom).ToString().PadLeft(9, '0');
|
|
|
|
|
|
|
|
|
|
var currNumberTo = (t.DraftNum * LARA_PARER_DRAFT_VAR) + lastNumberTo;
|
|
|
|
|
|
|
|
|
|
info.NumberTo = currNumberTo.ToString().PadLeft(9, '0');
|
|
|
|
|
info.PageSum = currNumberTo - lastNumberFrom + 1;
|
|
|
|
|
|
|
|
|
|
lastNumberTo = currNumberTo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list.Add(info);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 样本业务提取帮助类
|
|
|
|
|