From d79f81d5f07f47be053cfcbae4a4ed47cd0ccce0 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 13 八月 2024 09:59:03 +0800
Subject: [PATCH] 新增设备保养率报表、设备维修率报表调用方法

---
 WebAPI/Controllers/QC_ManagementController.cs |  212 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 199 insertions(+), 13 deletions(-)

diff --git a/WebAPI/Controllers/QC_ManagementController.cs b/WebAPI/Controllers/QC_ManagementController.cs
index 0bb6da0..d24128a 100644
--- a/WebAPI/Controllers/QC_ManagementController.cs
+++ b/WebAPI/Controllers/QC_ManagementController.cs
@@ -9,6 +9,7 @@
 using System.Data;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using Newtonsoft.Json;
 
 namespace WebAPI.Controllers
 {
@@ -33,12 +34,21 @@
         {
             try
             {
+                List<object> a = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    a.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 = a;
                 return objJsonResult;
                 //}
                 //else
@@ -101,6 +111,53 @@
         #endregion
 
         #region 鏌ヨ鍒楄〃鏂规硶
+
+        /// <summary>
+        /// 杩斿洖妫�楠屾柟妗堝崟鍒楄〃 浠呭寘鍚富琛�
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("QC_Management/MES_QC_CheckProjectList_Json_Main")]
+        [HttpGet]
+        public object MES_QC_CheckProjectList_Json_Main(string sWhere, string user)
+        {
+            DataSet ds;
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList_Main order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Gy_QCCheckProjectList_Main where 1=1";
+                    string sql = sql1 + sWhere + " order by 鏃ユ湡 desc ";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList_Main");
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            return GetObjectJson(ds);
+        }
+
+
         /// <summary>
         /// 杩斿洖妫�楠屾柟妗堝崟鍒楄〃
         /// </summary>
@@ -126,12 +183,12 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList order by hmainid desc ", "h_v_Gy_QCCheckProjectList");
+                    ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1=1";
-                    string sql = sql1 + sWhere+ " order by hmainid desc ";
+                    string sql = sql1 + sWhere+ " order by 鏃ユ湡 desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList");
                 }
             }
@@ -256,7 +313,7 @@
                 else
                 {
                     string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 鍏抽棴浜�='' ";
-                    string sql = sql1 + sqlWhere+ " order by hmainid desc ";
+                    string sql = sql1 + sqlWhere+ " order by 鍒跺崟鏃ユ湡 desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList");
                 }
             }
@@ -939,11 +996,38 @@
                 return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
-            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_NEW  where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_NEW");
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_Edit  where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_Edit");
             if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
-                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ敓浜ф眹鎶ュ崟鍙�" };
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄦ楠屾柟妗�" };
 
             return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        #endregion
+
+        #region 妫�楠屾柟妗堟煡璇�
+        [Route("QC_Management/MES_QC_CheckProjectListProjectDetaiList")]
+        [HttpGet]
+        public object MES_QC_CheckProjectListProjectDetaiList(string sWhere,string user)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn(string.Format(@"select * from h_v_Gy_QCCheckProjectList_Edit where 1=1 " + sWhere), "h_v_Gy_QCCheckProjectList_Edit");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
         }
         #endregion
 
@@ -956,14 +1040,12 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn(string.Format(@"select 娆″簭鍙� HPrjNo,妫�楠岄」鐩甀D HQCCheckItemID,妫�楠岄」鐩唬鐮� HQCCheckItemNumber,妫�楠岄」鐩� HQCCheckItemName,
-                                                       妫�楠屾爣鍑� HQCStd,鏈�澶ф楠屾爣鍑� HQCStdMax,妫�楠屽崟浣� HQCUnit,琛ㄤ綋澶囨敞 HRemark from h_v_Gy_QCCheckProjectList_NEW
-                                                       where hinterid='"+HInterID+"'"), "h_v_Gy_QCCheckProjectList_NEW");
+                ds = oCN.RunProcReturn(string.Format(@"select * from h_v_Gy_QCCheckProjectList_Edit where hinterid='" + HInterID+"'"), "h_v_Gy_QCCheckProjectList_Edit");
 
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
             }
             catch (Exception e)
             {
@@ -1025,7 +1107,6 @@
                     oItem.HBillStatus = 0;
                     oItem.HPeriod = 0;
                     oItem.HMaker = "";
-                    oItem.HStandard = false;
                     oItem.HMainSourceInterID = oItem.HInterID;
                     //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
@@ -1069,6 +1150,8 @@
                     oItemSub.HRelationQty = 0;
                     oItemSub.HRelationMoney = 0;
                     oItemSub.HCloseMan = "";
+                    oItemSub.HDestructInspect = Convert.ToInt32(oItemSub.HDestructInspect);
+                    oItemSub.HKeyInspect = Convert.ToInt32(oItemSub.HKeyInspect);
                     oBill.DetailColl.Add(oItemSub);
 
                 }
@@ -1262,6 +1345,109 @@
         }
         #endregion
 
+        #region 妫�楠屾柟妗堝鏍�/鍙嶅鏍�
+        [Route("Gy_QCCheckProject/AuditGy_QCCheckProject")]
+        [HttpGet]
+        public object AuditGy_QCCheckProject(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Check", 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;
+                }
+                DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain();
+                ClsPub.CurUserName = user;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+                    DataSet ds;
+                    string sql = "select * from  Gy_QCCheckProjectMain  where HInterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
+                    if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //瀹℃牳鍗曟嵁
+                    if (!oBill.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+                    DataSet ds;
+                    string sql = "select * from  Gy_QCCheckProjectMain  where HInterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿崟鎹�
+                        if (!oBill.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+
+                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
+
         #region 鏉ユ枡妫�楠�
         /// <summary>
         /// 淇濆瓨鏉ユ枡妫�楠屽崟

--
Gitblit v1.9.1