|
|
@ -290,14 +290,14 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var dicUrl = _cache.GetAllDictData().Result.First(x => x.TypeCode == "url_set" && x.Code == "request_emf");
|
|
|
|
var dicUrl = _cache.GetAllDictData().Result.First(x => x.TypeCode == "url_set" && x.Code == "request_emf");
|
|
|
|
|
|
|
|
|
|
|
|
var waitCheckSeaList = new List<BookingOrderSeaeEdi>();
|
|
|
|
long bookingId = 0;
|
|
|
|
var waitCheckSeaCtnList = new List<BookingOrderSeaeEdiCtn>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
foreach (var ar in arr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
var order = await _seaeedi.AsQueryable().Filter(null, true).Where(x => x.Id == Id).FirstAsync();
|
|
|
|
var order = await _seaeedi.AsQueryable().Filter(null, true).Where(x => x.Id == Id).FirstAsync();
|
|
|
|
var ctns = await _seaeedictn.AsQueryable().Filter(null, true).Where(x => x.PId == order.Id).ToListAsync();
|
|
|
|
var ctns = await _seaeedictn.AsQueryable().Filter(null, true).Where(x => x.PId == order.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingId = order.BookingId;
|
|
|
|
//船公司
|
|
|
|
//船公司
|
|
|
|
if (string.IsNullOrEmpty(order.CARRIER))
|
|
|
|
if (string.IsNullOrEmpty(order.CARRIER))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -342,63 +342,56 @@ namespace Myshipping.Application
|
|
|
|
MDATA = mDATA,
|
|
|
|
MDATA = mDATA,
|
|
|
|
CTNDATA = CTNDATA
|
|
|
|
CTNDATA = CTNDATA
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
waitCheckSeaList.Add(order);
|
|
|
|
|
|
|
|
waitCheckSeaCtnList.AddRange(ctns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 舱单发送前,校验
|
|
|
|
#region 舱单发送前,校验
|
|
|
|
if (isCheck == true && (type is "1" or "0"))
|
|
|
|
if (isCheck == true && (type is "1" or "0") && custEDIDtos.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var checkResult = new List<string>();
|
|
|
|
|
|
|
|
// 需要在舱单发送前增加以下字段的比对,由舱单字段与订舱数据字段做比对,比对存在异常提醒客户是否确认发送,对比字段如下:
|
|
|
|
// 需要在舱单发送前增加以下字段的比对,由舱单字段与订舱数据字段做比对,比对存在异常提醒客户是否确认发送,对比字段如下:
|
|
|
|
// 主单提单号:主单主单提单号与订舱主提单号不一致时提醒
|
|
|
|
// 主单提单号:主单主单提单号与订舱主提单号不一致时提醒
|
|
|
|
// 船名航次,唛头,货描 ,起运港,卸货港:主单与订舱 或 分单与主单不一致时提醒
|
|
|
|
// 船名航次,唛头,货描 ,起运港,卸货港:主单与订舱 或 分单与主单不一致时提醒
|
|
|
|
// 件数,重量,尺码(按箱子判断):分单之和>主单 或 主单 != 订舱 时提醒
|
|
|
|
// 件数,重量,尺码(按箱子判断):分单之和>主单 或 主单 != 订舱 时提醒
|
|
|
|
// 箱封号、箱型:主单的箱封号+箱型与订舱不一致时提醒、分单中出现主单中不存在的箱封号+箱型时提醒
|
|
|
|
// 箱封号、箱型:主单的箱封号+箱型与订舱不一致时提醒、分单中出现主单中不存在的箱封号+箱型时提醒
|
|
|
|
|
|
|
|
|
|
|
|
// 订舱主键
|
|
|
|
var seaeList = await _seaeedi.AsQueryable()
|
|
|
|
var bkOrderId = waitCheckSeaList[0].BookingId;
|
|
|
|
.Filter(null, true)
|
|
|
|
|
|
|
|
.Where(x => x.BookingId == bookingId)
|
|
|
|
// 订舱记录
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
var seaeCtnList = await _seaeedictn.AsQueryable()
|
|
|
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
|
|
|
.Where(x => seaeList.Select(x => x.Id).Contains(x.PId))
|
|
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
var bkOrder = await _repBookingOrder.AsQueryable()
|
|
|
|
var bkOrder = await _repBookingOrder.AsQueryable()
|
|
|
|
.Filter(null, true)
|
|
|
|
.Filter(null, true)
|
|
|
|
.Where(x => x.Id == bkOrderId && x.IsDeleted == false)
|
|
|
|
.Where(x => x.Id == bookingId && x.IsDeleted == false)
|
|
|
|
.FirstAsync();
|
|
|
|
.FirstAsync();
|
|
|
|
|
|
|
|
var bkOrderCtnList = await _repBookingCtn.AsQueryable()
|
|
|
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
|
|
|
.Where(x => x.BILLID == bookingId && x.IsDeleted == false)
|
|
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
if (bkOrder == null)
|
|
|
|
if (bkOrder == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw Oops.Bah("未找到订舱数据");
|
|
|
|
throw Oops.Bah("未找到订舱数据");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var 订舱箱子列表 = await _repBookingCtn.AsQueryable()
|
|
|
|
|
|
|
|
.Filter(null, true)
|
|
|
|
var checkResult = new List<string>();
|
|
|
|
.Where(x => x.BILLID == bkOrderId && x.IsDeleted == false)
|
|
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 舱单主单
|
|
|
|
// 舱单主单
|
|
|
|
var mainSeaOrder = waitCheckSeaList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.HBLNO));
|
|
|
|
var mainSeaOrder = seaeList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.HBLNO));
|
|
|
|
|
|
|
|
|
|
|
|
// 是否检验舱单主单
|
|
|
|
|
|
|
|
var isCheckMainSea = true;
|
|
|
|
|
|
|
|
if (mainSeaOrder == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isCheckMainSea = false;
|
|
|
|
|
|
|
|
mainSeaOrder = await _seaeedi.AsQueryable().Filter(null, true).Where(x => x.BookingId == bkOrderId && string.IsNullOrWhiteSpace(x.HBLNO)).FirstAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 舱单分单
|
|
|
|
// 舱单分单
|
|
|
|
var subSeaOrderList = waitCheckSeaList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList();
|
|
|
|
var subSeaOrderList = seaeList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// 校验1:船名航次,唛头,货描 ,起运港,卸货港,主单提单号
|
|
|
|
// 校验规则1:船名航次,唛头,货描 ,起运港,卸货港,主单提单号
|
|
|
|
if (isCheckMainSea)
|
|
|
|
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
|
|
|
|
{
|
|
|
|
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
|
|
|
|
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
|
|
|
|
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
|
|
|
|
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
|
|
|
|
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
|
|
|
|
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
|
|
|
|
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致");
|
|
|
|
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
|
|
|
|
if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致");
|
|
|
|
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) checkResult.Add("舱单主单与订舱【货描】不一致");
|
|
|
|
if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致");
|
|
|
|
if (bkOrder.PORTLOADID != mainSeaOrder.PORTLOADID || bkOrder.PORTLOAD != mainSeaOrder.PORTLOAD) checkResult.Add("舱单主单与订舱【起运港】不一致");
|
|
|
|
|
|
|
|
if (bkOrder.PORTDISCHARGEID != mainSeaOrder.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != mainSeaOrder.PORTDISCHARGE) checkResult.Add("舱单主单与订舱【卸货港】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subSeaOrderList.ForEach(x =>
|
|
|
|
subSeaOrderList.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -411,64 +404,86 @@ namespace Myshipping.Application
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 校验2:件重尺
|
|
|
|
// 校验规则2:件重尺
|
|
|
|
var 主单箱子列表 = waitCheckSeaCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList();
|
|
|
|
// 先进行件重尺总数的比较
|
|
|
|
var 分单箱子列表 = waitCheckSeaCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList();
|
|
|
|
var 主单箱子列表 = seaeCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList();
|
|
|
|
|
|
|
|
var 分单箱子列表 = seaeCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (主单箱子列表.Sum(x => x.PKGS) != bkOrderCtnList.Sum(x => x.PKGS))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单主单中箱子的【总件数】与订舱中箱子的【总件数】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (主单箱子列表.Sum(x => x.KGS) != bkOrderCtnList.Sum(x => x.KGS))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单主单中箱子的【总重量】与订舱中箱子的【总重量】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (主单箱子列表.Sum(x => x.CBM) != bkOrderCtnList.Sum(x => x.CBM))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单主单中箱子的【总尺码】与订舱中箱子的【总尺码】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (分单箱子列表.Sum(x => x.PKGS) != bkOrderCtnList.Sum(x => x.PKGS))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单分单中箱子的【总件数】与订舱中箱子的【总件数】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (分单箱子列表.Sum(x => x.KGS) != bkOrderCtnList.Sum(x => x.KGS))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单分单中箱子的【总重量】与订舱中箱子的【总重量】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (分单箱子列表.Sum(x => x.CBM) != bkOrderCtnList.Sum(x => x.CBM))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单分单中箱子的【总尺码】与订舱中箱子的【总尺码】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isCheckMainSea)
|
|
|
|
// 再按箱号比较
|
|
|
|
|
|
|
|
foreach (var item in 主单箱子列表.GroupBy(x => x.CNTRNO))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var item in 主单箱子列表.GroupBy(x => x.CNTRNO))
|
|
|
|
if (item.Sum(x => x.PKGS) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (item.Sum(x => x.PKGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
|
|
|
|
{
|
|
|
|
}
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
|
|
|
|
if (item.Sum(x => x.KGS) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
|
|
|
|
}
|
|
|
|
{
|
|
|
|
if (item.Sum(x => x.KGS) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
|
|
|
|
{
|
|
|
|
}
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
|
|
|
|
if (item.Sum(x => x.CBM) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
|
|
|
|
}
|
|
|
|
{
|
|
|
|
if (item.Sum(x => x.CBM) != 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in 分单箱子列表.GroupBy(x => x.CNTRNO))
|
|
|
|
foreach (var item in 分单箱子列表.GroupBy(x => x.CNTRNO))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (item.Sum(x => x.PKGS) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
|
|
|
|
if (item.Sum(x => x.PKGS) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于订舱中同箱号箱子的件数");
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】与订舱中同箱号箱子的【件数】不一致");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item.Sum(x => x.KGS) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
|
|
|
|
if (item.Sum(x => x.KGS) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于订舱中同箱号箱子的重量");
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】与订舱中同箱号箱子的【重量】不一致");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item.Sum(x => x.CBM) > 订舱箱子列表.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
|
|
|
|
if (item.Sum(x => x.CBM) != bkOrderCtnList.Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于订舱中同箱号箱子的尺码");
|
|
|
|
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】与订舱中同箱号箱子的【尺码】不一致");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 校验3:箱号+封号+箱型
|
|
|
|
// 校验规则3:箱号+封号+箱型
|
|
|
|
var 订舱箱封号箱型列表 = 订舱箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList();
|
|
|
|
var 订舱箱封号箱型列表 = bkOrderCtnList.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList();
|
|
|
|
var 主单箱封号箱型列表 = 主单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList();
|
|
|
|
var 主单箱封号箱型列表 = 主单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").ToList();
|
|
|
|
var 分单箱封号箱型列表 = 分单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").Distinct().ToList();
|
|
|
|
var 分单箱封号箱型列表 = 分单箱子列表.Select(x => $"箱号[{x.CNTRNO}] 封号[{x.SEALNO}] 箱型[{x.CTNALL.Replace("'", "")}]").Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (isCheckMainSea)
|
|
|
|
var list1 = 订舱箱封号箱型列表.Except(主单箱封号箱型列表);
|
|
|
|
|
|
|
|
if (list1.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list1 = 订舱箱封号箱型列表.Except(主单箱封号箱型列表);
|
|
|
|
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join(",", list1)}");
|
|
|
|
if (list1.Any())
|
|
|
|
}
|
|
|
|
{
|
|
|
|
else
|
|
|
|
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join(",", list1)}");
|
|
|
|
{
|
|
|
|
}
|
|
|
|
var list2 = 主单箱封号箱型列表.Except(订舱箱封号箱型列表);
|
|
|
|
else
|
|
|
|
if (list2.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list2 = 主单箱封号箱型列表.Except(订舱箱封号箱型列表);
|
|
|
|
checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join(",", list2)}");
|
|
|
|
if (list2.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join(",", list2)}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var list3 = 分单箱封号箱型列表.Except(订舱箱封号箱型列表);
|
|
|
|
var list3 = 分单箱封号箱型列表.Except(订舱箱封号箱型列表);
|
|
|
@ -477,7 +492,6 @@ namespace Myshipping.Application
|
|
|
|
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join(",", list3)}");
|
|
|
|
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join(",", list3)}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (checkResult.Count > 0)
|
|
|
|
if (checkResult.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UnifyContext.Fill(new { checkResult });
|
|
|
|
UnifyContext.Fill(new { checkResult });
|
|
|
|