From 08e38e489ca7397e9f76c328a9511a2dbbdf14ba Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期四, 18 九月 2025 19:20:24 +0800
Subject: [PATCH] 111
---
StandardPda/MES.Service/service/Warehouse/MesItemQtManager.cs | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/StandardPda/MES.Service/service/Warehouse/MesItemQtManager.cs b/StandardPda/MES.Service/service/Warehouse/MesItemQtManager.cs
index 958c3ec..34c76bf 100644
--- a/StandardPda/MES.Service/service/Warehouse/MesItemQtManager.cs
+++ b/StandardPda/MES.Service/service/Warehouse/MesItemQtManager.cs
@@ -299,6 +299,21 @@
}
+ string mesUnit = "";
+ if (mesItems.ItemUnit != null && mesItems.ItemUnit != "")
+ {
+
+ var mesUnitDb = Db.Queryable<MesUnit>()
+ .Where(s => s.Id == Decimal.Parse(mesItems.ItemUnit))
+ .First();
+ if (mesUnitDb == null)
+ {
+ throw new NotImplementedException("[" + ItemQtRKList.SupplierCode +
+ "]鍗曚綅涓嶅瓨鍦紝璇峰悓姝ョ粰MES");
+ }
+ mesUnit = mesUnitDb.Fnumber;
+ }
+
//var mesInvItemInCItems = Db.Queryable<MesInvItemInCItems>()
// .Where(s => s.ItemInId == mesInvItemIns.Id
// && s.ItemNo == mesItems.ItemNo
@@ -331,7 +346,7 @@
Qd006 = ItemQtRKList.PlannedQuantity,
Qd007 = ItemQtRKList.AppliedQuantity,
Qd008 = 0, // 宸插叆鏁伴噺榛樿涓�0
- Qd009 = mesItems.ItemUnit,
+ Qd009 = mesUnit,
Qd010 = ItemQtRKList.Remark,
Qd012 = mesItems.Id, // 鐗╂枡鍐呯爜
LineNumber = ItemQtRKList.LineNumber,
@@ -353,6 +368,27 @@
});
}
+ var itemDB = mesItemQtDetail
+ .Where(x => x.Qd002 != null) // 杩囨护鎺� null 鍊�
+ .GroupBy(x => x.Qd002) // 鎸� Qd002 鍒嗙粍
+ .Select(g => new
+ {
+ no = g.Key,
+ count = g.Count()
+
+ })
+ .ToList();
+
+ // 杈撳嚭缁熻缁撴灉
+ foreach (var item in itemDB)
+ {
+ if (item.count > 1)
+ {
+ throw new Exception($"鏄庣粏琛岀墿鏂�:{item.no}閲嶅锛岃妫�鏌ュ悗閲嶈瘯锛�");
+ }
+ //Console.WriteLine($"鐗╂枡缂栧彿: {item.鐗╂枡缂栧彿}, 鍑虹幇娆℃暟: {item.鍑虹幇娆℃暟}");
+ }
+
var outItemCommand = Db.Insertable(mesItemQtDetail)
.PageSize(1).IgnoreColumnsNull().ExecuteCommand();
if (outItemCommand <= 0)
--
Gitblit v1.9.3