From 81bb23d6d09943a41bac424ae284e659dae13dfc Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 28 二月 2023 10:25:12 +0800
Subject: [PATCH] 瑞琪 同步删除 工序出站单

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs      |   66 +++++++++++++++++++++++++++++++++
 WebAPI/Controllers/Sc_ProcessMangementController.cs         |   27 +++++++++++++
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs |    1 
 3 files changed, 93 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index e0d73c1..d4ad9f0 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1220,6 +1220,72 @@
         }
         #endregion
 
+        #region 鏍规嵁鍗曟嵁鍙� 鍚屾鎶ラ敊鍒犻櫎鍑虹珯鍗�
+        [Route("Cj_StationOutBill/DelStationOutBill")]
+        [HttpGet]
+        public object DelStationOutBill(string HInterID)
+        {
+            try
+            {
+                DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
+
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+
+                DataTable DTable;
+                int num = 0;
+                //鍒ゆ柇鍏ュ簱鏄惁鍚屾
+                 DTable = oCN.RunProcReturn("select * from  Sc_StationOutBillMain where HInterID='" + HInterID + "' and  HRelationQty=0", "Sc_StationOutBillMain").Tables[0];
+                if (DTable.Rows.Count != 0)
+                {
+                    num++;
+                }
+                //鍒ゆ柇鏈鎶ュ簾鏄惁鍚屾
+                DTable = oCN.RunProcReturn("select * from  Sc_StationOutBillMain where  HProcExchInterID='" + DTable.Rows[0]["HProcExchInterID"].ToString() + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0];
+                if (DTable.Rows.Count != 0)
+                {
+                    num++;
+                }
+
+                if (num > 0)
+                {
+                    if (!oBill.DeleteBill(long.Parse(HInterID), 0, 0, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鏃犻』鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+               
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 缂栬緫鍓嶅垽鏂�
         [Route("Cj_StationOutBill/set_ShowBillJudge")]
         [HttpGet]
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 9eb7c33..899f3c7 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -466,7 +466,6 @@
                     oBill.DetailColl.Clear();
                     if (!bResult)
                     {
-                        oCN.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 246256d..d68b954 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -624,6 +624,19 @@
                 ////鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁
                 //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc");
                 //DataRow dr = ds.Tables[0].Rows[0];
+
+                //鍒ゆ柇鍏ュ簱鐨勫悎鏍兼暟閲忔槸鍚︿负0
+                var DTable = oCN.RunProcReturn("select * from  Sc_StationOutBillMain where HBillNo='"+ BillNo + "' ", "Sc_StationOutBillMain").Tables[0];
+
+                if (double.Parse(DTable.Rows[0]["HQty"].ToString()) == 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍚堟牸鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 //淇濆瓨
                 oCN.BeginTran();
                 //鐢熶骇姹囨姤鍗曚富琛�
@@ -885,6 +898,20 @@
                 ////鏍规嵁宸ュ簭姹囨姤鍗曚富ID鑾峰彇宸ュ簭姹囨姤鍏ュ簱鍗曠殑鏁版嵁
                 //DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc");
                 //DataRow dr = ds.Tables[0].Rows[0];
+
+                //鍒ゆ柇鏈鎶ュ簾鎬绘暟閲忔槸鍚︿负0
+                var DTable = oCN.RunProcReturn("select sum(HWasterQty) HWasterQty from  Sc_StationOutBillMain where  HProcExchBillNo='"+ BillNo + "' and HBFFlag=0 ", "Sc_StationOutBillMain").Tables[0];
+
+                if (double.Parse(DTable.Rows[0]["HWasterQty"].ToString()) == 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎶ュ簾鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
                 //淇濆瓨
                 oCN.BeginTran();
                 //鐢熶骇姹囨姤鍗曚富琛�

--
Gitblit v1.9.1