From 4a8f16f0d07d67098e538c6a03bdc979b04af9bc Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 15 九月 2025 16:16:10 +0800
Subject: [PATCH] 1111

---
 MES.Service/service/BasicData/MesRohInManager.cs |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs
index fc681ae..043fab3 100644
--- a/MES.Service/service/BasicData/MesRohInManager.cs
+++ b/MES.Service/service/BasicData/MesRohInManager.cs
@@ -129,12 +129,37 @@
             mesRohIn.Supplier = mesSupplier.Id.ToString();
         }
 
+        // SETTLEMENT_PARTY -> MesSupplier.id
+        if (!string.IsNullOrEmpty(rohIn.FSettleId))
+        {
+            var settlementSupplier = Db.Queryable<MesSupplier>()
+                .Where(s => s.SuppNo == rohIn.FSettleId)
+                .Select(s => s.Id)
+                .First();
+            if (settlementSupplier != null)
+            {
+                mesRohIn.SettlementParty = settlementSupplier.ToString();
+            }
+        }
+
+        // PURCHASE_DEPT -> SYS_DEPARTMENT.DEPARTMENTID
+        if (!string.IsNullOrEmpty(rohIn.FPurchaseDeptId))
+        {
+            var department = Db.Queryable<SysDepartment>()
+                .Where(d => d.Departmentcode == rohIn.FPurchaseDeptId)
+                .Select(d => d.Id)
+                .First();
+            if (department != null)
+            {
+                mesRohIn.PurchaseDept = department.ToString();
+            }
+        }
+
         mesRohIn.CloseStatus = rohIn.FCloseStatus;
-        mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
-        mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
+        // mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
+        mesRohIn.PurchaseOrg = "1";
         mesRohIn.PurchaseGroup = rohIn.FPurchaserGroupId;
         mesRohIn.Purchaser = rohIn.FPurchaserId;
-        mesRohIn.SettlementParty = rohIn.FSettleId;
         mesRohIn.PaymentParty = rohIn.FChargeId;
         mesRohIn.Email = rohIn.FProviderEMail;
         mesRohIn.Remarks = rohIn.Remarks;

--
Gitblit v1.9.3