|
|
@ -221,7 +221,7 @@ namespace djy.Service.AFR
|
|
|
|
// 下面是前端传来的条件
|
|
|
|
// 下面是前端传来的条件
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.MBLNO), (m) => m.MBLNO.Contains(input.MBLNO))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.MBLNO), (m) => m.MBLNO.Contains(input.MBLNO))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.UserName), (m) => m.LastUpdateUserName.Contains(input.UserName))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.UserName), (m) => m.LastUpdateUserName.Contains(input.UserName))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), (m) => m.DischargeHarbour.Contains(input.DischargeHarbour))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), (m) => m.DischargeHarbourCode.Contains(input.DischargeHarbour))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.ShipCompanyName), (m) => m.ShipCompanyName.Contains(input.ShipCompanyName))
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.ShipCompanyName), (m) => m.ShipCompanyName.Contains(input.ShipCompanyName))
|
|
|
|
.WhereIf(input.CreateTimeStart != null, (m) => m.CreateTime >= input.CreateTimeStart)
|
|
|
|
.WhereIf(input.CreateTimeStart != null, (m) => m.CreateTime >= input.CreateTimeStart)
|
|
|
|
.WhereIf(input.CreateTimeEnd != null, (m) => m.CreateTime <= input.CreateTimeEnd);
|
|
|
|
.WhereIf(input.CreateTimeEnd != null, (m) => m.CreateTime <= input.CreateTimeEnd);
|
|
|
@ -335,6 +335,13 @@ namespace djy.Service.AFR
|
|
|
|
AFRMaster oldMaster = null;
|
|
|
|
AFRMaster oldMaster = null;
|
|
|
|
var nowTime = DateTime.Now;
|
|
|
|
var nowTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 数据校验
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.MBLNO))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"船东提单号不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.GID))
|
|
|
|
if (string.IsNullOrEmpty(input.GID))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type = 0;
|
|
|
|
type = 0;
|
|
|
@ -367,6 +374,10 @@ namespace djy.Service.AFR
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var hblNoList = input.HouseList.Select(h => h.HouseBillNo).ToList();
|
|
|
|
var hblNoList = input.HouseList.Select(h => h.HouseBillNo).ToList();
|
|
|
|
|
|
|
|
if (hblNoList.Any(h => string.IsNullOrWhiteSpace(h)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception("货代提单号不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (hblNoList.Any() && await DbAMS.Select<AFRHouse>().AnyAsync(h => hblNoList.Contains(h.HouseBillNo)))
|
|
|
|
if (hblNoList.Any() && await DbAMS.Select<AFRHouse>().AnyAsync(h => hblNoList.Contains(h.HouseBillNo)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new Exception("已存在相同的货代提单号");
|
|
|
|
throw new Exception("已存在相同的货代提单号");
|
|
|
@ -697,6 +708,92 @@ namespace djy.Service.AFR
|
|
|
|
// 原始发送 重发 修改
|
|
|
|
// 原始发送 重发 修改
|
|
|
|
if (sendType is 1 or 2 or 3)
|
|
|
|
if (sendType is 1 or 2 or 3)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// 批量检查主单字段是否为空
|
|
|
|
|
|
|
|
foreach (var masterItem in masterAll)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var checkEmptyFields = new List<(string, string)>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(masterItem.MBLNO, "船东提单号"),
|
|
|
|
|
|
|
|
(masterItem.Vessel, "船名"),
|
|
|
|
|
|
|
|
(masterItem.Voyno, "航次"),
|
|
|
|
|
|
|
|
(masterItem.LoadHarbour, "装货港"),
|
|
|
|
|
|
|
|
(masterItem.LoadHarbourCode, "装货港五字码"),
|
|
|
|
|
|
|
|
(masterItem.DischargeHarbour, "卸货港"),
|
|
|
|
|
|
|
|
(masterItem.DischargeHarbourCode, "卸货港五字码"),
|
|
|
|
|
|
|
|
(masterItem.EstimatedArrivalTime?.ToString(), "预计到达时间"),
|
|
|
|
|
|
|
|
(masterItem.ShipCompanyCode, "船公司"),
|
|
|
|
|
|
|
|
(masterItem.Clause, "运输条款"),
|
|
|
|
|
|
|
|
(masterItem.ConsignmentType, "整箱/拼箱"),
|
|
|
|
|
|
|
|
(masterItem.FilingType, "申报运输类型"),
|
|
|
|
|
|
|
|
(masterItem.LastForeignHarbour, "交货地全称"),
|
|
|
|
|
|
|
|
(masterItem.LastForeignHarbourCode, "交货地五字码"),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
foreach (var (value, name) in checkEmptyFields)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"提单号【{masterItem.MBLNO}】的{name}不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 批量检查分单字段是否为空
|
|
|
|
|
|
|
|
foreach (var house in houseAll)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var checkEmptyFields2 = new List<(string, string)>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(house.HouseBillNo, "货代提单号"),
|
|
|
|
|
|
|
|
(house.SendName, "发货人名称"),
|
|
|
|
|
|
|
|
(house.SendCountryCode, "发货人国家代码"),
|
|
|
|
|
|
|
|
(house.SendCountry, "发货人国家"),
|
|
|
|
|
|
|
|
(house.SendCity, "发货人城市"),
|
|
|
|
|
|
|
|
(house.SendAddress, "发货人地址"),
|
|
|
|
|
|
|
|
(house.SendTel, "发货人电话"),
|
|
|
|
|
|
|
|
(house.ReceiveName, "收货人名称"),
|
|
|
|
|
|
|
|
(house.ReceiveCountryCode, "收货人国家代码"),
|
|
|
|
|
|
|
|
(house.ReceiveCountry, "收货人国家"),
|
|
|
|
|
|
|
|
(house.ReceiveCity, "收货人城市"),
|
|
|
|
|
|
|
|
(house.ReceiveAddress, "收货人地址"),
|
|
|
|
|
|
|
|
(house.ReceiveTel, "收货人电话"),
|
|
|
|
|
|
|
|
(house.NotifyName, "通知人名称"),
|
|
|
|
|
|
|
|
(house.NotifyCountryCode, "通知人国家代码"),
|
|
|
|
|
|
|
|
(house.NotifyCountry, "通知人国家"),
|
|
|
|
|
|
|
|
(house.NotifyCity, "通知人城市"),
|
|
|
|
|
|
|
|
(house.NotifyAddress, "通知人地址"),
|
|
|
|
|
|
|
|
(house.NotifyTel, "通知人电话"),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
foreach (var (value, name) in checkEmptyFields2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"分单【{house.HouseBillNo}】的{name}不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 批量检查箱子字段是否为空
|
|
|
|
|
|
|
|
foreach (var cntr in cntrAll)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var checkEmptyFields3 = new List<(string, string)>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(cntr.EnProductName, "品名"),
|
|
|
|
|
|
|
|
(cntr.ShippingMark, "唛头"),
|
|
|
|
|
|
|
|
(cntr.ContainerNo, "箱号"),
|
|
|
|
|
|
|
|
(cntr.ContainerTypeCode, "箱型"),
|
|
|
|
|
|
|
|
(cntr.SealNo, "封号"),
|
|
|
|
|
|
|
|
(cntr.Digit?.ToString(), "件数"),
|
|
|
|
|
|
|
|
(cntr.GrossWeight?.ToString(), "毛重"),
|
|
|
|
|
|
|
|
(cntr.Volume?.ToString(), "体积"),
|
|
|
|
|
|
|
|
(cntr.Hscode, "HSCode")
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
foreach (var (value, name) in checkEmptyFields3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new Exception($"箱号【{cntr.ContainerNo}】的{name}不能为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (AFRMaster masterItem in masterAll)
|
|
|
|
foreach (AFRMaster masterItem in masterAll)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 待处理的分单
|
|
|
|
// 待处理的分单
|
|
|
|