From f76084c29964fb0bd45c7fd8da2d1837ae995608 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 29 十一月 2024 13:23:40 +0800
Subject: [PATCH] 多人刷卡开工 保存子表

---
 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index faf4efb..eddce9c 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -322,9 +322,23 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
+                string HProcID = "0";
                 ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl");
-                string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
+                }
+
+                //鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚︽槸寮�宸�
+                ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus='1'", "Sc_ICMOBillStatus_Tmp");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗″彿:" + HBarCode + ",娴佽浆鍗℃湭寮�宸�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
                 if (ds.Tables[0].Rows.Count == 0)
@@ -732,6 +746,23 @@
             try
             {
                 ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "h_v_Gy_BarCodeBill");
+
+                //鍒ゆ柇鏉$爜鏄惁瀛樺湪鏉$爜妗f
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
+                    DataSet dataTable = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HBillNo='" + HSourceBillNo + "'", "Sc_ProcessExchangeBillMain");
+                    //鍒ゆ柇鏉$爜鐨勬簮鍗� 娴佽浆鍗℃槸鍚﹁鍒犻櫎
+                    if (dataTable.Tables[0].Rows.Count == 0)
+                    {
+                        //濡傛灉婧愬崟宸茬粡鍒犻櫎  鍒欐潯鐮佷篃鍒犻櫎閲嶆柊鐢熸垚
+                        oCN.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBarCode + "'");
+
+                        //閲嶆柊鏌ヨ鏉$爜妗f 杩涘叆鏂板鏂规硶
+                        ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
+                    }
+                }
+
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     //鍒ゆ柇闀垮害鏄惁涓�29浣� 鏃犲皹杞﹂棿
@@ -993,7 +1024,7 @@
         #region  宸ュ簭鍗曞搧杩囩珯 閰嶄欢鐮佹煡璇�
         [Route("Cj_SingleStation/HBardCodeAccessoryList")]
         [HttpGet]
-        public object HBardCodeAccessoryList(string HBarCode, string user)
+        public object HBardCodeAccessoryList(string HBarCode, string HProcExchBillNo, string user,string HBillType)
         {
             try
             {
@@ -1026,6 +1057,25 @@
                     return objJsonResult;
                 }
 
+                DataSet dataSet  = oCN.RunProcReturn(@"exec h_p_CJ_SNBarCodeBillMouldBathSelect '" + HBarCode + "','" + HProcExchBillNo + "','"+ HBillType + "'", "h_p_CJ_SNBarCodeBillMouldBathSelect");
+
+                if (dataSet.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閰嶄欢鏉$爜鍒ゆ柇澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HBack"]) == "2")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "";

--
Gitblit v1.9.1