From 41717d1b7866e69692b2c338000932930e14765f Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期四, 04 十二月 2025 15:04:25 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs |  278 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 274 insertions(+), 4 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index 2650cec..014336e 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -1496,7 +1496,7 @@
                 sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
                 oCN.RunProc(sql);
                 //鍙嶅啓宸ュ簭鍑虹珯鍗曠殑鍚堟牸鏁伴噺
-                oCN.RunProc("update Sc_StationOutBillMain WITH (TABLOCKX) set HQty-=1  where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'");
+                oCN.RunProc("update Sc_StationOutBillMain  set HQty-=1  where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'");
 
 
                 oCN.Commit();
@@ -2856,8 +2856,8 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "";
-                    objJsonResult.data = "娌℃湁鏌ヨ鍒版暟鎹�";
+                    objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+                    objJsonResult.data = "";
                     return objJsonResult;
                 }
 
@@ -2875,7 +2875,7 @@
         #endregion
 
         #region 宸ュ簭鍗曞搧杩囩珯 鍏抽敭浠剁粦瀹氶厤浠朵俊鎭复鏃跺瓨鍌�
-        [Route("Cj_SingleStation/BarCodeBillBomMatch_XW")]
+        [Route("Cj_SingleStation/BarCodeBillBomBind_XW")]
         [HttpGet]
         public object PartsBardCode_JX(string HBillNo,string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID)
         {
@@ -2936,6 +2936,130 @@
             }
         }
         #endregion
+
+        #region  宸ュ簭鍗曞搧杩囩珯 SN闀洉鐮佹煡璇㈠叧閿欢娓呭崟(鏍规嵁娴佽浆鍗″彿)
+        [Route("Cj_SingleStation/HBardCodeBomListByHProcExch_XW")]
+        [HttpGet]
+        public object HBardCodeBomListByHProcExch_XW(string HBillNo, string HBarCode, int HProcID, int HOrgID, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-1-068]鏃犳煡璇㈡潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鏉$爜妗f涓凡鏈夋湰娆℃壂鎻忕殑鏉$爜锛屽尮閰嶇敤鏂欐竻鍗曪紙鎵爜鏁版嵁鍐欏叆涓存椂琛級
+                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomMatchByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HProcID + "'," + HOrgID, "h_p_Gy_BarCodeBillBomMatchByHProcExch_XW");
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = "";
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "";
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏌ヨ鍒版暟鎹�";
+                    objJsonResult.data = "";
+                    return objJsonResult;
+                }
+
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[0000-1-010]娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ュ簭鍗曞搧杩囩珯 鍏抽敭浠剁粦瀹氶厤浠朵俊鎭复鏃跺瓨鍌紙鏍规嵁娴佽浆鍗″彿锛�
+        [Route("Cj_SingleStation/BarCodeBillBomBindByHProcExch_XW")]
+        [HttpGet]
+        public object BarCodeBillBomBindByHProcExch_XW(string HBillNo, string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID)
+        {
+            try
+            {
+                //鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀瓨鍦ㄦ潯鐮佹。妗堝綋涓�
+                ds = oCN.RunProcReturn(@"select 1 from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    //鏉$爜妗f涓病鏈夋湰娆℃壂鎻忕殑鏉$爜锛屽垯鏍规嵁瑙勫垯瑙f瀽鐢熸垚鏉$爜
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇ユ潯鐮佷笉瀛樺湪锛�" + HBarCode;
+                    objJsonResult.data = "";
+                    return objJsonResult;
+
+                }
+
+                //鏉$爜妗f涓凡鏈夋湰娆℃壂鎻忕殑鏉$爜锛屾煡璇㈤厤浠朵俊鎭紙鎵弿鏉$爜淇℃伅鍐欏叆涓存椂琛級
+                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomBindByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HBarCode_P + "','" + HProcID + "','" + HOrgID + "'", "h_p_Gy_BarCodeBillBomBindByHProcExch_XW");
+
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = "";
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "";
+                        objJsonResult.data = ds.Tables[0];
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "";
+                    objJsonResult.data = "娌℃湁鏌ヨ鍒版暟鎹�";
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "ERROR锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
 
         #region  宸ュ簭鍗曞搧杩囩珯 鎵玈N鐮佸嚭绔欎繚瀛�(淇濆瓨鍒板嚭绔欐眹鎶ラ噷(+鍏抽敭浠剁粦瀹�))
         [Route("Cj_SingleStation/AddStationOutBillAndAssemblyBill")]
@@ -3301,6 +3425,152 @@
             }
         }
         #endregion
+
+        #region 杩囩珯瑙g粦鍒楄〃 鏌ヨ
+        [Route("Cj_SingleStation/UnbindBarList")]
+        [HttpGet]
+        public object BarList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Cj_SingleStation_UnbindBarList", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_UnbindStation_BarList order by 鏉$爜鏃ユ湡 desc", "h_v_Sc_UnbindStation_BarList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Sc_UnbindStation_BarList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鏉$爜鏃ユ湡 desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_UnbindStation_BarList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 閲嶅伐鏉$爜淇℃伅 鏌ヨ
+        [Route("Cj_SingleStation/UnbindBarInfo")]
+        [HttpGet]
+        public object UnbindBarInfo(string HBarCodeIDs, string user)
+        {
+            try
+            {
+                if (HBarCodeIDs == null || HBarCodeIDs.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閲嶅伐鏉$爜淇℃伅鏈�掑叆锛岃閫�鍑洪噸璇�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    string sql = "exec h_p_Sc_UnbindBarInfo '" + HBarCodeIDs + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_UnbindBarInfo");
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 瑙i櫎鍖呰鍏崇郴銆佹媶闄ょ墿鏂�(1:瑙i櫎鍖呰鍏崇郴锛�2.鎷嗛櫎鐗╂枡)
+        [Route("Cj_SingleStation/DelRelation")]
+        [HttpGet]
+        public object DelRelation(string HBarCodeIDs, Int64 HICMOInterID, Int64 HICMOEntryID, Int64 HProcID, Int64 HType, string user)
+        {
+            try
+            {
+                if (HBarCodeIDs == null || HBarCodeIDs.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎷嗛櫎鏉$爜淇℃伅鏈�掑叆锛岃閫�鍑洪噸璇�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    string sql = "exec h_p_Sc_DelbindBarRelation '" + HBarCodeIDs + "'," + HICMOInterID + "," + HICMOEntryID + "," + HProcID + "," + HType;
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_DelbindBarRelation");
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() == "0")
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString();
+                    objJsonResult.data = "";
+                    return objJsonResult;
+                }
+
+               
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
         #endregion
 
     }

--
Gitblit v1.9.1