From 9af04222e7449442f1d1cc1a80b6e07a90f4c9bf Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期二, 26 八月 2025 09:57:31 +0800
Subject: [PATCH] 1.采购、生产、委外、销售清单优化,取消反审核删除。

---
 MES.Service/service/WomcaaManager.cs |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/MES.Service/service/WomcaaManager.cs b/MES.Service/service/WomcaaManager.cs
index aa0e102..970982a 100644
--- a/MES.Service/service/WomcaaManager.cs
+++ b/MES.Service/service/WomcaaManager.cs
@@ -33,12 +33,15 @@
             switch (womErpCaa.Type)
             {
                 case "3":
-                    return UpdateData(db, mesWomcaa, mesWomcabs) ? 1 : 0;
+                    return SaveOrUpdateData(db, mesWomcaa, mesWomcabs,womErpCaa.Type)
+                        ? 1
+                        : 0;
+                    //return UpdateData(db, mesWomcaa, mesWomcabs) ? 1 : 0; //鍙嶅鏍镐笉鍒犻櫎锛屽仛update銆�
                 case "2":
                 case "4":
                 //kyy 2024-09-13 鍙樻洿
                 case "5":
-                    return SaveOrUpdateData(db, mesWomcaa, mesWomcabs)
+                    return SaveOrUpdateData(db, mesWomcaa, mesWomcabs,womErpCaa.Type)
                         ? 1
                         : 0;
                 default:
@@ -49,8 +52,15 @@
     }
 
     private bool SaveOrUpdateData(SqlSugarScope db, Womcaa mesWomcaa,
-        List<Womcab> mesWomcabs)
+        List<Womcab> mesWomcabs, string type)
     {
+        if(type == "3")
+        {
+            mesWomcaa.Typea = "3";  // 鏂板瀛楁璧嬪��
+        }
+
+
+
         if (StringUtil.CheckGuid(mesWomcaa.Guid))
             base.DeleteById(mesWomcaa.Guid);
 
@@ -68,13 +78,31 @@
             .IgnoreColumnsNull()
             .ExecuteCommand() > 0;
 
-        if (orUpdate && baOrUpdate) return true;
+        // if (orUpdate && baOrUpdate) 
+        // throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
+
+        if (orUpdate && baOrUpdate) 
+        {
+            // 璋冪敤瀛樺偍杩囩▼鏇存柊鐢ㄦ枡娓呭崟
+            db.Ado.ExecuteCommand("exec [dbo].[prc_update_womdab] @outMsg output,@outSum output,@inEdtUserGuid,@inCaaGuid",
+                new {
+                    outMsg = (string)null,  // 杈撳嚭鍙傛暟
+                    outSum = (int?)null,     // 杈撳嚭鍙傛暟
+                    inEdtUserGuid = new Guid("11111111-1111-1111-1111-111111111111"),
+                    inCaaGuid = new Guid(mesWomcaa.Guid.ToString())
+                });
+            return true;
+        }
         throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
+        
+
     }
 
     private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa,
         List<Womcab> mesWomcabs)
     {
+        //throw new NotImplementedException("瀛樺湪涓嬫湁鍗曟嵁锛屼笉鍏佽鍙嶅");
+
         var decimals = mesWomcabs.Select(s => s.Guid).ToArray();
         var update = base.DeleteById(mesWomcaa.Guid);
         var insertOrUpdate = db
@@ -107,7 +135,9 @@
             PlanId = dto.FPlannerID, ///     璁″垝鍛�
             Caa010 = dto.FPlanStartDate, ///     棰勮寮�宸ユ椂闂�
             Caa011 = dto.FPlanFinishDate, ///     棰勮瀹屽伐鏃堕棿
-            Caa005 = dto.FConveyDate, ///     寮�鍗曟棩鏈�
+            Caa005 = DateTime.TryParse(dto.FConveyDate, out var conveyDate) 
+            ? (conveyDate <= new DateTime(1900, 1, 1) ? null : conveyDate.ToString())
+                : null, ///     寮�鍗曟棩鏈�
             StockInlimith = dto.FStockInLimitH, ///     鍏ュ簱涓婇檺
             StockInlimitl = dto.FStockInLimitL, ///     鍏ュ簱涓嬮檺
             Mtono = dto.FMTONO, ///     璁″垝璺熻釜鍙�
@@ -172,7 +202,7 @@
                     ? Convert.ToDecimal(dto.FNeedQty)
                     : null, /// 闇�棰嗙敤閲� 
                 Cab007 = !string.IsNullOrEmpty(dto.FPickedQty)
-                    ? Convert.ToInt32(dto.FPickedQty)
+                    ? Convert.ToDecimal(dto.FPickedQty)
                     : null, /// 宸查鐢ㄩ噺 
                 PositionNo = dto.FPositionNO, /// 浣嶇疆鍙� 
                 SupplyOrganization = dto.FChildSupplyOrgId, /// 渚涘簲缁勭粐 

--
Gitblit v1.9.3