From 1cd4e66b490e4b6cc3368771cdff164990e152e7 Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期一, 22 十二月 2025 17:35:57 +0800
Subject: [PATCH] 接口增加单位换算,dab增加两个字段

---
 MES.Service/service/BasicData/MesRohInManager.cs |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs
index d820b54..574ab09 100644
--- a/MES.Service/service/BasicData/MesRohInManager.cs
+++ b/MES.Service/service/BasicData/MesRohInManager.cs
@@ -24,10 +24,13 @@
             return rohInErpRohIn.Type switch
             {
                 "2" or "4" or "5" => SaveOrUpdateData(db, mesRohIn,
-                    mesRohInDatas)
+                    mesRohInDatas, rohInErpRohIn.Type)
                     ? 1
                     : 0,
-                "3" => UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0,
+                "3" => SaveOrUpdateData(db, mesRohIn,
+                    mesRohInDatas, rohInErpRohIn.Type)
+                    ? 1
+                    : 0, //UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0,//鍙嶅鏍镐笉鍒犻櫎锛屽仛update銆�
                 _ => throw new NotImplementedException(
                     $"type娌℃湁{rohInErpRohIn.Type}杩欎釜绫诲瀷")
             };
@@ -56,8 +59,14 @@
 
     // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
     private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn,
-        List<MesRohInData> mesRohInDatas)
+        List<MesRohInData> mesRohInDatas, string type)
     {
+
+        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))
+        {
+            mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
+        }
+
         if (mesRohIn.Guid != null)
             db.Deleteable<MesRohIn>().Where(s => s.Guid == mesRohIn.Guid)
                 .ExecuteCommand();
@@ -74,7 +83,14 @@
             .IgnoreColumnsNull()
             .ExecuteCommand() > 0;
 
-        if (orUpdate && baOrUpdate) return true;
+        if (orUpdate && baOrUpdate)
+        {
+            if (!string.IsNullOrEmpty(mesRohIn.BillNo))
+            {
+                db.Ado.ExecuteCommand("exec [dbo].[prc_unit_check] @BillNo, '閲囪喘'", new { BillNo = mesRohIn.BillNo });
+            }
+            return true;
+        }
         throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
     }
 
@@ -152,7 +168,7 @@
         mesRohIn.FixedTelephone = rohIn.FixedTelephone;
         mesRohIn.Address = rohIn.Address;
         mesRohIn.Acctype = rohIn.Acctype;
-
+        mesRohIn.SynchronousDate = DateTime.Now;
 
         return mesRohIn;
     }

--
Gitblit v1.9.3