From fbe0ac5adfec2673f0ec08847e11510135004611 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 07 八月 2023 14:41:55 +0800
Subject: [PATCH] 首件检验单

---
 WebAPI/Controllers/品质管理/首件检验单/QC_FirstPieceCheckBillController.cs |  197 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 195 insertions(+), 2 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 5256e23..e393046 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"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -37,9 +38,21 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string OperationType = sArray[2].ToString().Trim();
+            string user = sArray[3].ToString();
+            string Value = sArray[4].ToString();
             bool bResult;
             try
             {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 msg2 = "[" + msg2.ToString() + "]";
                 List<Model.ClsQC_FirstPieceCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillMain>>(msg2);
                 DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
@@ -108,6 +121,23 @@
                         oSub.HMin = DBUtility.ClsPub.isStrNull(subList[i].HMin);
                         oSub.HAvg = DBUtility.ClsPub.isStrNull(subList[i].HAvg);
                         oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
+
+                        oSub.HSampleSchemeID= DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID);
+                        oSub.HSampleQty= DBUtility.ClsPub.isLong(subList[i].HSampleQty);
+                        oSub.HSampleDamageQty= DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty);
+                        oSub.HAcceptQty= DBUtility.ClsPub.isLong(subList[i].HAcceptQty);
+                        oSub.HRejectQty= DBUtility.ClsPub.isLong(subList[i].HRejectQty);
+                        oSub.HSampleUnRightQty= DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty);
+                        oSub.HStatus= DBUtility.ClsPub.isStrNull(subList[i].HStatus);
+                        oSub.HUnitID= DBUtility.ClsPub.isLong(subList[i].HUnitID);
+                        oSub.HInspectVal= DBUtility.ClsPub.isStrNull(subList[i].HInspectVal);
+                        oSub.HTargetVal= DBUtility.ClsPub.isStrNull(subList[i].HTargetVal);
+                        oSub.HUpLimit= DBUtility.ClsPub.isStrNull(subList[i].HUpLimit);
+                        oSub.HDownLimit= DBUtility.ClsPub.isStrNull(subList[i].HDownLimit);
+                        oSub.HUpOffSet= DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet);
+                        oSub.HDownOffSet= DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet);
+                        oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod);
+                        oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                         BillNew.DetailColl.Add(oSub);
                     }
                     else
@@ -119,6 +149,7 @@
                         return objJsonResult;
                     }
                 }
+               
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 if (OperationType.Equals("1") || OperationType.Equals("2"))
                 {
@@ -208,6 +239,168 @@
             }
         }
         #endregion
-        //
+
+        #region 妫�楠屽�间繚瀛�
+        [Route("QC_FirstPieceCheckBill/set_SaveValue")]
+        [HttpPost]
+        public object set_SaveValue([FromBody] JObject msg)
+        {
+            ListModels oListModels = new ListModels();
+            try
+            {
+                var _value = msg["msg"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+
+                string Value = sArray[0].ToString(); //妫�楠屽�艰〃鏍�
+                Int64 HInterID = Convert.ToInt64(sArray[1]); //涓籌D
+                Int64 HEntryID = Convert.ToInt64(sArray[2]); //瀛怚D
+                bool bResult;
+
+
+                List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> valueList = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
+                valueList = oListModels.getObjectByJson_ClsClsQC_FirstPieceCheckBillSub_ValueGrid(Value);
+
+                DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
+
+                for (int i = 0; i < valueList.ToArray().Length; i++)
+                {
+                    if (i >= 0)//HQty
+                    {
+                        Model.ClsQC_FirstPieceCheckBillSub_ValueGrid oSub_Value = new Model.ClsQC_FirstPieceCheckBillSub_ValueGrid();
+                        oSub_Value.HInterID = HInterID;
+                        oSub_Value.HEntryID = HEntryID;
+                        oSub_Value.HSEQ = i + 1;
+                        oSub_Value.HInSpectResult = ClsPub.isStrNull(valueList[i].HInSpectResult);
+                        oSub_Value.HInSpectValue = ClsPub.isLong(valueList[i].HInSpectValue);
+                        oSub_Value.HInSpectValueB = ClsPub.isLong(valueList[i].HInSpectValueB);
+                        oSub_Value.HInSpectValueT = ClsPub.isStrNull(valueList[i].HInSpectValueT);
+
+                        BillNew.DetailColl_Value.Add(oSub_Value);
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                bResult = BillNew.AddValue(ref ClsPub.sExeReturnInfo, ref HInterID, ref HEntryID);
+
+                if (bResult == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨妫�楠屽�兼垚鍔�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                    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
+
+        /// <summary>
+        ///杩斿洖妫�楠屽�煎垪琛�
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("QC_ValueTable/getValueList")]
+        [HttpGet]
+        public object getValueList(Int64 HInterID, Int64 HEntryID, string user)
+        {
+            DataSet ds;
+            try
+            {              
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+                ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub_ValueGrid  where  HInterID="+ HInterID + " and HEntryID="+ HEntryID, "h_v_QC_FirstPieceCheckBillList");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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;
+            }
+        }
+
+        #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鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                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
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1