From c6dad51bdd23cf8425a2e6bb47b9b9412a0dabbe Mon Sep 17 00:00:00 2001
From: zongzhibin <zongzhibin@weben-smart.com>
Date: 周五, 29 11月 2024 15:53:06 +0800
Subject: [PATCH] add
---
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
index 89d4870..ed7aa55 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
@@ -15,9 +15,13 @@
public class ThirdInterFaceService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _rep;
- public ThirdInterFaceService(SqlSugarRepository<Mes_BatchOrderUPI_New> rep)
+ private readonly SqlSugarRepository<Mes_Package_Gather> _mes_Package_Gather_Rep;
+ public ThirdInterFaceService(SqlSugarRepository<Mes_BatchOrderUPI_New> rep,
+ SqlSugarRepository<Mes_Package_Gather> mes_Package_Gather_Rep
+ )
{
_rep = rep;
+ _mes_Package_Gather_Rep = mes_Package_Gather_Rep;
}
[HttpPost]
@@ -41,18 +45,33 @@
throw Oops.Oh("鏈鏈夐噸澶嶇殑UPI锛侀噸澶嶅彿涓�:" + dit.Key + ",閲嶅鏉℃暟:" + dit.Value);
}
- List<string> upis = new List<string>();
- input.ForEach(x => upis.Add(x.UPI));//upis鏄紶杩囨潵鐨剈pi瀛楁闆嗗悎
+ List<string> packageList = new List<string>();
+ input.ForEach(x => packageList.Add(x.PackageCode));//upis鏄紶杩囨潵鐨剈pi瀛楁闆嗗悎
- var batchOrderUPIs = await _rep.AsQueryable().Where(x => upis.Contains(x.UPI)).ToListAsync();//batchOrderUPIs鏄噸澶嶇殑upi闆嗗悎
+ var batchOrderUPIs = await _rep.AsQueryable().Where(x => packageList.Contains(x.PackageCode)).ToListAsync();//batchOrderUPIs鏄噸澶嶇殑upi闆嗗悎
//鎵归噺鍒犻櫎
await _rep.DeleteAsync(batchOrderUPIs);
+
+ //鎵归噺鍒犻櫎
+ await _mes_Package_Gather_Rep.DeleteAsync(x => packageList.Contains(x.PackageCode));
foreach (var item in input)
{
item.AreaCode = AreaCodeEnum.鏃犲尯鍩�;
item.UpiStatus = UpiStatusEnum.鍒濆;
}
+ List<Mes_Package_Gather> addGatherList = new List<Mes_Package_Gather>();
+ var groups = input.GroupBy(x => x.PackageCode);
+ foreach (var group in groups)
+ {
+ var first = group.ToList().First();
+ Mes_Package_Gather newGather = first.Adapt<Mes_Package_Gather>();
+ newGather.AreaCode = AreaCodeEnum.鏃犲尯鍩�;
+ newGather.UpiStatus = UpiStatusEnum.鍒濆;
+ addGatherList.Add(newGather);
+ }
+ await _mes_Package_Gather_Rep.InsertRangeAsync(addGatherList);
+
await _rep.InsertRangeAsync(input);
}
--
Gitblit v1.9.3