From e853dd2fecef3a0c446d161248d0498a5a081e66 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期三, 17 十二月 2025 18:49:49 +0800
Subject: [PATCH] SJ,XJ,RKJ优化修改

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

diff --git a/StandardInterface/MES.Service/service/WomcaaWWManager.cs b/StandardInterface/MES.Service/service/WomcaaWWManager.cs
index a92be2b..7b912c9 100644
--- a/StandardInterface/MES.Service/service/WomcaaWWManager.cs
+++ b/StandardInterface/MES.Service/service/WomcaaWWManager.cs
@@ -48,6 +48,14 @@
     private bool SaveOrUpdateDataWw(SqlSugarScope db, Womcaa mesWomcaa,
         List<Womcab> mesWomcabss)
     {
+        //鎵爜涓嶅厑璁稿垹闄�
+        var hasMaterialOut = db.Queryable<MesInvItemOuts>()
+                           .Any(x => x.WorkNo == mesWomcaa.Caa001);
+
+        if (hasMaterialOut)
+        {
+            throw new Exception($"MES鏈夐鏂欒褰曪紝鍗曞彿锛歿mesWomcaa.Caa001}锛屼笉鑳芥洿鏂帮紒");
+        }
         if (mesWomcaa.Id != null) base.DeleteById(mesWomcaa.Id);
 
         if (mesWomcabss.Count > 0)
@@ -63,6 +71,14 @@
     private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa,
         List<Womcab> mesWomcabs)
     {
+        //鎵爜涓嶅厑璁稿垹闄�
+        var hasMaterialOut = db.Queryable<MesInvItemOuts>()
+                           .Any(x => x.WorkNo == mesWomcaa.Caa001);
+
+        if (hasMaterialOut)
+        {
+            throw new Exception($"MES鏈夐鏂欒褰曪紝鍗曞彿锛歿mesWomcaa.Caa001}锛屼笉鑳芥洿鏂帮紒");
+        }
         var decimals = mesWomcabs.Select(s => s.Id).ToArray();
         var update = base.DeleteById(mesWomcaa.Id);
         var insertOrUpdate = db
@@ -122,7 +138,7 @@
             //PrdOrg = dto.erP_SCZZ,
             //TrustOrg = dto.erP_WTZZ,
             TbTime = DateTime.Now,
-            JaBs = "0"
+            JaBs = 0
         };
         if (dto.Type == "5")
             entity.IsXg = 1;
@@ -131,7 +147,7 @@
 
         if (dto.FStatus == "6" || dto.FStatus == "7")
         {
-            entity.JaBs = "1";
+            entity.JaBs =1;
             entity.JaTime = DateTime.Now;
         }
 
@@ -156,7 +172,7 @@
                 Cab006 = Convert.ToDecimal(dto.FNeedQty),
                 Cab007 = Convert.ToDecimal(dto.FPickedQty),
                 Cab009 = dto.FUnitID,
-                Cab014 = dto.FIsKeyItem,
+                Cab014 = Convert.ToInt32(dto.FIsKeyItem),
                 Pid = Convert.ToDecimal(dto.PID),
                 Eid = Convert.ToDecimal(dto.PID),
                 PositionNo = dto.FPositionNO,
@@ -170,8 +186,8 @@
                 SupplyType = dto.FSupplyType,
                 Numerator = Convert.ToDecimal(dto.FNumerator),
                 Denominator = Convert.ToDecimal(dto.FDenominator),
-                SCRAPQTY = Convert.ToDecimal(dto.FFixScrapQty),
-                SCRAPRATE = Convert.ToDecimal(dto.FScrapRate)
+                Scrapqty = Convert.ToDecimal(dto.FFixScrapQty),
+                Scraprate = Convert.ToDecimal(dto.FScrapRate)
                 //SalesOrder = dto.FXSHTBH,
             };
 

--
Gitblit v1.9.3