From de11f71014cb91222dc2ec9888d4a38acb855ce5 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 14 九月 2023 09:31:37 +0800
Subject: [PATCH] 工艺路线 工序流转卡 工序进出站 增加权限 子数据 报表 十张

---
 WebAPI/Controllers/LMESController.cs |  204 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 157 insertions(+), 47 deletions(-)

diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index 12bc5d0..58bc4ee 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -58,20 +58,35 @@
         /// </summary>
         [Route("LEMS/MES_Sc_ProcessExchangeBillQuery_Json")]
         [HttpGet]
-        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user)
+        public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user,string HBillSubType)
         {
             DataSet ds;
             try
             {
                 List<object> columnNameList = new List<object>();
-                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
+                if (HBillSubType == "SUB")
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎸囧紩鍗℃棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else {
+
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "娴佽浆鍗℃棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
 
                 //鑾峰彇绯荤粺鍙傛暟
@@ -159,7 +174,7 @@
                     }
 
                     SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                    ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
+                    ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
                 }
                 else 
                 {
@@ -211,11 +226,21 @@
         {
             DataSet ds;
             DataSet ds1;
+            DataSet ds2;
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎸囧紩鍗℃棤缂栬緫鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 var HNum = HInterID_S.Split(',');
 
-                oCN.BeginTran();
+               
 
                 for (int j = 0; j < HNum.Length; j++)
                 {
@@ -236,12 +261,21 @@
                     string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString();
                     string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
 
+                    ds2 = oCN.RunProcReturn(@"select  a.HMaterID,a.HMainProcID,b.* from Gy_RoutingBillMain a 	inner join Gy_RoutingBillSub b on a.HInterID=b.HInterID where a.HMaterID=" + HMaterID + " and a.HMainProcID=" + HProcID + " and a.HBillSubType='SUB'", "Gy_RoutingBillMain");
+                    if (ds2.Tables[0].Rows.Count == 0)
+                    {
+                        long HGYInterID = DBUtility.ClsPub.CreateBillID("3301", ref DBUtility.ClsPub.sExeReturnInfo);
+                        string HGYBillNo = DBUtility.ClsPub.CreateBillCode("3301", ref DBUtility.ClsPub.sExeReturnInfo, true);
+                        oCN.RunProc("exec h_p_gy_Materl_PG " + HGYInterID + ",'" + HGYBillNo + "'," + HMaterID);
+                    }
+                   
+
                     ds1 = oCN.RunProcReturn(@"select  a.HMaterID,a.HMainProcID,b.* from Gy_RoutingBillMain a 	inner join Gy_RoutingBillSub b on a.HInterID=b.HInterID where a.HMaterID=" + HMaterID + " and a.HMainProcID=" + HProcID + " and a.HBillSubType='SUB'", "Gy_RoutingBillMain");
                     if (ds1.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "娌℃湁鐩稿搴旂殑榛樿宸ヨ壓璺嚎,璇峰厛璁剧疆宸ヨ壓璺嚎锛�";
+                        objJsonResult.Message = "鏃犻粯璁ゅ伐鑹鸿矾绾匡紒";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
@@ -250,6 +284,8 @@
                     string sReturn = "";
                     DBUtility.ClsPub.HOrgID = HOrgID;
                     oBill.ShowBill(HInterID, ref sReturn);
+
+                    oCN.BeginTran();
 
                     long HInterID1 = DBUtility.ClsPub.CreateBillID(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
                     string HBillNo = DBUtility.ClsPub.CreateBillCode(oBill.omodel.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
@@ -285,7 +321,6 @@
                         oBill.DetailColl.Add(oSub);
                     }
 
-
                     bool bResult = false;
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
 
@@ -300,9 +335,10 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                    oCN.Commit();
                 }
 
-                oCN.Commit();
+              
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "娲惧伐鎴愬姛锛�";
@@ -330,6 +366,15 @@
             DataSet ds1;
             try
             {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎸囧紩鍗℃棤缂栬緫鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 var HNum = HInterID_S.Split(',');
 
                 oCN.BeginTran();
@@ -658,20 +703,38 @@
         /// </summary>
         [Route("LEMS/MES_Gy_RoutingBillList_Json")]
         [HttpGet]
-        public object MES_Gy_RoutingBillList_Json(string sWhere, string user)
+        public object MES_Gy_RoutingBillList_Json(string sWhere, string user,string HBillSubType)
         {
             DataSet ds;
             try
             {
-                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Query", 1, false, user))
+                if (HBillSubType == "SUB")
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愭煡璇�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Query", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀛愬伐鑹鸿矾绾挎棤鏉冮檺鏌ヨ!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                 }
+                else {
+
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Query", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愭煡璇�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                }
+
 
                 //鑾峰彇绯荤粺鍙傛暟
                 string Ret = "";
@@ -885,22 +948,37 @@
         /// <returns></returns>
         [Route("LEMS/DeltetGy_RoutingBillSub")]
         [HttpGet]
-        public object DeltetGy_RoutingBillSub(Int64 lngBillKey, string user)
+        public object DeltetGy_RoutingBillSub(Int64 lngBillKey, string user,string HBillSubType)
         {
             DataSet ds;
-            string ModRightNameCheck = "Gy_RoutingBill_Drop";
+           
             try
             {
-                string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
-                //鍒犻櫎鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                if (HBillSubType == "SUB")
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒犻櫎鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Drop", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀛愬伐鑹鸿矾绾垮垹闄ゅけ璐ワ紒鏃犳潈闄愶紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
+                else {
+                    //鍒犻櫎鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Drop", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
+               
 
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (lngBillKey == 0)
@@ -2191,19 +2269,35 @@
         #region 宸ヨ壓璺嚎瀹℃牳/鍙嶅鏍稿姛鑳�
         [Route("Gy_RoutingBill/CheckGy_RoutingBill")]
         [HttpGet]
-        public object CheckGy_RoutingBill(string HInterID, int Type, string user)
+        public object CheckGy_RoutingBill(string HInterID, int Type, string user,string HBillSubType)
         {
             try
             {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Check", 1, false, user))
+                if (HBillSubType == "SUB")
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Check", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀛愬伐鑹鸿矾绾挎棤鏉冮檺瀹℃牳!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
+                else
+                {
+                    //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Check", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愬鏍�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+               
 
                 if (string.IsNullOrWhiteSpace(HInterID))
                 {
@@ -2310,19 +2404,35 @@
         #region 宸ヨ壓璺嚎鍗曞叧闂�/鍙嶅叧闂姛鑳�
         [Route("Gy_RoutingBill/CloseGy_RoutingBill_1")]
         [HttpGet]
-        public object CloseGy_RoutingBill(string HInterID, int Type, string user)
+        public object CloseGy_RoutingBill(string HInterID, int Type, string user,string HBillSubType)
         {
             try
             {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Close", 1, false, user))
+                if (HBillSubType == "SUB")
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Close", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀛愬伐鑹鸿矾绾挎棤鏉冮檺鍏抽棴!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
+                else
+                {
+                    //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Close", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愬叧闂�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+               
 
                 if (string.IsNullOrWhiteSpace(HInterID))
                 {

--
Gitblit v1.9.1