|
|
|
@ -245,7 +245,7 @@ namespace djy.Service.AFR
|
|
|
|
|
var select = DbAMS.Select<AFRMaster, AFRHouse>()
|
|
|
|
|
.InnerJoin<AFRHouse>((m, h) => m.GID == h.PID);
|
|
|
|
|
|
|
|
|
|
select.Where((m, h) => m.IsDel == false && m.StateIsSend == true)
|
|
|
|
|
select.Where((m, h) => m.IsDel == false && h.IsDel == false && m.StateIsSend == true)
|
|
|
|
|
//下面两个是Controller中传来的条件
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.CompanyId), (m, h) => m.CompID == input.CompanyId)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(input.UserId), (m, h) => m.UserID == input.UserId)
|
|
|
|
@ -335,6 +335,8 @@ namespace djy.Service.AFR
|
|
|
|
|
AFRMaster oldMaster = null;
|
|
|
|
|
var nowTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
StringTrimmer.TrimStringProperties(input);
|
|
|
|
|
|
|
|
|
|
#region 数据校验
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.MBLNO))
|
|
|
|
|
{
|
|
|
|
@ -368,23 +370,25 @@ namespace djy.Service.AFR
|
|
|
|
|
input.CreateTime = nowTime;
|
|
|
|
|
input.StateIsSend = false;
|
|
|
|
|
|
|
|
|
|
if (await DbAMS.Select<AFRMaster>().AnyAsync(m => m.MBLNO == input.MBLNO))
|
|
|
|
|
if (await DbAMS.Select<AFRMaster>().AnyAsync(m => m.MBLNO == input.MBLNO && m.IsDel == false))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("已存在相同的船东提单号");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hblNoList = input.HouseList.Select(h => h.HouseBillNo).ToList();
|
|
|
|
|
var hblNoList = input.HouseList.Select(h => h.HouseBillNo.Trim()).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) && h.IsDel == false))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("已存在相同的货代提单号");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input.HouseList.ForEach(house =>
|
|
|
|
|
{
|
|
|
|
|
StringTrimmer.TrimStringProperties(house);
|
|
|
|
|
|
|
|
|
|
house.GID = Guid.NewGuid().ToString();
|
|
|
|
|
house.PID = input.GID;
|
|
|
|
|
house.LastUpdateUserID = User.GID;
|
|
|
|
@ -399,6 +403,8 @@ namespace djy.Service.AFR
|
|
|
|
|
house.CntrList ??= new List<AFRCntrno>();
|
|
|
|
|
house.CntrList.ForEach(cntr =>
|
|
|
|
|
{
|
|
|
|
|
StringTrimmer.TrimStringProperties(cntr);
|
|
|
|
|
|
|
|
|
|
cntr.GID = Guid.NewGuid().ToString();
|
|
|
|
|
cntr.PID = house.GID;
|
|
|
|
|
cntr.CreateTime = nowTime;
|
|
|
|
@ -427,7 +433,7 @@ namespace djy.Service.AFR
|
|
|
|
|
// 修改
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (await DbAMS.Select<AFRMaster>().AnyAsync(m => m.MBLNO == input.MBLNO && m.GID != input.GID))
|
|
|
|
|
if (await DbAMS.Select<AFRMaster>().AnyAsync(m => m.MBLNO == input.MBLNO && m.GID != input.GID && m.IsDel == false))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("已存在相同的船东提单号");
|
|
|
|
|
}
|
|
|
|
@ -444,6 +450,8 @@ namespace djy.Service.AFR
|
|
|
|
|
{
|
|
|
|
|
foreach (var house in input.HouseList)
|
|
|
|
|
{
|
|
|
|
|
StringTrimmer.TrimStringProperties(house);
|
|
|
|
|
|
|
|
|
|
house.LastUpdate = nowTime;
|
|
|
|
|
house.LastUpdateUserID = User.GID;
|
|
|
|
|
house.LastUpdateUserName = User.ShowName;
|
|
|
|
@ -456,14 +464,14 @@ namespace djy.Service.AFR
|
|
|
|
|
house.StateIsAccept = house.StateIsMatched = house.StateIsSend = house.StateIsDelete = false;
|
|
|
|
|
house.NewNotice = "";
|
|
|
|
|
|
|
|
|
|
if (await DbAMS.Select<AFRHouse>().AnyAsync(h => h.HouseBillNo == house.HouseBillNo))
|
|
|
|
|
if (await DbAMS.Select<AFRHouse>().AnyAsync(h => h.HouseBillNo == house.HouseBillNo && h.IsDel == false))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("已存在相同的货代提单号");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (await DbAMS.Select<AFRHouse>().AnyAsync(h => h.HouseBillNo == house.HouseBillNo && h.GID != house.GID))
|
|
|
|
|
if (await DbAMS.Select<AFRHouse>().AnyAsync(h => h.HouseBillNo == house.HouseBillNo && h.GID != house.GID && h.IsDel == false))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("已存在相同的货代提单号");
|
|
|
|
|
}
|
|
|
|
@ -480,6 +488,8 @@ namespace djy.Service.AFR
|
|
|
|
|
cntr.LastUpdate = nowTime;
|
|
|
|
|
if (string.IsNullOrEmpty(cntr.GID))
|
|
|
|
|
{
|
|
|
|
|
StringTrimmer.TrimStringProperties(cntr);
|
|
|
|
|
|
|
|
|
|
cntr.GID = Guid.NewGuid().ToString();
|
|
|
|
|
cntr.PID = house.GID;
|
|
|
|
|
cntr.CreateTime = nowTime;
|
|
|
|
|