舱单修改

usertest
cjy 3 months ago
parent 825eeb4ee9
commit b4a315a8d7

@ -22,6 +22,7 @@ using Logger = NLog.Logger;
using Newtonsoft.Json.Linq;
using DS.Module.Core.Helpers;
using Org.BouncyCastle.Ocsp;
using static AnyDiff.DifferenceLines;
namespace DS.WMS.Core.Op.Method
{
@ -164,7 +165,7 @@ namespace DS.WMS.Core.Op.Method
data.DangerNo = string.Empty;
}
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
if (req.CtnInfo.Count > 0)
if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0)
{
foreach (var item in req.CtnInfo)
@ -211,7 +212,7 @@ namespace DS.WMS.Core.Op.Method
it.BusinessId,
}).ExecuteCommand();
if (req.CtnInfo.Count > 0)
if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0)
{
var ctnList = tenantDb.Queryable<SeaExportShippingBillCtn>().Where(x => x.Pid == req.Id).ToList();
foreach (var item in req.CtnInfo)
@ -250,6 +251,20 @@ namespace DS.WMS.Core.Op.Method
{
return await Task.FromResult(DataResult.Failed("数据不能为空!"));
}
foreach (var item in list)
{
if (!string.IsNullOrEmpty(item.MBLNO) && !item.IsPart && tenantDb.Queryable<SeaExportShippingBill>().Where(x => x.MBLNO == item.MBLNO && x.Id!= item.Id).Any())
{
return await Task.FromResult(DataResult.Failed("当前主单主提单号已存在,请勿重复录入!"));
}
if (!string.IsNullOrEmpty(item.HBLNO) && item.IsPart && tenantDb.Queryable<SeaExportShippingBill>().Where(x => x.MBLNO == item.MBLNO && x.HBLNO == item.HBLNO && x.Id != item.Id).Any())
{
return await Task.FromResult(DataResult.Failed("当前分提单号已存在,请勿重复录入!"));
}
}
try
{
//开启事务
@ -258,12 +273,7 @@ namespace DS.WMS.Core.Op.Method
{
if (item.Id == 0)
{
if (!string.IsNullOrEmpty(item.MBLNO) && tenantDb.Queryable<SeaExportShippingBill>().Where(x => x.MBLNO == item.MBLNO && x.HBLNO == item.HBLNO).Any())
{
return await Task.FromResult(DataResult.Failed("当前提单号已存在,请勿重复录入!"));
}
{
var data = item.Adapt<SeaExportShippingBill>();
data.State = "已录入";
@ -278,7 +288,7 @@ namespace DS.WMS.Core.Op.Method
data.DangerNo = string.Empty;
}
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
if (item.CtnInfo.Count > 0)
if (item.CtnInfo.IsNotNull() && item.CtnInfo.Count > 0)
{
foreach (var item1 in item.CtnInfo)
@ -292,10 +302,7 @@ namespace DS.WMS.Core.Op.Method
}
else
{
if (!string.IsNullOrEmpty(item.MBLNO) && tenantDb.Queryable<SeaExportShippingBill>().Where(x => x.Id != item.Id && x.MBLNO == item.MBLNO && x.HBLNO == item.HBLNO).Any())
{
return await Task.FromResult(DataResult.Failed("当前提单号已存在,请勿重复录入!"));
}
var info = await tenantDb.Queryable<SeaExportShippingBill>().Where(x => x.Id == item.Id).FirstAsync();
if (info.State != "已录入")
@ -328,7 +335,7 @@ namespace DS.WMS.Core.Op.Method
it.BusinessId,
}).ExecuteCommandAsync();
if (item.CtnInfo.Count > 0)
if (item.CtnInfo.IsNotNull() && item.CtnInfo.Count > 0)
{
var ctnList = tenantDb.Queryable<SeaExportShippingBillCtn>().Where(x => x.Pid == item.Id).ToList();
foreach (var item1 in item.CtnInfo)

Loading…
Cancel
Save