From 9f55ece5fc027d28fa776343c2ef1281c0b05b9c Mon Sep 17 00:00:00 2001
From: wyb <1qaz@123>
Date: 星期三, 19 五月 2021 16:30:39 +0800
Subject: [PATCH] 检验方案编辑删除完成

---
 WebAPI/Controllers/QC_ManagementController.cs |  131 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 127 insertions(+), 4 deletions(-)

diff --git a/WebAPI/Controllers/QC_ManagementController.cs b/WebAPI/Controllers/QC_ManagementController.cs
index ced9280..a3e6fd1 100644
--- a/WebAPI/Controllers/QC_ManagementController.cs
+++ b/WebAPI/Controllers/QC_ManagementController.cs
@@ -112,11 +112,11 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select top 500 * from h_v_Gy_QCCheckProjectList ", "h_v_Gy_QCCheckProjectList");
+                    ds = oCN.RunProcReturn("select top 500 * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 ", "h_v_Gy_QCCheckProjectList");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1 = 1 ";
+                    string sql1 = "select * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList");
                 }
@@ -237,9 +237,44 @@
             return GetObjectJson(ds);
         }
 
+        /// <summary>
+        /// 杩斿洖妫�楠屾柟妗堝崟瀛愯〃璇︽儏
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("MES_QC_CheckProjectDetail_Json")]
+        [HttpGet]
+        public object MES_QC_CheckProjectDetail_Json(string sqlWhere)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sqlWhere == null || sqlWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select HPrjNo,HQCCheckItemID,HQCStd,HQCStdMax,HQCUnit,HRemark from Gy_QCCheckProjectSub", "Gy_QCCheckProjectSub");
+                }
+                else
+                {
+                    string sql1 = "select HPrjNo,HQCCheckItemID,HQCStd,HQCStdMax,HQCUnit,HRemark from Gy_QCCheckProjectSub where 1 = 1 ";
+                    string sql = sql1 + sqlWhere;
+                    ds = oCN.RunProcReturn(sql, "Gy_QCCheckProjectSub");
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            return GetObjectJson(ds);
+        }
+
         #endregion
 
-        #region 淇濆瓨鏂规硶
+        #region 淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
 
         /// <summary>
         /// 淇濆瓨妫�楠屾柟妗�
@@ -280,7 +315,6 @@
                     oItem.HMaker = "";
                     oItem.HStandard = false;
                     oItem.HMainSourceInterID = oItem.HInterID;
-                    oItem.HInterID = 0;
                     oItem.HMaterTypeID = 0;
                     //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
@@ -368,6 +402,95 @@
             }
         }
 
+
+        /// <summary>
+        /// 妫�楠屾柟妗堣幏鍙栦俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("GetQCCheckProjectDetail")]
+        [HttpGet]
+        public ApiResult<DataSet> GetQCCheckProjectDetail(string HID)
+        {
+            var model = LuBaoSevice.GetCheckProjectDetail(HID);
+            return model;
+        }
+
+
+        /// <summary>
+        /// 妫�楠屾柟妗堥�昏緫鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("DeltetQCCheckProject")]
+        [HttpGet]
+        public object DeltetQCCheckProject(string HInterID)
+        {
+            DataSet ds;
+            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+                ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where HInterID=" + HInterID, "Gy_QCCheckProjectMain");
+                DataSet ds2 = oCN.RunProcReturn("select * from Gy_QCCheckProjectSub where HInterID=" + HInterID, "Gy_QCCheckProjectSub");
+                if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2==null || ds2.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩欎釜鍗曟嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+                int HBillStatus = Convert.ToInt32(ds.Tables[0].Rows[0]["HBillStatus"]);
+                int HPrjNo= Convert.ToInt32(ds2.Tables[0].Rows[0]["HPrjNo"]);
+                if (HBillStatus < 0 || HPrjNo<0)
+                {
+                    oCN.RollBack();//鍥炴粴浜嬪姟
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+             
+                oCN.RunProc("update Gy_QCCheckProjectMain set HBillStatus=-1 where HInterID="+HInterID);
+                oCN.RunProc("update Gy_QCCheckProjectSub set HPrjNo=-1 where HInterID=" + HInterID);
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "* 鍗曟嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+
         #endregion
 
 

--
Gitblit v1.9.1