diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs index 3b14db56..6316a86b 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportReq.cs @@ -19,7 +19,11 @@ public class SeaExportReq /// public List CtnInfo { get; set; } - + /// + /// 订单业务联系人 + /// + public List OrderContacts { get; set; } + /// /// /// 箱型报价信息 /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 82c1d0d4..9b4ad09d 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -409,9 +409,48 @@ public partial class SeaExportService : ISeaExportService _logger.Info("执行完保存日志"); - //处理订单联系人信息 - DealBusinessOrderContact(info, tenantDb); + //处理订单联系人信息 2024-11-18 联系人信息改为可以直接修改,不用弹出窗体 + //DealBusinessOrderContact(info, tenantDb); + if (req.OrderContacts.IsNotNull() && req.OrderContacts.Count > 0) + { + var contacts = await tenantDb.Queryable().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 delContacts = existContacts.AsQueryable().Except(reqContacts); + if (delContacts.Count() > 0) + { + await tenantDb.Deleteable() + .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(); + 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().Where(x => x.BusinessId == req.Id).ToListAsync(); + if (contacts.IsNotNull() && contacts.Count > 0) + { + await tenantDb.Deleteable(contacts).ExecuteCommandAsync(); + } + } _logger.Info("执行完订单联系人"); if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0) @@ -510,7 +549,6 @@ public partial class SeaExportService : ISeaExportService ctnGood = item.Adapt(ctnGood); await tenantDb.Updateable(ctnGood).ExecuteCommandAsync(); } - } } else //删除 @@ -518,7 +556,7 @@ public partial class SeaExportService : ISeaExportService var ctnGoods = await tenantDb.Queryable().Where(x => x.BusinessId == req.Id).ToListAsync(); if (ctnGoods.IsNotNull() && ctnGoods.Count > 0) { - tenantDb.Deleteable(ctnGoods).ExecuteCommand(); + await tenantDb.Deleteable(ctnGoods).ExecuteCommandAsync(); } } _logger.Info("执行完订单多品名信息"); @@ -717,9 +755,18 @@ public partial class SeaExportService : ISeaExportService _logger.Info($"执行订单写入 data={JsonConvert.SerializeObject(data)}"); var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); - - //处理订单联系人信息 - DealBusinessOrderContact(entity, tenantDb); + + //处理订单联系人信息 2024-11-18 联系人信息改为可以直接修改,不用弹出窗体 + //DealBusinessOrderContact(info, tenantDb); + if (req.OrderContacts.IsNotNull() && req.OrderContacts.Count > 0) + { + foreach (var item in req.OrderContacts) + { + var contact = item.Adapt(); + contact.BusinessId = entity.Id; + await tenantDb.Insertable(contact).ExecuteCommandAsync(); + } + } if (req.CtnInfo.IsNotNull() && req.CtnInfo.Count > 0) { diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 875501db..b763e907 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -675,11 +675,11 @@ namespace DS.WMS.Core.TaskPlat.Method // 获取任务流水号 //DataResult sequence = await commonService.GetSequenceNextAsync(tenantDb, user); //string taskNo = sequence.Data ?? ""; - + taskInfo = new TaskBaseInfo { Id = SnowFlakeSingle.Instance.NextId(), - TASK_NO = Guid.NewGuid().ToString(), + TASK_NO = SnowFlakeSingle.Instance.NextId().ToString(), STATUS = TaskStatusEnum.Create.ToString(), STATUS_NAME = TaskStatusEnum.Create.EnumDescription(), IS_EXCEPT = 0,