From dac3ee802f595993a4379c06e73c35ac62f52f15 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期三, 25 二月 2026 09:53:50 +0800
Subject: [PATCH] 成本费用单增加导入字段
---
WebAPI/Controllers/基础资料/基础资料/Gy_CostAverageTypeController.cs | 2 +-
WebAPI/Controllers/成本管理/CB_ItemMoneyBillController.cs | 47 +++++++++++++++++++++++++++++------------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
index 43b3270..17d275f 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_CostAverageTypeController.cs"
@@ -838,7 +838,7 @@
oCN.RollBack();//鍥炴粴浜嬪姟
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
+ objJsonResult.Message = "鏁版嵁宸茶绂佺敤鏃犳硶鍐嶆鍒犻櫎锛�";
objJsonResult.data = null;
return objJsonResult;
}
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 0c5e92c..ac5697a 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"
@@ -1020,14 +1020,15 @@
string HEmpName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鑱屽憳"].ToString());
string HICMOBillNo = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString());
+ string HProc = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["宸ュ簭"].ToString());
string HCostItemNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鎴愭湰椤圭洰浠g爜"].ToString());
string HCostItemName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鎴愭湰椤圭洰"].ToString());
//string HEntryID = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀛愯〃鍐呯爜"].ToString());
- string HDepNumber_sub = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀛愰儴闂ㄤ唬鐮�"].ToString());
- string HDepName_sub = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀛愰儴闂�"].ToString());
+ //string HDepNumber_sub = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀛愰儴闂ㄤ唬鐮�"].ToString());
+ //string HDepName_sub = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀛愰儴闂�"].ToString());
string HMaterNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鐗╂枡缂栫爜"].ToString());
string HMaterName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鐗╂枡鍚嶇О"].ToString());
@@ -1110,10 +1111,11 @@
// 1. 鏀堕泦鎵�鏈夐渶瑕佹煡璇㈢殑鏁版嵁
var HBillnos = list.Select(x => x["鍗曟嵁鍙�"].ToString()).Distinct().ToList();
- var HDeptNames = list.Select(x => x["閮ㄩ棬"].ToString()).Distinct().ToList();
- var HDeptNumbers = list.Select(x => x["閮ㄩ棬浠g爜"].ToString()).Distinct().ToList();
- var HDeptNames_sub = list.Select(x => x["瀛愰儴闂�"].ToString()).Distinct().ToList();
- var HDeptNumbers_sub = list.Select(x => x["瀛愰儴闂ㄤ唬鐮�"].ToString()).Distinct().ToList();
+ var HProc = list.Select(x => x["宸ュ簭"].ToString()).Distinct().ToList();
+ //var HDeptNames = list.Select(x => x["閮ㄩ棬"].ToString()).Distinct().ToList();
+ //var HDeptNumbers = list.Select(x => x["閮ㄩ棬浠g爜"].ToString()).Distinct().ToList();
+ var HDeptNames_sub = list.Select(x => x["閮ㄩ棬"].ToString()).Distinct().ToList();
+ var HDeptNumbers_sub = list.Select(x => x["閮ㄩ棬浠g爜"].ToString()).Distinct().ToList();
var materialNumbers = list.Select(x => x["鐗╂枡缂栫爜"].ToString()).Distinct().ToList();
var materialNames = list.Select(x => x["鐗╂枡鍚嶇О"].ToString()).Distinct().ToList();
var EmpNumbers = list.Select(x => x["鑱屽憳浠g爜"].ToString()).Distinct().ToList();
@@ -1131,14 +1133,14 @@
ICMODict[row["HBillNo"].ToString()] = (int)row["HInterID"];
}
- // 2. 鎵归噺鏌ヨ涓诲瓙琛ㄩ儴闂ㄤ俊鎭�
- string supplierQuery = $"SELECT HItemID, HName FROM Gy_Department WHERE HName IN ({string.Join(",", HDeptNames.Select(s => $"'{s.Replace("'", "''")}'"))})";
- DataSet supData = oCN.RunProcReturn(supplierQuery, "Gy_Department");
- Dictionary<string, int> supplierDict = new Dictionary<string, int>();
- foreach (DataRow row in supData.Tables[0].Rows)
- {
- supplierDict[row["HName"].ToString()] = (int)row["HItemID"];
- }
+ //// 2. 鎵归噺鏌ヨ涓诲瓙琛ㄩ儴闂ㄤ俊鎭�
+ //string supplierQuery = $"SELECT HItemID, HName FROM Gy_Department WHERE HName IN ({string.Join(",", HDeptNames.Select(s => $"'{s.Replace("'", "''")}'"))})";
+ //DataSet supData = oCN.RunProcReturn(supplierQuery, "Gy_Department");
+ //Dictionary<string, int> supplierDict = new Dictionary<string, int>();
+ //foreach (DataRow row in supData.Tables[0].Rows)
+ //{
+ // supplierDict[row["HName"].ToString()] = (int)row["HItemID"];
+ //}
// 2.1 鎵归噺鏌ヨ涓诲瓙琛ㄩ儴闂ㄤ俊鎭�
string supplierQuery_sub = $"SELECT HItemID, HName FROM Gy_Department WHERE HName IN ({string.Join(",", HDeptNames_sub.Select(s => $"'{s.Replace("'", "''")}'"))})";
@@ -1180,7 +1182,15 @@
string key = $"{row["HName"].ToString()}";
CostDict[key] = (int)row["HItemID"];
}
-
+ // 3.1 鎵归噺鏌ヨ宸ュ簭淇℃伅
+ string ProcessQuery = $"SELECT HItemID, HNumber, HName FROM Gy_Process WHERE HName IN ({string.Join(",", HProc.Select(m => $"'{m.Replace("'", "''")}'"))})";
+ DataSet ProcData = oCN.RunProcReturn(ProcessQuery, "Gy_Process");
+ Dictionary<string, int> ProcDict = new Dictionary<string, int>();
+ foreach (DataRow row in ProcData.Tables[0].Rows)
+ {
+ string key = $"{row["HName"].ToString()}";
+ ProcDict[key] = (int)row["HItemID"];
+ }
// 4. 鏌ヨ鐢ㄦ埛淇℃伅
DataSet emp = oCN.RunProcReturn($"SELECT Czybm FROM Gy_Czygl WHERE Czymc = '{user.Replace("'", "''")}'", "Gy_Czygl");
if (emp.Tables[0].Rows.Count == 0)
@@ -1210,7 +1220,7 @@
string materialKey = $"{materialNumber}_{materialName}";
// 妫�鏌ヤ緵搴斿晢
- if (!supplierDict.ContainsKey(supplier))
+ if (!supplierDict_sub.ContainsKey(supplier))
{
missingSupplierMessages.Add($"绗瑊lineNumber}琛岀殑閮ㄩ棬銆恵supplier}銆�");
}
@@ -1317,9 +1327,10 @@
{
int HMaterID = materialDict[$"{item["鐗╂枡缂栫爜"]}_{item["鐗╂枡鍚嶇О"]}"];
int HCostID = CostDict[item["鎴愭湰椤圭洰"]];
+ int HProcID = ProcDict[item["宸ュ簭"]];
- insertSql_sub.AppendLine($"INSERT INTO [CB_ItemMoneyBillSub] ([HInterID], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark],[HSourceInterID], [HSourceEntryID], [HSourceBillNo], [HSourceBillType],[HRelationQty], [HRelationMoney], [HBillNo_bak], [HCostItemID],[HDeptID], [HQty], [HPrice], [HMoney],[HMaterID], [HWaster], [HDate], [HBeginBalance], [HEndBalance], [HTimes]) VALUES (");
- insertSql_sub.AppendLine($"'{HInterID}', '{HEntryID}', '{""}', '{DateTime.Now}', '{"0"}', '{"excel瀵煎叆"}','{"0"}', '{"0"}', '{"0"}', '{"0"}','{"0"}', '{"0"}', '{""}', '{HCostID}', '{HSupplierID}', '{item["鏁伴噺"]}', '{item["鍗曚环"]}', '{item["閲戦"]}','{HMaterID}', '{item["鎹熻�楅噺"] ?? "0"}', '{DateTime.Now}', '{"0"}', '{"0"}', '{"0"}');");
+ insertSql_sub.AppendLine($"INSERT INTO [CB_ItemMoneyBillSub] ([HInterID], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark],[HSourceInterID], [HSourceEntryID], [HSourceBillNo], [HSourceBillType],[HRelationQty], [HRelationMoney], [HBillNo_bak], [HCostItemID],[HDeptID], [HQty], [HPrice], [HMoney],[HMaterID], [HWaster], [HDate], [HBeginBalance], [HEndBalance], [HTimes],[HProcID]) VALUES (");
+ insertSql_sub.AppendLine($"'{HInterID}', '{HEntryID}', '{""}', '{DateTime.Now}', '{"0"}', '{"excel瀵煎叆"}','{"0"}', '{"0"}', '{"0"}', '{"0"}','{"0"}', '{"0"}', '{""}', '{HCostID}', '{HSupplierID}', '{item["鏁伴噺"]}', '{item["鍗曚环"]}', '{item["閲戦"]}','{HMaterID}', '{item["鎹熻�楅噺"] ?? "0"}', '{DateTime.Now}', '{"0"}', '{"0"}', '{"0"}', '{HProcID}');");
HEntryID++;
}
}
--
Gitblit v1.9.1