From 5a0a406dd7d49e175a71eda9d6488badfa97375a Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 19 十二月 2025 14:33:30 +0800
Subject: [PATCH] 客户信息:销售员编码转ID、物料信息:转编码逻辑修正

---
 MES.Service/service/BasicData/MesCustomerManager.cs |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/MES.Service/service/BasicData/MesCustomerManager.cs b/MES.Service/service/BasicData/MesCustomerManager.cs
index ffa64c2..e3814bd 100644
--- a/MES.Service/service/BasicData/MesCustomerManager.cs
+++ b/MES.Service/service/BasicData/MesCustomerManager.cs
@@ -6,7 +6,9 @@
 using Masuit.Tools;
 
 namespace MES.Service.service.BasicData;
-
+/// <summary>
+/// 瀹㈡埛淇℃伅
+/// </summary>
 public class MesCustomerManager : Repository<MesCustomer>
 {
     public bool Save(ErpCustomer customer)
@@ -151,8 +153,8 @@
             Fseller = customer.Fseller,
             //Fforbidstatus = customer.FForbidStatus,
             Remark = customer.FDescription,
-            FSubsidiary = "1",
-            Fumbrella = "1",
+            //FSubsidiary = "1",
+            //Fumbrella = "1",
             // 濡傛灉瀛樺湪锛屼娇鐢ㄧ幇鏈夌殑CreateDate锛屽悗缁皢鍒犻櫎鍚庨噸鏂版彃鍏�
             // 濡傛灉涓嶅瓨鍦紝璁句负褰撳墠鏃堕棿
             CreateDate = existingCustomer?.CreateDate ?? DateTime.Now,
@@ -165,9 +167,26 @@
             ItemC =null,
             ItemSap=null,
             LotFlag=null,
-            Iscommit= null
+            Iscommit= null,
+
+            FSubsidiary = string.IsNullOrEmpty(customer.FUseOrgId) ? "1" : customer.FUseOrgId,
+            Fumbrella = string.IsNullOrEmpty(customer.FCreateOrgId) ? "1" : customer.FCreateOrgId,
         };
 
+        //閿�鍞憳缂栫爜杞琁D,Fseller = customer.Fseller,
+        var entityFseller = Db.Queryable<MesStaff>()
+        .Where(x => x.StaffNo == customer.Fseller)
+        .Select(x => x.Id.ToString())
+        .First();
+        if (!string.IsNullOrWhiteSpace(entityFseller))
+        {
+            entity.Fseller = entityFseller;
+        }
+        else
+        {
+            entity.Fseller = "0";
+        }
+
         // ERP: 0=鏈鐢�, 1=绂佺敤
         // MES: A=鏈鐢�, B=绂佺敤
         if (customer.FForbidStatus.IsNullOrEmpty())

--
Gitblit v1.9.3