From 24a228b7f12e2c840f084ee3b483889e99c780db Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期五, 26 九月 2025 14:51:33 +0800
Subject: [PATCH] 111

---
 MES.Service/service/BasicData/ProductionOrderManager.cs |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/MES.Service/service/BasicData/ProductionOrderManager.cs b/MES.Service/service/BasicData/ProductionOrderManager.cs
index 61fab5b..19fcc5e 100644
--- a/MES.Service/service/BasicData/ProductionOrderManager.cs
+++ b/MES.Service/service/BasicData/ProductionOrderManager.cs
@@ -122,12 +122,11 @@
         var productionOrder = new ProductionOrder
         {
             OrderNo = SUBBOM,
-            Warehouse = erpDto.FStockID,
+           
             OrderDate = ParseDateTime(erpDto.FDate) ?? null,
             OrderType = erpDto.FBillType,
             BusinessStatus = erpDto.FStatus,
-            ProductCode = erpDto.FMaterialId,
-            Unit = erpDto.FUnitID,
+            
             WorkOrderQty = Convert.ToDecimal(erpDto.FQty),
             PlanningGroup = erpDto.FWorkGroupId,
             Planner = erpDto.FPlannerID,
@@ -182,6 +181,37 @@
             "7" or "8" => "鐢熶骇璁㈠崟",
             _ => "濮斿璁㈠崟"
         };
+        
+        //Unit = ,
+        // CAA009 鍗曚綅 -> MES_UNIT.id
+        if (!string.IsNullOrEmpty(erpDto.FUnitID))
+        {
+            var unit = Db.Queryable<MesUnit>()
+                .Where(u => u.Fnumber == erpDto.FUnitID)
+                .Select(u => u.Id)
+                .First();
+            productionOrder.Unit = unit.ToString();
+        }
+        
+        // CAA006 浜у搧缂栫爜 -> MES_ITEMS.id
+        if (!string.IsNullOrEmpty(erpDto.FMaterialId))
+        {
+            var item = Db.Queryable<MesItems>()
+                .Where(i => i.ItemNo == erpDto.FMaterialId)
+                .Select(i => i.Id)
+                .First();
+            productionOrder.ProductCode = item.ToString();
+        }
+        
+        // Warehouse = erpDto.FStockID,
+        if (!string.IsNullOrEmpty(erpDto.FStockID))
+        {
+            var depot = Db.Queryable<MesDepots>()
+                .Where(d => d.DepotCode == erpDto.FStockID)
+                .Select(d => d.DepotId)
+                .First();
+            productionOrder.Warehouse = depot.ToString();
+        }
 
         var single = base.GetSingle(it =>
             it.ErpProductionEntryCode == erpDto.FSUBENTRYID);

--
Gitblit v1.9.3