From b2e18e3fc0735edf1fc378936c81e5971bc52f61 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期六, 28 二月 2026 14:38:26 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/成本管理/CB_ItemMoneyBillController.cs |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git "a/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_ItemMoneyBillController.cs" "b/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_ItemMoneyBillController.cs"
index 34d81d4..e4cf686 100644
--- "a/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_ItemMoneyBillController.cs"
+++ "b/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_ItemMoneyBillController.cs"
@@ -1190,8 +1190,8 @@
                 }
 
                 // 3. 鎵归噺鏌ヨchengbenxiangmu淇℃伅
-                string CostQuery = $"SELECT HItemID, HNumber, HName FROM Gy_ItemMoney_1 WHERE HNumber IN ({string.Join(",", CostNumbers.Select(m => $"'{m.Replace("'", "''")}'"))}) AND HName IN ({string.Join(",", CostNames.Select(m => $"'{m.Replace("'", "''")}'"))}) and HUSEORGID ={organ}";
-                DataSet CostData = oCN.RunProcReturn(CostQuery, "Gy_ItemMoney_1");
+                string CostQuery = $"SELECT HItemID, HNumber, HName FROM Gy_CostItem WHERE HNumber IN ({string.Join(",", CostNumbers.Select(m => $"'{m.Replace("'", "''")}'"))}) AND HName IN ({string.Join(",", CostNames.Select(m => $"'{m.Replace("'", "''")}'"))}) and HUSEORGID ={organ}";
+                DataSet CostData = oCN.RunProcReturn(CostQuery, "Gy_CostItem");
                 Dictionary<string, int> CostDict = new Dictionary<string, int>();
                 foreach (DataRow row in CostData.Tables[0].Rows)
                 {
@@ -1262,7 +1262,7 @@
                         missingMaterialMessages.Add($"绗瑊lineNumber}琛岀殑鐢熶骇璁㈠崟銆恵ICMOcheck}銆�");
                     }
                     // 妫�鏌ラ」鐩垚鏈�
-                    if (CostDict.Count == 0)
+                    if (CostDict.Count == 0|| !CostDict.ContainsKey(Costcheck))
                     {
                         missingCostMessages.Add($"绗瑊lineNumber}琛岀殑椤圭洰鎴愭湰銆恵Costcheck}銆�");
                     }
@@ -1357,12 +1357,12 @@
                     long HInterID = DBUtility.ClsPub.CreateBillID("1802", ref DBUtility.ClsPub.sExeReturnInfo);
 
 
-                    
 
-                    
-                        // 鎻掑叆涓昏〃锛堟瘡缁勬彃鍏ヤ竴娆★級
-                        insertSql.AppendLine($"INSERT INTO CB_ItemMoneyBillMain  ([HInterID], [HBillNo], [HDate], [HYear], [HPeriod], [HBillType], [HBillSubType], [HBillStatus], [HCheckItemNowID], [HCheckItemNextID], [HCheckFlowID], [HRemark], [HBacker], [HBackDate], [HBackRemark], [HChecker], [HCheckDate], [HMaker], [HMakeDate], [HUpDater], [HUpDateDate], [HCloseMan], [HCloseDate], [HCloseType], [HDeleteMan], [HDeleteDate], [HMainSourceBillType], [HMainSourceInterID], [HMainSourceEntryID], [HMainSourceBillNo], [HPrintQty],  [HEmpID], [HDeptID], [HICMOInterID], [HMaterID], [HICMOBillNo], [HExplanation], [HInnerBillNo], [HBeginDate], [HEndDate], [HOrgID]) VALUES (");
-                        insertSql.AppendLine($"'{HInterID}', '{HBillNo}', '{DateTime.Now}', {list[0]["骞翠唤"]}, {list[0]["鏈堜唤"]}, {"1802"}, '{"1802"}', '{"1"}',  '{"0"}', '{"0"}', '{"0"}', '{"excel瀵煎叆"}', '{""}', '{DateTime.Now}', '{""}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{"0"}', '{""}', '{DateTime.Now}', '{""}', '{"0"}', '{"0"}', '{""}', '{"0"}', '{EmpID}', '{HSupplierID}', '{ICMOInterID}','{0}','{ICMO}','{""}','{"0"}','{DateTime.Now}','{DateTime.Now}','{"100038"}');");
+
+                    DateTime firstDayWithTime = new DateTime(Convert.ToInt32(list[0]["骞翠唤"]), Convert.ToInt32(list[0]["鏈堜唤"]), 1);
+                    // 鎻掑叆涓昏〃锛堟瘡缁勬彃鍏ヤ竴娆★級
+                    insertSql.AppendLine($"INSERT INTO CB_ItemMoneyBillMain  ([HInterID], [HBillNo], [HDate], [HYear], [HPeriod], [HBillType], [HBillSubType], [HBillStatus], [HCheckItemNowID], [HCheckItemNextID], [HCheckFlowID], [HRemark], [HBacker], [HBackDate], [HBackRemark], [HChecker], [HCheckDate], [HMaker], [HMakeDate], [HUpDater], [HUpDateDate], [HCloseMan], [HCloseDate], [HCloseType], [HDeleteMan], [HDeleteDate], [HMainSourceBillType], [HMainSourceInterID], [HMainSourceEntryID], [HMainSourceBillNo], [HPrintQty],  [HEmpID], [HDeptID], [HICMOInterID], [HMaterID], [HICMOBillNo], [HExplanation], [HInnerBillNo], [HBeginDate], [HEndDate], [HOrgID]) VALUES (");
+                        insertSql.AppendLine($"'{HInterID}', '{HBillNo}', '{firstDayWithTime}', {list[0]["骞翠唤"]}, {list[0]["鏈堜唤"]}, {"1802"}, '{"1802"}', '{"1"}',  '{"0"}', '{"0"}', '{"0"}', '{"excel瀵煎叆"}', '{""}', '{DateTime.Now}', '{""}', '{""}', '{DateTime.Now}', '{user}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{"0"}', '{""}', '{DateTime.Now}', '{""}', '{"0"}', '{"0"}', '{""}', '{"0"}', '{EmpID}', '{HSupplierID}', '{ICMOInterID}','{0}','{ICMO}','{""}','{"0"}','{DateTime.Now}','{DateTime.Now}','{"100038"}');");
 
                         // 鎻掑叆瀛愯〃锛堢粍鍐呮瘡涓墿鏂欐彃鍏ヤ竴娆★級
                         int HEntryID = 1;

--
Gitblit v1.9.1