From b8b5f197826f04a5a6a6da78699b4090626074b7 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期五, 06 三月 2026 13:27:01 +0800
Subject: [PATCH] 检验单 添加 华舟配置项

---
 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs |  269 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 227 insertions(+), 42 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index d028b41..f0d731d 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -57,7 +57,7 @@
         #region  宸ュ簭鍗曞搧涓嶈壇閲囬泦 鎵爜鏌ヨ
         [Route("Cj_SingleStation/HBardCodeList")]
         [HttpGet]
-        public object HBardCodeList(string HBarCode, string user)
+        public object HBardCodeList(string HBarCode,int HProcID, string user)
         {
             try
             {
@@ -71,36 +71,34 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl");
-                string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
 
-                ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 鏉$爜='" + HBarCode + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange");
+                ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 鏉$爜='" + HBarCode + "' and HProcID='"+ HProcID + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange");
 
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏉$爜鏌ユ棤鏁版嵁锛�";
+                    objJsonResult.Message = "鏉$爜璺熷綋鍓嶅伐搴忔煡鏃犳暟鎹紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                int num = 0;
-                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
-                {
-                    if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID)
-                    {
-                        num = 1;
-                    }
-                }
-                if (num == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "褰撳墠鏉$爜涓庡綋鍓嶅伐搴忎笉鍖归厤!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                //int num = 0;
+                //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                //{
+                //    if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID)
+                //    {
+                //        num = 1;
+                //    }
+                //}
+                //if (num == 0)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "褰撳墠鏉$爜涓庡綋鍓嶅伐搴忎笉鍖归厤!";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
 
                 if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "姝e父")
                 {
@@ -308,7 +306,13 @@
             //淇敼鏉$爜琛ㄧ殑鐘舵��
             oCN.RunProc("update Gy_BarCodeBill set HStatus='"+ HResult + "' where HBarCode='"+ oSub.HBarCode + "'");
 
-            LogService.Write("绫诲瀷:" + oSub.HBadTypeID + ",鍒跺崟浜�:" + oSub.HMaker + ",鍒跺崟鏃ユ湡:" + oSub.HMakeDate);
+            //鏌ヨ褰撳墠鏉$爜瀵瑰簲鐨勫嚭绔欏崟id
+             ds= oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HBarCode='" + oSub.HBarCode + "' and HSourceEntryID='" + oSub.HProcExchEntryID + "'", "Sc_StationOutBillSub_SN");
+            if (ds.Tables[0].Rows.Count > 0)
+            {
+                linterid= ds.Tables[0].Rows[0]["HInterID"].ToString();
+            }
+            LogService.Write("绫诲瀷:" + oSub.HBadTypeID + ",鍒跺崟浜�:" + oSub.HMaker + ",鍒跺崟鏃ユ湡:" + oSub.HMakeDate  + ",宸ュ簭:" + oSub.HProcID  + ",娴佽浆鍗�:"+ oSub.HProcExchBillNo + ",鍑虹珯鍗昳d:"+ linterid);
             //淇敼鍑虹珯鍗曠殑 涓嶈壇 鎶ュ簾鏁伴噺
             if (HResult == "涓嶈壇")
             {
@@ -372,8 +376,9 @@
                     if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
                     {
                        
-                        //鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚︽槸寮�宸�
-                        ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
+                        //鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭鏄惁鏄紑宸�
+                        ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0' and HProcID='"+ HProcID + "'", "Sc_ICMOBillStatus_Tmp");
+                        //鏌ヤ笉鍒拌瘉鏄庢病鏈夊紑宸ヨ繘鍏ヤ笅涓�鍙ユ煡璇�
                         if (ds.Tables[0].Rows.Count == 0)
                         {
                             //鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚﹀ⅷ瑗垮摜鐨�
@@ -386,16 +391,20 @@
                                 objJsonResult.data = null;
                                 return objJsonResult;
                             }                                                 
-                        }
+                        }   
                     }
                 }
 
 
-                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
+                //2026 0228鏂帿灏� 涓ら亾宸ュ簭瑕佸悎骞舵姇鏂� 鑷姩鍒嗛厤 鑰佺殑 h_p_Gy_BarCodeBillBomList 鐢ㄤ簬绮惧噯鏌ヨ  鏂扮殑 h_p_Gy_BarCodeBillBomList2 鐢ㄤ簬鏌ヨ鍑鸿鍏ㄩ儴鐨勪笂鏂�
+                //ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList");
+                ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList2 '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList2");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
-                    DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList");
+                    //2026 0228鏂帿灏� 涓ら亾宸ュ簭瑕佸悎骞舵姇鏂� 鑷姩鍒嗛厤 鑰佺殑 h_p_Sc_ProcessExchangeBillList 鐢ㄤ簬绮惧噯鏌ヨ  鏂扮殑 h_p_Sc_ProcessExchangeBillList2 鐢ㄤ簬鏌ヨ鍑鸿鍏ㄩ儴鐨勪笂鏂�
+                    //DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList");
 
+                    DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2");
                     if (dataSet.Tables[0].Rows.Count > 0)
                     {
                         objJsonResult.code = "2";
@@ -1728,11 +1737,11 @@
                     ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub_Mater where HInterID=" + model.HInterID+ " order by HEntryID  desc", "Sc_SourceLineRepairBillSub_Mater");
 
                     oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub_Mater
-(HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID
-,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID
-,HUnitID,HBarCode,HBatchNo )values
-({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID}
-,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')");
+                    (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID
+                    ,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID
+                    ,HUnitID,HBarCode,HBatchNo )values
+                    ({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID}
+                    ,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')");
 
                     //淇敼浜х嚎杩芥函鍗曠粦瀹氱殑鏉$爜鎵瑰彿
                     oCN.RunProc("update Sc_AssemblyBillSub set HBarCode='" + temp.HBarCode + "' where HInterID=" + temp.HInterID + " and HEntryID=" + temp.HEntryID);
@@ -1743,21 +1752,21 @@
                     model = JsonConvert.DeserializeObject<Model.ClsSc_SourceLineRepairBillMain>(sMainStr);
 
                     oCN.RunProc($@"insert into Sc_SourceLineRepairBillMain(HYear, HPeriod, HBillType, HBillSubType, HInterID,
-HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID,
-HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo)
-values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID}
-,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0
-,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')");
+                    HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID,
+                    HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo)
+                    values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID}
+                    ,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0
+                    ,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')");
 
                     List<Model.ClsSc_SourceLineRepairBillSub> subLsit = new List<Model.ClsSc_SourceLineRepairBillSub>();
                     sMainStr = "[" + sMainStr + "]";
                     subLsit = JsonConvert.DeserializeObject<List<Model.ClsSc_SourceLineRepairBillSub>>(sMainStr);
 
                     oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub
-(HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
-,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate)
-values({model.HInterID},1,'{model.HBillNo}','',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}',''
-,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())");
+                    (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
+                    ,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate)
+                    values({model.HInterID},1,'{model.HBillNo}','{model.HRemark}',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}',''
+                    ,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())");
 
                     if (HResult == "OK")
                     {
@@ -3446,13 +3455,73 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_Sc_UnbindStation_BarList order by 鏉$爜鏃ユ湡 desc", "h_v_Sc_UnbindStation_BarList");
+                    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 杩囩珯瑙g粦鍒楄〃 鏌ヨ
+        [Route("Cj_SingleStation/ShippingExportList")]
+        [HttpGet]
+        public object ShippingExportList(string sWhere, string user, string gnsy)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (gnsy != "" && gnsy != null)
+                {
+                    //鏌ョ湅鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(gnsy, 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_Cj_SingleStation_ShippingExportList" +
+                        " order by 鏍堟澘鐮� desc,涓鐮�,SN鐮�", "h_v_Cj_SingleStation_ShippingExportList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Cj_SingleStation_ShippingExportList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鏍堟澘鐮� desc,涓鐮�,SN鐮�";
+                    ds = oCN.RunProcReturn(sql, "h_v_Cj_SingleStation_ShippingExportList");
                 }
 
                 //娣诲姞鍒楀悕
@@ -3717,6 +3786,122 @@
         }
         #endregion
 
+        #region 灏忓崼缁勬墭缂撳瓨 鏌ヨ
+        [Route("Cj_SingleStation/xiaoweizutuo_CacheList")]
+        [HttpGet]
+        public object xiaoweizutuo_CacheList(string sWhere, string user, string gnsy)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                if (gnsy != "" && gnsy != null)
+                {
+                    //鏌ョ湅鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(gnsy, 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_PackUnionBill_Temp" +
+                        " order by 鏍堟澘鐮� desc,涓鐮�,SN鐮�", "h_v_Sc_PackUnionBill_Temp");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Sc_PackUnionBill_Temp where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鏍堟澘鐮� desc,涓鐮�,SN鐮�";
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_PackUnionBill_Temp");
+                }
+
+                //娣诲姞鍒楀悕
+                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 灏忓崼缁勬墭缂撳瓨 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Cj_SingleStation/deleteBill")]
+        [HttpGet]
+        public object deleteBill(string HInterID, string user,string gnsy)
+        {
+            try
+            {
+                if (gnsy != "" && gnsy != null)
+                {
+                    //鏌ョ湅鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Sc_PackUnionBill_Temp where HInterID = " + HInterID);
+                
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                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