From d34b37ef388bb384db07787df7f9856b5e410dd9 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 06 六月 2024 15:28:29 +0800
Subject: [PATCH] 1.网页 增加 巡检单2 编辑模块 和 单据列表 模块; 2.生产计划排产 界面 , 增加 页签 缺料分析; 当 点击 日期的列名时, 页签 缺料分析 获取这一天的 缺料情况 复制一个 一模一样的 生产计划排产 界面出来, 命名为 半成品计划排产 。 菜单里 也增加出来。

---
 WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs |  279 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 242 insertions(+), 37 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs b/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs
index e3939c6..f62fb7d 100644
--- a/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs
@@ -1,4 +1,5 @@
 锘縰sing DBUtility;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
@@ -18,6 +19,7 @@
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
+        public DAL.ClsGy_QCCheckItem_Ctl BillOld = new DAL.ClsGy_QCCheckItem_Ctl();
 
         #region 妫�楠岄」鐩垪琛ㄦ暟鎹�
         /// <summary>
@@ -27,36 +29,57 @@
         /// </summary>
         [Route("Gy_CheckItem/list")]
         [HttpGet]
-        public object list(string sWhere)
+        public object list(string sWhere,string user)
         {
             try
             {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckItem_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_IF_QCCheckItemList " + sWhere, "h_v_IF_QCCheckItemList");
+                    ds = oCN.RunProcReturn("select * from h_v_IF_QCCheckItemList  order by 浠g爜", "h_v_IF_QCCheckItemList");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_IF_QCCheckItemList where 1 = 1 ";
-                    string sql = sql1 + sWhere;
+                    string sql = sql1 + sWhere+ " order by 浠g爜";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_QCCheckItemList");
                 }
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "false锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
-                else
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
+
+                //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)
             {
@@ -126,7 +149,8 @@
             DAL.ClsGy_QCCheckItem_View oDeptHlp = new DAL.ClsGy_QCCheckItem_View();
             try
             {
-                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User))
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -134,6 +158,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
                 if (oDeptHlp.GetInfoByID(HItemID))
                 {
                     if (oDept.HavChildCodes(HItemID))
@@ -222,11 +247,25 @@
                 string HName = list[0].HName;
                 string HShortNumber = list[0].HNumber;
                 long HParentID = list[0].HParentID;
+                long HLevel= list[0].HLevel;
                 string HHelpCode = list[0].HHelpCode;
                 string HRemark = list[0].HRemark;
                 bool HStopflag = list[0].HStopflag;
                 bool HUseFlag = list[0].HUseFlag;
                 long HQCCheckClassID = list[0].HQCCheckClassID;
+                string HDefaultResult = list[0].HDefaultResult;
+
+                long HUnitID = list[0].HUnitID;
+                string HAnalysisMethod = list[0].HAnalysisMethod;
+                string HDefectLevel = list[0].HDefectLevel;
+                long HDestructInspect = list[0].HDestructInspect;
+                long HKeyInspect = list[0].HKeyInspect;
+                long HQualityStdID = list[0].HQualityStdID;
+                long HInspectMethodID = list[0].HInspectMethodID;
+                long HInspectInstruMentID = list[0].HInspectInstruMentID;
+                long HInspectBasisID = list[0].HInspectBasisID;
+                long HSampleSchemeID = list[0].HSampleSchemeID;
+                long HISsystemSet = list[0].HISsystemSet;
 
                 if (!DBUtility.ClsPub.AllowNumber(HNumber))
                 {
@@ -244,9 +283,13 @@
                 //涓昏〃
                 oCN.RunProc("Insert Into Gy_QCCheckItem " +
                 "(HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HQCCheckClassID) " +
+                ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HQCCheckClassID,HDefaultResult" +
+                ",HAnalysisMethod,HDefectLevel,HUnitID,HDestructInspect,HKeyInspect,HQualityStdID" +
+                ",HInspectMethodID,HInspectInstruMentID,HInspectBasisID,HSampleSchemeID,HISsystemSet) " +
                 " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" +
-                ",'1',0,'" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','0','"+ HQCCheckClassID + "')");
+                ",'"+ HLevel + "','0','" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','鏈娇鐢�','"+ HQCCheckClassID + "','" + HDefaultResult + 
+                "','" + HAnalysisMethod + "','" + HDefectLevel + "'," + HUnitID + "," + HDestructInspect + "," + HKeyInspect + "," + HQualityStdID +
+                "," + HInspectMethodID + "," + HInspectInstruMentID + "," + HInspectBasisID + "," + HSampleSchemeID + "," + HISsystemSet + ")");
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 if (list[0].HItemID.ToString() != "")
                 {
@@ -292,12 +335,22 @@
                 string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string msg2 = sArray[0].ToString();
                 string msg3 = sArray[1].ToString();
-                string msg4 = sArray[2].ToString();
+                string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚�
                 string msg5 = sArray[3].ToString();
+
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(msg5, 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 //鍙嶅簭鍒楀寲
                 msg2 = "[" + msg2.ToString() + "]";
-                List<MaintenanceAcceptItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceAcceptItem>>(msg2);
+                List<CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CheckItem>>(msg2);
 
                 long HItemID = int.Parse(msg3);
                 string HNumber = list[0].HNumber;
@@ -305,21 +358,23 @@
                 string HShortNumber = list[0].HNumber;
                 long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID;
                 string HHelpCode = list[0].HHelpCode;
+                long  HQCCheckClassID = list[0].HQCCheckClassID;
                 string HRemark = list[0].HRemark;
-                string HStopflag = list[0].HStopflag;
-                string HUseFlag = list[0].HUseFlag;
+                bool HStopflag = list[0].HStopflag;
+                bool HUseFlag = list[0].HUseFlag;
 
-
-                //鍒ゆ柇鏉冮檺
-                if (!ClsPub.Security_Log(msg5, 1, true, msg4))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
+                string HDefaultResult = list[0].HDefaultResult;
+                long HUnitID = list[0].HUnitID;
+                string HAnalysisMethod = list[0].HAnalysisMethod;
+                string HDefectLevel = list[0].HDefectLevel;
+                long HDestructInspect = list[0].HDestructInspect;
+                long HKeyInspect = list[0].HKeyInspect;
+                long HQualityStdID = list[0].HQualityStdID;
+                long HInspectMethodID = list[0].HInspectMethodID;
+                long HInspectInstruMentID = list[0].HInspectInstruMentID;
+                long HInspectBasisID = list[0].HInspectBasisID;
+                long HSampleSchemeID = list[0].HSampleSchemeID;
+                long HISsystemSet = list[0].HISsystemSet;
 
                 if (!DBUtility.ClsPub.AllowNumber(HNumber))
                 {
@@ -343,18 +398,33 @@
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
                 //涓昏〃
-                oCN.RunProc("Update Gy_RepairCheck set " +
+                oCN.RunProc("Update Gy_QCCheckItem set " +
                     " HNumber='" + HNumber + "'" +
                     ",HName='" + HName + "'" +
                     ",HShortNumber='" + HShortNumber + "'" +
                     ",HHelpCode='" + HHelpCode + "'" +
                     ",HParentID=" + HParentID +
                     ",HStopflag='" + HStopflag + "'" +
+                    ",HQCCheckClassID='" + HQCCheckClassID + "'" +
+                    ",HDefaultResult='" + HDefaultResult + "'" +
+
+                    ",HAnalysisMethod='" + HAnalysisMethod + "'" +
+                    ",HDefectLevel='" + HDefectLevel + "'" +
+                    ",HUnitID='" + HUnitID + "'" +
+                    ",HDestructInspect='" + HDestructInspect + "'" +
+                    ",HKeyInspect='" + HKeyInspect + "'" +
+                    ",HQualityStdID='" + HQualityStdID + "'" +
+                    ",HInspectMethodID='" + HInspectMethodID + "'" +
+                    ",HInspectInstruMentID='" + HInspectInstruMentID + "'" +
+                    ",HInspectBasisID='" + HInspectBasisID + "'" +
+                    ",HSampleSchemeID='" + HSampleSchemeID + "'" +
+                    ",HISsystemSet='" + HISsystemSet + "'" +
+
                     ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                 //灏嗕笂绾� 涓洪潪鏈骇
-                oCN.RunProc("Update Gy_RepairCheck set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+                oCN.RunProc("Update Gy_QCCheckItem set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //
                 oCN.Commit();
                 objJsonResult.code = "1";
@@ -406,6 +476,37 @@
         }
         #endregion
 
+        #region 妫�楠岄」鐩慨鏀硅幏鍙栫粦瀹氭暟鎹鍥�
+        /// <summary>
+        /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Gy_CheckItem/xg_View")]
+        [HttpGet]
+        public object xg_View(long HInterID)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckItemList_Edit where HItemID=" + HInterID, "h_v_Gy_QCCheckItemList_Edit");
+
+                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 = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 妫�楠岄」鐩幏鍙栨爲鍨嬪垪琛ㄦ暟鎹�
         [Route("Gy_CheckItem/LoadTree")]
         [HttpGet]
@@ -433,5 +534,109 @@
             }
         }
         #endregion
+
+        #region 妫�楠岄」鐩鏍�/鍙嶅鏍�
+        [Route("Gy_CheckItem/AuditGy_CheckItem")]
+        [HttpGet]
+        public object AuditGy_CheckItem(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckItem_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;
+                }
+
+                ClsPub.CurUserName = user;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+                    DataSet ds;
+                    string sql = "select * from  Gy_QCCheckItem where HItemID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //瀹℃牳鍗曟嵁
+                    if (!BillOld.AuditByID2(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_QCCheckItem where HItemID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿崟鎹�
+                        if (!BillOld.DeAuditByID2(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
+
     }
 }

--
Gitblit v1.9.1