舱单发送校验调整

master
zhangxiaofeng 8 months ago
parent 8fbd4ee5b0
commit 8b5cde7015

@ -377,93 +377,96 @@ namespace Myshipping.Application
// 舱单主单
var mainSeaOrder = waitCheckSeaList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.HBLNO));
// 舱单分单
var subSeaOrderList = waitCheckSeaList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList();
// 校验1船名航次唛头货描 ,起运港,卸货港,主单提单号
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) 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 =>
if (mainSeaOrder != null)
{
if (bkOrder.VESSEL != x.VESSEL) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【船名】不一致");
if (bkOrder.VOYNO != x.VOYNO) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【航次】不一致");
if (bkOrder.MARKS != x.MARKS) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != x.DESCRIPTION) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【货描】不一致");
if (bkOrder.PORTLOADID != x.PORTLOADID || bkOrder.PORTLOAD != x.PORTLOAD) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【起运港】不一致");
if (bkOrder.PORTDISCHARGEID != x.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != x.PORTDISCHARGE) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【卸货港】不一致");
});
// 舱单分单
var subSeaOrderList = waitCheckSeaList.Where(x => !string.IsNullOrWhiteSpace(x.HBLNO)).ToList();
// 校验1船名航次唛头货描 ,起运港,卸货港,主单提单号
if (bkOrder.MBLNO != mainSeaOrder.MBLNO) checkResult.Add("舱单主单与订舱【提单号】不一致");
if (bkOrder.VESSEL != mainSeaOrder.VESSEL) checkResult.Add("舱单主单与订舱【船名】不一致");
if (bkOrder.VOYNO != mainSeaOrder.VOYNO) checkResult.Add("舱单主单与订舱【航次】不一致");
if (bkOrder.MARKS != mainSeaOrder.MARKS) checkResult.Add("舱单主单与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != mainSeaOrder.DESCRIPTION) 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 =>
{
if (bkOrder.VESSEL != x.VESSEL) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【船名】不一致");
if (bkOrder.VOYNO != x.VOYNO) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【航次】不一致");
if (bkOrder.MARKS != x.MARKS) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【唛头】不一致");
if (bkOrder.DESCRIPTION != x.DESCRIPTION) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【货描】不一致");
if (bkOrder.PORTLOADID != x.PORTLOADID || bkOrder.PORTLOAD != x.PORTLOAD) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【起运港】不一致");
if (bkOrder.PORTDISCHARGEID != x.PORTDISCHARGEID || bkOrder.PORTDISCHARGE != x.PORTDISCHARGE) checkResult.Add($"舱单分单【{x.HBLNO}】与订舱【卸货港】不一致");
});
// 校验2件重尺
var = waitCheckSeaCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList();
var = waitCheckSeaCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList();
// 校验2件重尺
var = waitCheckSeaCtnList.Where(x => x.PId == mainSeaOrder.Id).ToList();
var = waitCheckSeaCtnList.Where(x => x.PId != mainSeaOrder.Id).ToList();
foreach (var item in .GroupBy(x => x.CNTRNO))
{
if (item.Sum(x => x.PKGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
foreach (var item in .GroupBy(x => x.CNTRNO))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
if (item.Sum(x => x.PKGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【件数】与订舱中同箱号箱子的【件数】不一致");
}
if (item.Sum(x => x.KGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
}
if (item.Sum(x => x.CBM) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
}
}
if (item.Sum(x => x.KGS) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【重量】与订舱中同箱号箱子的【重量】不一致");
}
if (item.Sum(x => x.CBM) != .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单主单中的【尺码】与订舱中同箱号箱子的【尺码】不一致");
}
}
foreach (var item in .GroupBy(x => x.CNTRNO))
{
if (item.Sum(x => x.PKGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于主单中同箱号箱子的件数");
}
if (item.Sum(x => x.KGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
foreach (var item in .GroupBy(x => x.CNTRNO))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于主单中同箱号箱子的重量");
if (item.Sum(x => x.PKGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.PKGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总件数】大于主单中同箱号箱子的件数");
}
if (item.Sum(x => x.KGS) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.KGS))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总重量】大于主单中同箱号箱子的重量");
}
if (item.Sum(x => x.CBM) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于主单中同箱号箱子的尺码");
}
}
if (item.Sum(x => x.CBM) > .Where(x => x.CNTRNO == item.Key).Sum(x => x.CBM))
{
checkResult.Add($"箱号为【{item.Key}】的箱子,在舱单各分单中的【总尺码】大于主单中同箱号箱子的尺码");
}
}
// 校验3箱号+封号+箱型
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();
// 校验3箱号+封号+箱型
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 list1 = .Except();
if (list1.Any())
{
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join("", list1)}");
}
else
{
var list2 = .Except();
if (list2.Any())
var list1 = .Except();
if (list1.Any())
{
checkResult.Add($"单主单中的下列箱信息在舱中不存在:{string.Join("", list2)}");
checkResult.Add($"订舱中的下列箱信息在舱单主单中不存在:{string.Join("", list1)}");
}
var list3 = .Except();
if (list3.Any())
else
{
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join("", list3)}");
var list2 = .Except();
if (list2.Any())
{
checkResult.Add($"舱单主单中的下列箱信息在订舱中不存在:{string.Join("", list2)}");
}
var list3 = .Except();
if (list3.Any())
{
checkResult.Add($"舱单分单中存在未知的箱信息:{string.Join("", list3)}");
}
}
}
if (checkResult.Count > 0)
{
UnifyContext.Fill(new { checkResult });
throw new Exception("校验不通过");
if (checkResult.Count > 0)
{
UnifyContext.Fill(new { checkResult });
throw new Exception("校验不通过");
}
}
}
#endregion

Loading…
Cancel
Save