jianghaiqing 6 days ago
commit 29ffabf054

@ -19,7 +19,11 @@ public class SeaExportReq
/// </summary> /// </summary>
public List<OpCtnReq> CtnInfo { get; set; } public List<OpCtnReq> CtnInfo { get; set; }
/// <summary>
/// 订单业务联系人
/// </summary>
public List<BusinessOrderContactReq> OrderContacts { get; set; }
/// <summary>
/// <summary> /// <summary>
/// 箱型报价信息 /// 箱型报价信息
/// </summary> /// </summary>

@ -409,9 +409,48 @@ public partial class SeaExportService : ISeaExportService
_logger.Info("执行完保存日志"); _logger.Info("执行完保存日志");
//处理订单联系人信息 //处理订单联系人信息 2024-11-18 联系人信息改为可以直接修改,不用弹出窗体
DealBusinessOrderContact(info, tenantDb); //DealBusinessOrderContact(info, tenantDb);
if (req.OrderContacts.IsNotNull() && req.OrderContacts.Count > 0)
{
var contacts = await tenantDb.Queryable<BusinessOrderContact>().Where(x => x.BusinessId == req.Id).ToListAsync();
var existContacts = contacts.Select(x => x.Id);
var reqContacts = req.OrderContacts.Where(x => x.Id != 0).Select(x => x.Id);
//删除
IEnumerable<long> delContacts = existContacts.AsQueryable().Except(reqContacts);
if (delContacts.Count() > 0)
{
await tenantDb.Deleteable<BusinessOrderContact>()
.Where(it => it.BusinessId == info.Id && delContacts.Contains(it.Id))
.ExecuteCommandAsync();
}
foreach (var item in req.OrderContacts)
{
if (item.Id == 0)
{
var contact = item.Adapt<BusinessOrderContact>();
contact.BusinessId = info.Id;
await tenantDb.Insertable(contact).ExecuteCommandAsync();
}
else
{
var contact = contacts.First(x => x.Id == item.Id);
contact = item.Adapt(contact);
await tenantDb.Updateable(contact).ExecuteCommandAsync();
}
}
}
else //删除
{
var contacts = await tenantDb.Queryable<BusinessOrderContact>().Where(x => x.BusinessId == req.Id).ToListAsync();
if (contacts.IsNotNull() && contacts.Count > 0)
{
await tenantDb.Deleteable(contacts).ExecuteCommandAsync();
}
}
_logger.Info("执行完订单联系人"); _logger.Info("执行完订单联系人");
if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0) if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0)
@ -510,7 +549,6 @@ public partial class SeaExportService : ISeaExportService
ctnGood = item.Adapt(ctnGood); ctnGood = item.Adapt(ctnGood);
await tenantDb.Updateable(ctnGood).ExecuteCommandAsync(); await tenantDb.Updateable(ctnGood).ExecuteCommandAsync();
} }
} }
} }
else //删除 else //删除
@ -518,7 +556,7 @@ public partial class SeaExportService : ISeaExportService
var ctnGoods = await tenantDb.Queryable<OpCtnGoods>().Where(x => x.BusinessId == req.Id).ToListAsync(); var ctnGoods = await tenantDb.Queryable<OpCtnGoods>().Where(x => x.BusinessId == req.Id).ToListAsync();
if (ctnGoods.IsNotNull() && ctnGoods.Count > 0) if (ctnGoods.IsNotNull() && ctnGoods.Count > 0)
{ {
tenantDb.Deleteable(ctnGoods).ExecuteCommand(); await tenantDb.Deleteable(ctnGoods).ExecuteCommandAsync();
} }
} }
_logger.Info("执行完订单多品名信息"); _logger.Info("执行完订单多品名信息");
@ -717,9 +755,18 @@ public partial class SeaExportService : ISeaExportService
_logger.Info($"执行订单写入 data={JsonConvert.SerializeObject(data)}"); _logger.Info($"执行订单写入 data={JsonConvert.SerializeObject(data)}");
var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync();
//处理订单联系人信息 //处理订单联系人信息 2024-11-18 联系人信息改为可以直接修改,不用弹出窗体
DealBusinessOrderContact(entity, tenantDb); //DealBusinessOrderContact(info, tenantDb);
if (req.OrderContacts.IsNotNull() && req.OrderContacts.Count > 0)
{
foreach (var item in req.OrderContacts)
{
var contact = item.Adapt<BusinessOrderContact>();
contact.BusinessId = entity.Id;
await tenantDb.Insertable(contact).ExecuteCommandAsync();
}
}
if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0) if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0)
{ {

@ -675,11 +675,11 @@ namespace DS.WMS.Core.TaskPlat.Method
// 获取任务流水号 // 获取任务流水号
//DataResult<string> sequence = await commonService.GetSequenceNextAsync<TaskBaseInfo>(tenantDb, user); //DataResult<string> sequence = await commonService.GetSequenceNextAsync<TaskBaseInfo>(tenantDb, user);
//string taskNo = sequence.Data ?? ""; //string taskNo = sequence.Data ?? "";
taskInfo = new TaskBaseInfo taskInfo = new TaskBaseInfo
{ {
Id = SnowFlakeSingle.Instance.NextId(), Id = SnowFlakeSingle.Instance.NextId(),
TASK_NO = Guid.NewGuid().ToString(), TASK_NO = SnowFlakeSingle.Instance.NextId().ToString(),
STATUS = TaskStatusEnum.Create.ToString(), STATUS = TaskStatusEnum.Create.ToString(),
STATUS_NAME = TaskStatusEnum.Create.EnumDescription(), STATUS_NAME = TaskStatusEnum.Create.EnumDescription(),
IS_EXCEPT = 0, IS_EXCEPT = 0,

Loading…
Cancel
Save