From f2e63446167a0a0b58e99bceb433d581b1531115 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期五, 27 二月 2026 10:01:55 +0800
Subject: [PATCH] wip导入,费用单导入,增加下拉框年月,不良原因列表增加字段物料分类

---
 WebAPI/Controllers/成本管理/CB_WipProcessTableController.cs |    2 
 WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs    |   67 +++++++++++++++++++++++++++++++++
 Model/基础资料/基础资料/ClsGy_BadReason_Model.cs                |    1 
 WebAPI/Controllers/成本管理/CB_ItemMoneyBillController.cs   |    2 
 WebAPI/DLL/ClsGy_BadReason_Ctl.cs                       |    5 +-
 5 files changed, 73 insertions(+), 4 deletions(-)

diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_BadReason_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_BadReason_Model.cs"
index 2b083da..fbcdfed 100644
--- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_BadReason_Model.cs"
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_BadReason_Model.cs"
@@ -11,6 +11,7 @@
         public string HDeptNumber;
         public Int64 HProcID;
         public Int64 HBadTypeID;
+        public Int64 HMaterTypeID;
         public string HBarCode;
     }
 }
diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
index a5177dd..fdd6e47 100644
--- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -89,6 +89,73 @@
                 return objJsonResult;
             }
         }
+        #region 涓嶈壇鍘熷洜瀛樺偍杩囩▼
+        /// <summary>
+        /// 杩斿洖涓嶈壇鍘熷洜鍒楄〃
+        /// </summary>
+        [Route("Gy_BadReason/list_1")]
+        [HttpGet]
+        public object list_1(string sWhere, string user,int HMaterID,string HBillType,string OrgID)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_BadReason_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    sWhere = "and 1=1";
+                }
+                else
+                    sWhere = sWhere.Replace("'","''");
+                ds = oCN.RunProcReturn("exec h_p_IF_BadReasonList " + HMaterID +",'"+ HBillType + "',"  + OrgID + ",'" + sWhere +"'"+ "  ", "h_p_IF_BadReasonList");
+
+               
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                //{
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+                //}
+                //else
+                //{
+                //objJsonResult.code = "0";
+                //objJsonResult.count = 0;
+                //objJsonResult.Message = "鏃犳暟鎹�";
+                //objJsonResult.data = null;
+                //return objJsonResult;
+                //}
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #region 涓嶈壇鍘熷洜瀹℃牳銆佸弽瀹℃牳
         /// <summary>
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 ac5697a..079a2f1 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"
@@ -1319,7 +1319,7 @@
                     {
                         // 鎻掑叆涓昏〃锛堟瘡缁勬彃鍏ヤ竴娆★級
                         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}', {DateTime.Now.Year}, {DateTime.Now.Month}, {"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"}');");
+                        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"}');");
 
                         // 鎻掑叆瀛愯〃锛堢粍鍐呮瘡涓墿鏂欐彃鍏ヤ竴娆★級
                         int HEntryID = 1;
diff --git "a/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_WipProcessTableController.cs" "b/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_WipProcessTableController.cs"
index 2cdeae5..5750342 100644
--- "a/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_WipProcessTableController.cs"
+++ "b/WebAPI/Controllers/\346\210\220\346\234\254\347\256\241\347\220\206/CB_WipProcessTableController.cs"
@@ -228,7 +228,7 @@
 
 
                     insertSql.AppendLine($"INSERT INTO CB_WipProcessTable  ([HYear], [HPeriod], [HDay], [HProcName], [HCusName], [HPartNumber], [HWIPQty], [HInProcessWIPQty], [HPanelQty], [HLot], [HOrderTime], [HStartTime], [HOutputTime], [HProductionTime], [HStatus], [HStayTime], [HChecker], [HCheckDate], [HMaker], [HMakeDate], [HUpDater], [HUpDateDate], [HCloseMan], [HCloseDate], [HCloseType], [HDeleteMan], [HDeleteDate], [HReamrk]) VALUES (");
-                    insertSql.AppendLine($" {DateTime.Now.Year}, {DateTime.Now.Month}, {DateTime.Now.Day}, '{item["浜у嚭宸ュ簭"]}', '{item["瀹㈡埛"]}',  '{item["鎴愬搧鏂欏彿"]}', '{item["WIP鏁伴噺"]}', '{item["鍦ㄥ埗WIP鏁伴噺"]}', '{item["鎷肩増鏁�"]}', '{item["LOT"]}', '{item["涓嬪崟鏃堕棿"]}', '{item["鎶曚骇鏃堕棿"]}', '{item["浜у嚭鏃堕棿"]}', '{item["鐢熶骇鏃堕棿"]}', '{item["鐘舵��"]}', '{item["鍋滅暀鏃堕棿(鍒嗛挓)"]}', '{""}', '{""}', '{user}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{""}', '{"0"}', '{""}', '{""}', '{"excel瀵煎叆"}');");
+                    insertSql.AppendLine($" {item["骞翠唤"]}, {item["鏈堜唤"]}, {DateTime.Now.Day}, '{item["浜у嚭宸ュ簭"]}', '{item["瀹㈡埛"]}',  '{item["鎴愬搧鏂欏彿"]}', '{item["WIP鏁伴噺"]}', '{item["鍦ㄥ埗WIP鏁伴噺"]}', '{item["鎷肩増鏁�"]}', '{item["LOT"]}', '{item["涓嬪崟鏃堕棿"]}', '{item["鎶曚骇鏃堕棿"]}', '{item["浜у嚭鏃堕棿"]}', '{item["鐢熶骇鏃堕棿"]}', '{item["鐘舵��"]}', '{item["鍋滅暀鏃堕棿(鍒嗛挓)"]}', '{""}', '{""}', '{user}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{""}', '{"0"}', '{""}', '{""}', '{"excel瀵煎叆"}');");
                 }
 
                 if (errorMessage.Length > 0)
diff --git a/WebAPI/DLL/ClsGy_BadReason_Ctl.cs b/WebAPI/DLL/ClsGy_BadReason_Ctl.cs
index 598158d..d7e002c 100644
--- a/WebAPI/DLL/ClsGy_BadReason_Ctl.cs
+++ b/WebAPI/DLL/ClsGy_BadReason_Ctl.cs
@@ -37,10 +37,10 @@
                 oCn.RunProc("Insert into " + MvarItemKey + " " +
                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                     ",HDeptID,HProcID,HUseFlag,HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime" +
-                    ",HLevel,HEndFlag,HStopflag,HRemark,HBadTypeID) " +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HBadTypeID,HMaterTypeID) " +
                     " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                     "," + oModel.HDeptID.ToString() + "," + oModel.HProcID.ToString() + ",'" + oModel.HUseFlag.ToString() + "'," + oModel.HUSEORGID.ToString() + "," + oModel.HCREATEORGID.ToString() + ",'" + oModel.HMakeEmp.ToString() + "',getdate()" +
-                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "',"+oModel.HBadTypeID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "',"+oModel.HBadTypeID +","+oModel.HMaterTypeID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
 
@@ -108,6 +108,7 @@
                     ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                     ",HCREATEORGID='" + oModel.HCREATEORGID + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
+                    ",HMaterTypeID ='" + oModel.HMaterTypeID + "'" +
                     ",HModifyTime=getdate()" +
                     ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�

--
Gitblit v1.9.1