From 02bfe366088dd52dd143239a94ea45a1e3e898fe Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 30 八月 2023 09:02:51 +0800
Subject: [PATCH] 采购订单动态列,物料、工序、工艺路线新增质检方案字段,

---
 WebAPI/Controllers/品质管理/首件检验单/QC_FirstPieceCheckBillController.cs |  249 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 187 insertions(+), 62 deletions(-)

diff --git "a/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs" "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
index 4c7b4ce..8112c58 100644
--- "a/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
+++ "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_FirstPieceCheckBillController.cs"
@@ -20,6 +20,59 @@
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
+        #region 棣栦欢妫�楠屽崟鍒楄〃
+        [Route("QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList")]
+        [HttpGet]
+        public object QC_FirstPieceCheckBillList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                string sql1 = "select * from h_v_QC_FirstPieceCheckBill where 1 = 1  ";
+                string sql = sql1 + sWhere + " order by hmainid desc";
+                ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBill");
+
+                //娣诲姞鍒楀悕
+                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)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.list = columnNameList;
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+                    objJsonResult.list = columnNameList;
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #region 棣栦欢妫�楠屽崟淇濆瓨
         [Route("QC_FirstPieceCheckBill/set_SaveBill")]
@@ -190,58 +243,7 @@
                 return objJsonResult;
             }
         }
-        #endregion
-
-        #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛�
-        /// <summary>
-        ///鍙傛暟锛歴tring sql銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp")]
-        [HttpGet]
-        public object get_ICMOBillStatus_Tmp(int HInterID,int HEntryID,string HBillType)
-        {
-            try
-            {
-                if (HInterID == 0 || HBillType.Equals(""))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�"+ HInterID+ "锛汬EntryID锛�"+ HEntryID + "锛汬BillType锛�"+ HBillType+"锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    ds = oCN.RunProcReturn("exec h_p_QC_GetInfoByICMOStatusBill " + HInterID + "," + HEntryID + "," + HBillType, "h_p_QC_GetInfoByICMOStatusBill");
-                }
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
+        #endregion      
 
         #region 妫�楠屽�间繚瀛�
         [Route("QC_FirstPieceCheckBill/set_SaveValue")]
@@ -376,19 +378,91 @@
             }
         }
 
-        #region 棣栦欢妫�楠屽崟鍒楄〃
-        [Route("QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList")]
+        /// <summary>
+        /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetQC_FirstPieceCheck")]
         [HttpGet]
-        public object QC_FirstPieceCheckBillList(string sWhere, string user)
+        public object DeltetQC_FirstPieceCheck(string HInterID, string user)
+        {
+            string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete";
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //寮�濮嬩簨鐗�
+                oCN.BeginTran();
+                oCN.RunProc("Delete From QC_FirstPieceCheckBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From QC_FirstPieceCheckBillSub where HInterID = " + HInterID);
+                oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_ValueGrid where HInterID = " + HInterID);
+                oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_Result where HInterID = " + HInterID);
+                //鎻愪氦浜嬪姟
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack(); //鍥炴粴浜嬬墿
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓哄伐搴忚繘绔欏崟
+        [Route("QC_FirstPieceCheckBill/get_StationInBill")]
+        [HttpGet]
+        public object get_StationInBill(string HInterID, string user)
         {
             try
             {
                 List<object> columnNameList = new List<object>();
 
-                string sql1 = "select * from h_v_QC_FirstPieceCheckBill where 1 = 1  ";
-                string sql = sql1 + sWhere + " order by hmainid desc";
-                ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBill");
+                string sReturn = "";
+                string sql = "";
+                if (oSystemParameter.ShowBill(ref sReturn))
+                {
+                    switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
+                    {
+                        case "宸ュ簭":
+                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'宸ュ簭','" + HInterID + "'";
+                            break;
+                        case "鐗╂枡":
+                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'鐗╂枡','" + HInterID + "'";
+                            break;
+                        case "宸ヨ壓璺嚎":
+                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList " + "'宸ヨ壓璺嚎','" + HInterID + "'";
+                            break;
+                    }
+                   
+                }
 
+                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetStationInBillList");
+             
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
@@ -396,19 +470,70 @@
                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
-
+             
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
-                objJsonResult.list = columnNameList;
                 objJsonResult.data = ds.Tables[0];
-                return objJsonResult;
+                objJsonResult.list = columnNameList;
+                return objJsonResult;               
             }
             catch (Exception e)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 棣栦欢妫�楠屽崟鏍规嵁婧愬崟绫诲瀷鑾峰彇淇℃伅-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp")]
+        [HttpGet]
+        public object get_ICMOBillStatus_Tmp(int HInterID, int HEntryID, string HBillType)
+        {
+            try
+            {
+                if (HInterID == 0 || HBillType.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_QC_GetInfoByICMOStatusBill " + HInterID + "," + HEntryID + "," + HBillType, "h_p_QC_GetInfoByICMOStatusBill");
+                }
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }

--
Gitblit v1.9.1