From 94323a38801dee4c9320edd33698208c5f760d55 Mon Sep 17 00:00:00 2001
From: 杨乐 <yang.le.192@qq.com>
Date: 星期三, 12 一月 2022 16:50:16 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/SCGL/Sc_PackUnionBillController.cs |   85 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_PackUnionBillController.cs b/WebAPI/Controllers/SCGL/Sc_PackUnionBillController.cs
index 54a7fcb..c7ede8d 100644
--- a/WebAPI/Controllers/SCGL/Sc_PackUnionBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_PackUnionBillController.cs
@@ -75,7 +75,7 @@
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            DLL.ClsKf_MateOutBackBill oBill = new DLL.ClsKf_MateOutBackBill();
+            DAL.ClsSc_PackUnionBill oBill = new DAL.ClsSc_PackUnionBill();
             if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
             {
                 if (oBill.omodel.HBillStatus > 1)
@@ -102,23 +102,57 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
-                if (IsDete)
+                ds = oCn.RunProcReturn("Select * from Sc_PackUnionBillMain where HinterID='" + lngBillKey, "Sc_PackUnionBillMain");
+                var HBarCode_Pack = ds.Tables[0].Rows[0]["HBarCode_Pack"].ToString();
+                if (ds.Tables.Count < 1)
                 {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "涓嶅瓨鍦ㄧ鐮�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鏄惁鍏ュ簱 
+                    ds = oCn.RunProcReturn("select * from Sc_ScanLineInStock where HBarCode_Pack='" + HBarCode_Pack + "'", "Sc_ScanLineInStock");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "-1";
+                        objJsonResult.Message = "璇ョ鏉$爜宸插叆搴撲笉鍏佽鍙栨秷!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    ds = oCn.RunProcReturn("Select 1 from Gy_BarCodeBill where HBarCode='" + HBarCode_Pack + "'", "Gy_BarCodeBill");
+                    if (ds == null && ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "-1";
+                        objJsonResult.Message = "鏃犳晥绠辨潯鐮�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    ds = oCn.RunProcReturn("Select 1 from Gy_BarCodeBill where HBarCode='" + HBarCode_Pack + "' and HStopflag='1'", "Gy_BarCodeBill");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "-1";
+                        objJsonResult.Message = "姝ょ鏉$爜宸蹭綔搴�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
+
+                oCn.BeginTran();
+                oCn.RunProc("Update  Gy_BarCodeBill set HStopflag='1'  where HBarCode='" + HBarCode_Pack + "'");
+                oCn.RunProc("Delete From Sc_PackUnionBillSub_Sum  where HBarCode_Pack='" + HBarCode_Pack + "'");
+                oCn.RunProc("Delete From Sc_PackUnionBillSub  where HInterID='" + lngBillKey + "'");
+                oCn.RunProc("Delete From Sc_PackUnionBillMain  where HInterID='" + lngBillKey + "'");
+                oCn.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             else
             {
@@ -148,5 +182,32 @@
             return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
         }
         #endregion
+
+        #region 鏍囧噯宸ユ椂鍗曞垪琛�
+
+        [Route("Sc_PackUnionBill/GetSc_StationInBillList")]
+        [HttpGet]
+        public object GetSc_StationInBillList(string sWhere)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("select * from h_v_Sc_StationInBillListMain order by hmainid desc", "h_v_Sc_StationInBillListMain");
+                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;
+            }
+        }
+
+        #endregion
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.1