From eb22fa59bce6c5e1a90f2e6613847c4b9e5e4df3 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 28 十二月 2022 08:48:27 +0800
Subject: [PATCH] 点检记录单信息维护

---
 WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs |   67 ++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
index 8eb3244..a6b2b09 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldRepairOutBillController.cs
@@ -28,32 +28,23 @@
         {
             try
             {
-                ds = Sc_GetMouldRepairOutHouseBill(sWhere,Organization);
-                if (ds == null)
+                ds = Sc_GetMouldRepairOutHouseBill(sWhere, Organization);
+
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBillList", 1, false, user))
                 {
-                    //缂栬緫鏉冮檺
-                    if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBillList", 1, true, user))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                else
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
             }
             catch (Exception ex)
             {
@@ -70,11 +61,11 @@
             string sql1 = string.Format(@"select * from h_v_Sc_MouldRepairOutBillList where 搴撳瓨缁勭粐='" + Organization + "'");
             if (sWhere == null || sWhere.Equals(""))
             {
-                return new SQLHelper.ClsCN().RunProcReturn(sql1+ "order by 鏃ユ湡 desc", "h_v_Sc_MouldRepairOutBillList");
+                return new SQLHelper.ClsCN().RunProcReturn(sql1+ "order by 鍒跺崟鏃ユ湡 desc", "h_v_Sc_MouldRepairOutBillList");
             }
             else
             {
-                string sql = sql1 + sWhere+ "order by 鏃ユ湡 desc";
+                string sql = sql1 + sWhere+ "order by 鍒跺崟鏃ユ湡 desc";
                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldRepairOutBillList");
             }
 
@@ -92,7 +83,7 @@
         public object set_DeleteBill(string HInterID,string user)
         {
             //缂栬緫鏉冮檺
-            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Delete", 1, true, user))
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Delete", 1, false, user))
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
@@ -139,9 +130,21 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+                //鍒犻櫎鍓嶆煡鎵惧綋鍓嶅崟鎹殑鎵�鏈夊櫒鍏稩D
+                //string swhere = "";
+                //DataSet ds = oCn.RunProcReturn("select HMaterID from Sc_MouldStockBillSub where HinterID=" + HInterID, "Sc_MouldStockBillSub");
+                //for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
+                //{
+                //    swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString() + ",";
+                //}
+                //swhere = swhere.Substring(0, swhere.Length - 1);
                 bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
+                    //鍒犻櫎鎴愬姛淇敼鍣ㄥ叿妗f浣嶇疆
+                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  0,0,'{swhere}' ");
+                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                    oCn.RunProc(sql);
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
@@ -193,7 +196,7 @@
             try
             {
                 //缂栬緫鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Edit", 1, true, msg4))
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Edit", 1, false, msg4))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -330,15 +333,19 @@
                 {
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out',{oBill.omodel.HInterID.ToString()} ");
+                    oCn.RunProc(sql);
                 }
                 else
                 {
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    //淇敼鎴愬姛
+                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
+                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                    oCn.RunProc(sql);
                 }
                 if (bResult)
                 {
-                    string sql = $"exec h_p_Sc_MouldChangeFileStatus  'out',{oBill.omodel.HInterID.ToString()} ";
-                    oCn.RunProc(sql);
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
@@ -373,7 +380,7 @@
         {
             //flag=1 瀹℃牳锛�  flag=2 鍙嶅鏍�
             //缂栬緫鏉冮檺
-            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Check", 1, true, user))
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldRepairOut_SingleBill_Check", 1, false, user))
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
@@ -470,7 +477,7 @@
         #region[鍣ㄥ叿鏀瑰埗鍑哄簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁]
         [Route("Sc_MouldRepairOutBill/Sc_MouldRepairOutBillListCheckDetai1")]
         [HttpGet]
-        public object Sc_MouldRepairOutBillListCheckDetai(string sqlWhere)
+        public object Sc_MouldRepairOutBillListCheckDetai1(string sqlWhere)
         {
             DataSet ds;
             DataSet ds1;
@@ -482,7 +489,7 @@
                 {
                     ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
                                           鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust,
-                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName 
                                           FROM h_v_Sc_MouldRepairOutBillList"), "h_v_Sc_MouldRepairOutBillList");
                 }
                 else
@@ -491,7 +498,7 @@
                     //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
                     string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,
                                           鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust,
-                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅  
+                                          瀹炴敹鏁伴噺 HQty, HWHID, 浠撳簱浠g爜 HWHCode,浠撳簱 HWHName,瀛愬娉� HRemark,HStockOrgID,HUnitID,璁¢噺鍗曚綅浠g爜 HUnitCode,璁¢噺鍗曚綅 HUnitName 
                                           FROM h_v_Sc_MouldRepairOutBillList where 1=1 ");
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairOutBillList");

--
Gitblit v1.9.1