|
|
|
@ -2646,7 +2646,7 @@ namespace Myshipping.Application
|
|
|
|
|
.Select((si, ctn) => new { si = si, ctn = ctn }).ToList();
|
|
|
|
|
|
|
|
|
|
if (siFeedBackList.Count == 0)
|
|
|
|
|
Oops.Oh($"SI反馈信息不存在");
|
|
|
|
|
throw Oops.Oh($"SI反馈信息不存在");
|
|
|
|
|
|
|
|
|
|
var siFeedBackInfo = siFeedBackList.FirstOrDefault().si;
|
|
|
|
|
|
|
|
|
@ -2866,6 +2866,220 @@ namespace Myshipping.Application
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取VGM比较结果
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">任务主键</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpGet("/TaskManage/GetVGMCompareResult")]
|
|
|
|
|
public async Task<TaskVgmCompareResultDto> GetVGMCompareResult(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
TaskVgmCompareResultDto model = new TaskVgmCompareResultDto();
|
|
|
|
|
|
|
|
|
|
List<TaskVgmCompareDto> list = new List<TaskVgmCompareDto>();
|
|
|
|
|
List<TaskVgmCompareDto> list2 = new List<TaskVgmCompareDto>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
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.VGM_COMPARE.ToString())
|
|
|
|
|
throw Oops.Oh($"当前任务类型不是{TaskBusiTypeEnum.VGM_COMPARE.GetDescription()}");
|
|
|
|
|
|
|
|
|
|
var vgmList = _taskVGMFeedBackInfoRepository.AsQueryable().Where(t => t.TASK_PKID == taskInfo.PK_ID)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
if(vgmList.Count == 0)
|
|
|
|
|
throw Oops.Oh($"VGM反馈信息不存在");
|
|
|
|
|
|
|
|
|
|
var contaList = _bookingOrderContaRepository.AsQueryable().Where(t => t.BILLID == long.Parse(taskInfo.BOOK_ORDER_NO)).ToList();
|
|
|
|
|
|
|
|
|
|
list = contaList.GroupJoin(vgmList, l => l.CNTRNO?.Trim(), r => r.CONTA_NO?.Trim(), (l, r) => {
|
|
|
|
|
var currInfo = r.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
TaskVgmCompareDto md = l.Adapt<TaskVgmCompareDto>();
|
|
|
|
|
|
|
|
|
|
if (currInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if(!l.SEALNO.Equals(currInfo.SEAL_NO))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CTNCODE.Equals(currInfo.CONTA_TYPE))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CTNALL.Equals(currInfo.CONTA_TYPE_NAME))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName));
|
|
|
|
|
}
|
|
|
|
|
if (!l.KGS.Equals(currInfo.KGS))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS));
|
|
|
|
|
}
|
|
|
|
|
if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList = new List<string> { nameof(TaskVgmCompareDto.ContaNo),
|
|
|
|
|
nameof(TaskVgmCompareDto.SealNo),
|
|
|
|
|
nameof(TaskVgmCompareDto.ContaType),
|
|
|
|
|
nameof(TaskVgmCompareDto.ContaTypeName),
|
|
|
|
|
nameof(TaskVgmCompareDto.KGS),
|
|
|
|
|
nameof(TaskVgmCompareDto.TareWeight),
|
|
|
|
|
nameof(TaskVgmCompareDto.WeighKGs),
|
|
|
|
|
nameof(TaskVgmCompareDto.WeighType),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return md;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
model.bookOrderCompareList = list;
|
|
|
|
|
|
|
|
|
|
list2 = vgmList.GroupJoin(contaList, l => l.CONTA_NO?.Trim(), r => r.CNTRNO?.Trim(), (l, r) => {
|
|
|
|
|
var currInfo = r.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
TaskVgmCompareDto md = l.Adapt<TaskVgmCompareDto>();
|
|
|
|
|
|
|
|
|
|
if (currInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if (!l.SEAL_NO.Equals(currInfo.SEALNO))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.SealNo));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CONTA_TYPE.Equals(currInfo.CTNCODE))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaType));
|
|
|
|
|
}
|
|
|
|
|
if (!l.CONTA_TYPE_NAME.Equals(currInfo.CTNALL))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.ContaTypeName));
|
|
|
|
|
}
|
|
|
|
|
if (!l.KGS.Equals(currInfo.KGS))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.KGS));
|
|
|
|
|
}
|
|
|
|
|
if (!l.TAREWEIGHT.Equals(currInfo.TAREWEIGHT))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.TareWeight));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHKGS.Equals(currInfo.WEIGHKGS))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighKGs));
|
|
|
|
|
}
|
|
|
|
|
if (!l.WEIGHTYPE.Equals(currInfo.WEIGHTYPE))
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList.Add(nameof(TaskVgmCompareDto.WeighType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
md.compareDiffList = new List<string> { nameof(TaskVgmCompareDto.ContaNo),
|
|
|
|
|
nameof(TaskVgmCompareDto.SealNo),
|
|
|
|
|
nameof(TaskVgmCompareDto.ContaType),
|
|
|
|
|
nameof(TaskVgmCompareDto.ContaTypeName),
|
|
|
|
|
nameof(TaskVgmCompareDto.KGS),
|
|
|
|
|
nameof(TaskVgmCompareDto.TareWeight),
|
|
|
|
|
nameof(TaskVgmCompareDto.WeighKGs),
|
|
|
|
|
nameof(TaskVgmCompareDto.WeighType),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return md;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
model.vgmCompareList = list2;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"获取VGM比较结果异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新订舱(VGM比较更新)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskPKId">任务主键</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
[HttpPost("/TaskManage/SaveBookingVGM")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SaveBookingVGM(string taskPKId)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
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()}");
|
|
|
|
|
|
|
|
|
|
var bookOrderList = _bookingOrderRepository.EntityContext.Queryable<BookingOrder>()
|
|
|
|
|
.InnerJoin<BookingCtn>((bk, ctn) => bk.Id == ctn.BILLID)
|
|
|
|
|
.Where((bk, ctn) => bk.Id == long.Parse(taskInfo.BOOK_ORDER_NO) && bk.TenantId == UserManager.TENANT_ID)
|
|
|
|
|
.Select((bk, ctn) => new { bk = bk, ctn = ctn }).ToList();
|
|
|
|
|
|
|
|
|
|
var orderInfo = bookOrderList.FirstOrDefault().bk;
|
|
|
|
|
|
|
|
|
|
//比对差异,更新订舱主信息
|
|
|
|
|
var mdBookingOrder = orderInfo.Adapt<BookingOrder>();
|
|
|
|
|
|
|
|
|
|
await _bookingOrderRepository.AsUpdateable(mdBookingOrder).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.ParentId,
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var ctnlist = await _bookingOrderContaRepository.AsQueryable().Where(x => x.BILLID == mdBookingOrder.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
//更新订舱的集装箱信息
|
|
|
|
|
ctnlist.ForEach(async ctn => {
|
|
|
|
|
|
|
|
|
|
await _bookingOrderContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"更新订舱(VGM比较更新)异常,{0}", ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 样本业务提取帮助类
|
|
|
|
|