From dceaef6216586bed2a22ac425c4ac07cb1136ae4 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 11 十二月 2025 10:09:04 +0800
Subject: [PATCH] 物料编码转ID

---
 MES.Service/service/BasicData/MesRohInManager.cs |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs
index 6871fd2..56dc5da 100644
--- a/MES.Service/service/BasicData/MesRohInManager.cs
+++ b/MES.Service/service/BasicData/MesRohInManager.cs
@@ -77,9 +77,9 @@
         //}
 
         //浼犱粈涔堬紝c灏辨敼鎴愪粈涔�
-        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "F"))//C琛ㄧず宸插鏍哥姸鎬�
+        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "Y"))//Y琛ㄧず宸插鏍哥姸鎬�
         {
-            mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
+            mesRohIn.BillNo = mesRohIn.BillNo + "Y" + mesRohIn.EbelnK3id.ToString();
         }
 
         if (mesRohIn.Guid != null)
@@ -146,7 +146,7 @@
             mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate,
                 "yyyy-MM-dd HH:mm:ss", null);
 
-        //渚涘簲鍟嗚浆缂栫爜
+        //渚涘簲鍟嗙紪鐮佽浆ID
         var mesRohInSupplier = Db.Queryable<MesSupplier>()
             .Where(x => x.SuppNo == rohIn.FSupplierId)
             .Select(x => x.Id.ToString())
@@ -169,7 +169,7 @@
         //mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
         mesRohIn.PurchaseOrg = string.IsNullOrEmpty(rohIn.FPurchaseOrgId) ? "1" : rohIn.FPurchaseOrgId;//閲囪喘缁勭粐
 
-        //閲囪喘閮ㄩ棬杞紪鐮�
+        //閲囪喘閮ㄩ棬缂栫爜杞琁D
         var mesRohInPurchaseDept = Db.Queryable<SysDepartment>()
             .Where(x => x.Departmentcode == rohIn.FPurchaseDeptId)
             .Select(x => x.Departmentid.ToString())
@@ -330,7 +330,7 @@
                 SalesOrderId = s.F_UNW_Text_xsddh
             };
 
-            //閲囪喘鍗曚綅杞紪鐮�
+            //閲囪喘鍗曚綅缂栫爜杞琁D
             var entityPurchaseUnit = Db.Queryable<MesUnit>()
                 .Where(x => x.Fnumber == s.FUnitId)
                 .Select(x => x.Id.ToString())
@@ -348,7 +348,7 @@
                 entity.PurchaseUnit = "0";
             }
 
-            //璁′环鍗曚綅杞紪鐮�
+            //璁′环鍗曚綅缂栫爜杞琁D
             var entityPricingUnit = Db.Queryable<MesUnit>()
                 .Where(x => x.Fnumber == s.FPriceUnitId)
                 .Select(x => x.Id.ToString())
@@ -366,6 +366,24 @@
                 entity.PricingUnit = "0";
             }
 
+            //鐗╂枡缂栫爜杞琁D
+            var entityItemId = Db.Queryable<MesItems>()
+                .Where(x => x.ItemNo == s.FMaterialId)
+                .Select(x => x.Id.ToString())
+                .First();
+            if (!string.IsNullOrWhiteSpace(entityItemId))
+            {
+                entity.ItemId = entityItemId;
+            }
+            else if (!string.IsNullOrWhiteSpace(s.FMaterialId))
+            {
+                entity.ItemId = s.FMaterialId;
+            }
+            else
+            {
+                entity.ItemId = "0";
+            }
+
             if (s.FFreezeDate != null)
                 if (!s.FFreezerId.IsNullOrEmpty())
                     entity.FreezeTime =

--
Gitblit v1.9.3