From 45ff656a53848046d6a2a457a00c22ab1e357513 Mon Sep 17 00:00:00 2001
From: 杨乐 <杨乐@DESKTOP-5CU1TNO>
Date: 星期二, 15 三月 2022 08:26:01 +0800
Subject: [PATCH] 生产叫料平台

---
 WebAPI/Controllers/LMESController.cs |  145 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 100 insertions(+), 45 deletions(-)

diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 9cd5ba5..27bb091 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -54,23 +54,40 @@
         /// </summary>
         [Route("LEMS/MES_Sc_ProcessExchangeBillQuery_Json")]
         [HttpGet]
-        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere)
+        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere,string user)
         {
             DataSet ds;
             try
             {
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sWhere == null || sWhere.Equals(""))
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery", "h_v_Sc_ProcessExchangeBillQuery");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 ";
-                    string sql = sql1 + sWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillQuery");
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
 
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere+ " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillQuery");
+
+                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                //{
+                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 = null;
+                //return objJsonResult;
+                //}
             }
             catch (Exception e)
             {
@@ -80,7 +97,6 @@
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            return GetObjectJson(ds);
         }
 
         /// <summary>
@@ -175,6 +191,9 @@
             return GetObjectJson(ds);
         }
 
+        #region 宸ヨ壓璺嚎
+
+        #region 宸ヨ壓璺嚎鍒楄〃
         /// <summary>
         /// 杩斿洖宸ヨ壓璺嚎鍒楄〃
         ///鍙傛暟锛歴tring sql銆�
@@ -182,20 +201,30 @@
         /// </summary>
         [Route("LEMS/MES_Gy_RoutingBillList_Json")]
         [HttpGet]
-        public object MES_Gy_RoutingBillList_Json(string sWhere)
+        public object MES_Gy_RoutingBillList_Json(string sWhere,string user)
         {
             DataSet ds;
             try
             {
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                //if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_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_RoutingBillList ", "h_v_Gy_RoutingBillList");
+                    ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList order by hmainid desc", "h_v_Gy_RoutingBillList");
                 }
                 else
                 {
                     string sql1 = "select * from h_v_Gy_RoutingBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere;
+                    string sql = sql1 + sWhere+ " order by hmainid desc";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList");
                 }
             }
@@ -209,27 +238,31 @@
             }
             return GetObjectJson(ds);
         }
+
+        #endregion
+
+        #region 宸ヨ壓璺嚎  鍒犻櫎
         /// <summary>
         /// 宸ヨ壓璺嚎鍒犻櫎鍔熻兘
         /// </summary>
         /// <returns></returns>
         [Route("LEMS/DeltetGy_RoutingBillSub")]
         [HttpGet]
-        public object DeltetGy_RoutingBillSub(Int64 lngBillKey)
+        public object DeltetGy_RoutingBillSub(Int64 lngBillKey,string user)
         {
             DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            string ModRightNameCheck = "Gy_RoutingBill_Drop";
             try
             {
                 //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (lngBillKey == 0)
@@ -241,7 +274,7 @@
                     return objJsonResult;
                 }
                 oCN.BeginTran();//寮�濮嬩簨鍔�
-                ds = oCN.RunProcReturn("select * from Gy_RoutingBillSub where HInterID=" + lngBillKey, "Gy_RoutingBillSub");
+                ds = oCN.RunProcReturn("select * from Gy_RoutingBillmain where HInterID=" + lngBillKey, "Gy_RoutingBillmain");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -250,12 +283,21 @@
                     objJsonResult.data = null;
                     return objJsonResult; ;
                 }
-                //string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]);
-                //if (HChecker != " ")
+                string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]);
+                //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]);
+                if (HChecker != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //if (hdeleteman != "")
                 //{
                 //    objJsonResult.code = "0";
                 //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                //    objJsonResult.Message = "鍗曟嵁宸茬粡浣滃簾,涓嶈兘鍒犻櫎锛�";
                 //    objJsonResult.data = null;
                 //    return objJsonResult;
                 //}
@@ -278,6 +320,9 @@
                 return objJsonResult;
             }
         }
+        #endregion
+
+        #endregion
 
         /// <summary>
         /// 杩斿洖鐢熶骇浠诲姟鍗曞垪琛�
@@ -286,11 +331,21 @@
         /// </summary>
         [Route("LEMS/MES_IF_ICMOBillList_Json")]
         [HttpGet]
-        public object MES_IF_ICMOBillList_Json(string sWhere)
+        public object MES_IF_ICMOBillList_Json(string sWhere,string user)
         {
             DataSet ds;
             try
             {
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQuery", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愭煡璇�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 " + sWhere + " order by hmainid desc", "h_v_IF_ICMOBillList");
             }
             catch (Exception e)
@@ -345,22 +400,22 @@
         {
             try
             {
-                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 = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    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];
+                return objJsonResult;
+                //}
+                //else
+                //{
+                //objJsonResult.code = "0";
+                //objJsonResult.count = 0;
+                //objJsonResult.Message = "鏃犳暟鎹�";
+                //objJsonResult.data = null;
+                //return objJsonResult;
+                //}
             }
             catch (Exception e)
             {

--
Gitblit v1.9.1