From 04ef83a36a24e309c8d5240eee6ac93fc2bb156d Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期一, 06 十二月 2021 17:17:43 +0800
Subject: [PATCH] 器具改制申请单删除不掉问题查找'缺少表对象'

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController - .cs |  148 ++++++++++++++++++++++++++++---------------------
 1 files changed, 84 insertions(+), 64 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController - .cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController - .cs
index 15d78f7..6003dac 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController - .cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController - .cs
@@ -18,6 +18,7 @@
         public DataSet ds = new DataSet();
         public WebServer webserver = new WebServer();
         public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
         public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
         public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
@@ -791,44 +792,6 @@
             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MoveStockBillList order by 鏃ユ湡 desc", "h_v_IF_MoveStockBillList");
         }
         #endregion
-
-        /// <summary>
-        /// 鐢熶骇棰嗘枡鍗曞垪琛�
-        /// </summary>
-        /// <returns></returns>
-        [Route("Kf_MateOutBill/GetMateOutBillList")]
-        [HttpGet]
-        public object GetMateOutBillList(string sWhere)
-        {
-            try
-            {
-                ds = Sc_GetMateOutBillList(sWhere);
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
-                objJsonResult.data = ds.Tables[0];
-                return objJsonResult;
-            }
-            catch (Exception ex)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-
-        #region sql璇彞
-
-
-        public static DataSet Sc_GetMateOutBillList(string sWhere)
-        {
-            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MateOutBillList order by 鏃ユ湡 desc", "h_v_IF_MateOutBillList");
-        }
-        #endregion
-
-
         /// <summary>
         /// 閿�鍞嚭搴撳崟鍒楄〃
         /// </summary>
@@ -867,7 +830,36 @@
                 return objJsonResult;
             }
         }
-
+        /// <summary>
+        ///閿�鍞嚭搴撳崟鍒犻櫎鍔熻兘
+        /// </summary>
+        /// <returns></returns>
+        [Route("Kf_SellOutBill/DeltetSellOutBill")]
+        [HttpGet]
+        public object DeltetSeOutStockBackBill(string HInterID)
+        {
+            try
+            {
+                oCN.BeginTran();
+                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #region sql璇彞
 
 
@@ -1064,7 +1056,36 @@
                 return objJsonResult;
             }
         }
-
+        /// <summary>
+        ///浜у搧鍏ュ簱鍗曞垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Kf_ProductInBill/DeltetProductInBill")]
+        [HttpGet]
+        public object DeltetProductInBill(string HInterID)
+        {
+            try
+            {
+                oCN.BeginTran();
+                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
+                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #region sql璇彞
 
 
@@ -1134,24 +1155,12 @@
         {
             try
             {
-
                 ds = Sc_GetEntrustInBill(sWhere);
-                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 = "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)
             {
@@ -2341,7 +2350,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select HMaterID,HUnitID,HQty,HQtyMust,HRemark   from Sc_MouldMaintainPlanBillSub", "Sc_MouldMaintainPlanBillSub");
+                    ds = oCN.RunProcReturn("select a.HMaterID,m.HNumber HMaterNumber,a.HUnitID,u.HNumber HUnitNumber,a.HQty,a.HQtyMust,a.HRemark  from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID", "Sc_MouldMaintainPlanBillSub");
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
@@ -2349,7 +2358,7 @@
                 }
                 else
                 {
-                    string sql1 = "select HMaterID,HUnitID,HQty,HQtyMust,HRemark   from Sc_MouldMaintainPlanBillSub where 1 = 1 ";
+                    string sql1 = "select a.HMaterID,m.HNumber HMaterNumber,a.HUnitID,u.HNumber HUnitNumber,a.HQty,a.HQtyMust,a.HRemark  from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID where 1 = 1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainPlanBillSub");
                     objJsonResult.code = "0";
@@ -2941,7 +2950,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList", "h_v_Sc_MouldDotCheckBillList");
+                    ds = oCN.RunProcReturn("select HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList", "h_v_Sc_MouldDotCheckBillList");
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
@@ -2949,7 +2958,7 @@
                 }
                 else
                 {
-                    string sql1 = "select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList where 1 = 1 ";
+                    string sql1 = "select HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList where 1 = 1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckBillList");
                     objJsonResult.code = "0";
@@ -3213,7 +3222,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub", "Sc_MouldDotCheckPlanBillSub");
+                    ds = oCN.RunProcReturn("select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID", "Sc_MouldDotCheckPlanBillSub");
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
@@ -3221,7 +3230,7 @@
                 }
                 else
                 {
-                    string sql1 = "select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub where 1 = 1 ";
+                    string sql1 = "select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID where 1 = 1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckPlanBillSub");
                     objJsonResult.code = "0";
@@ -3570,6 +3579,8 @@
                 }
                 if (bResult)
                 {
+                    string sql = $"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ";
+                    oCn.RunProc(sql);
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
@@ -3977,6 +3988,8 @@
                 }
                 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 = "淇濆瓨鎴愬姛锛�";
@@ -4470,7 +4483,7 @@
                 lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2);
                 foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain)
                 {
-                    //oItem.HMaker = "";
+                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
                     oItem.HBillType = "3803";
                     oItem.HBillSubType = "3803";
@@ -4543,6 +4556,7 @@
                 {
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                  
                 }
                 else
                 {
@@ -4550,6 +4564,10 @@
                 }
                 if (bResult)
                 {
+                    string sql = $"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ";
+                    oCn.RunProc(sql);
+                    string sql1 = $"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ";
+                    oCn.RunProc(sql1);
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
@@ -4982,6 +5000,8 @@
                 }
                 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 = "淇濆瓨鎴愬姛锛�";

--
Gitblit v1.9.1