From ef517af50613c209b8f78fc29f276f748a98a2b0 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期五, 02 九月 2022 09:36:20 +0800
Subject: [PATCH] 生产资源列表 新增字段 mac地址  HMacAddr varchar(100) //设备MAC地址 设备档案列表 新增字段 生产资源  HSourceID    int      //对应生产资源(Gy_Source)

---
 WebAPI/Controllers/LMESController.cs |  122 +++++++++++++++++++++++++++++-----------
 1 files changed, 88 insertions(+), 34 deletions(-)

diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 3759f2b..f71a2bc 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -54,29 +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();
-                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere, "h_v_Sc_ProcessExchangeBillQuery");
-                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    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)
             {
@@ -103,7 +114,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 string sql = "select * from h_v_Sc_ProcessExchangeBillQuerySub where hmainid = ";
                 string sql1 = sql + sWhere;
-                ds = oCN.RunProcReturn(sql1, "h_v_Sc_ProcessExchangeBillQuerySub");
+                ds = oCN.RunProcReturn(sql1+ " order by cast(宸ュ簭鍙� as int)", "h_v_Sc_ProcessExchangeBillQuerySub");
             }
             catch (Exception e)
             {
@@ -208,12 +219,12 @@
                 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 top 1000 * 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 sql1 = "select  top 1000 * from h_v_Gy_RoutingBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere+ " order by hmainid desc,cast(宸ュ簭鍙� as int)";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList");
                 }
             }
@@ -311,6 +322,49 @@
         }
         #endregion
 
+        #region 宸ヨ壓璺嚎鍩虹鍒楄〃
+        /// <summary>
+        /// 杩斿洖宸ヨ壓璺嚎鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("LEMS/Gy_RoutingBillList")]
+        [HttpGet]
+        public object Gy_RoutingBillList(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();
+
+                string sql1 = "select * from h_v_Gy_RoutingBillList_Base where 1 = 1 ";
+                string sql = sql1 + sWhere + " order by hmainid desc";
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList_Base");
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            return GetObjectJson(ds);
+        }
+
+        #endregion
+
         #endregion
 
         /// <summary>
@@ -335,7 +389,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 " + sWhere + " order by hmainid desc", "h_v_IF_ICMOBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 " + sWhere + " order by 鍗曟嵁鍙� desc", "h_v_IF_ICMOBillList");
             }
             catch (Exception e)
             {
@@ -389,22 +443,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