From b8d7145eadce706aef50ef95be75cff9ef79b518 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期五, 31 十月 2025 09:01:20 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/条码管理/WEBSController.cs | 1511 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 1,337 insertions(+), 174 deletions(-)

diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
index 9bcbd83..39c37af 100644
--- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
+++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
@@ -72,7 +72,7 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-                    else if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HBack"])==1)
+                    else if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HBack"]) == 1)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
@@ -111,6 +111,8 @@
         #endregion
 
         #region 鐢ㄦ埛妯″潡鏉冮檺鍒ゆ柇
+
+        #region 鐢ㄦ埛妯″潡鏉冮檺鍒ゆ柇    鍒ゆ柇閲戣澏璐﹀彿鏄惁姝g‘
 
         /// <summary>
         /// 杩涘叆妯″潡鏃惰繘琛岀敤鎴锋潈闄愬垽鏂�
@@ -184,6 +186,48 @@
                 return objJsonResult;
             }
         }
+
+        #endregion
+
+        #region 鐢ㄦ埛妯″潡鏉冮檺鍒ゆ柇
+
+        /// <summary>
+        /// 杩涘叆妯″潡鏃惰繘琛岀敤鎴锋潈闄愬垽鏂�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/CheckModRight_ERP_Json")]
+        [HttpGet]
+        public object CheckModRight_ERP_Json(string ModRightName, string HUserName)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightName, 3, false, HUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夊搴旀ā鍧楁潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                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
 
         #endregion
 
@@ -381,12 +425,50 @@
             {
                 Int64 HWhID = 0;
                 HWhID = DBUtility.ClsPub.isLong(HBarCode.Replace("HWH", ""));
-                ds = oCn.RunProcReturn("select HItemID,HNumber,HName,HSPFlag from Gy_Warehouse with(nolock) where HStopflag=0 and HItemID=" + HWhID.ToString() + " and HUSEORGID = " + HStockOrgID.ToString(), "Gy_Warehouse");
+                ds = oCn.RunProcReturn("exec h_p_Gy_Warehouse_PDA " + HWhID.ToString() + "," + HStockOrgID.ToString(), "h_p_Gy_Warehouse_PDA");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛岃纭鎵�鎵粨搴撴潯鐮佹槸鍚﹀睘浜庤缁勭粐锛屼笖涓洪潪绂佺敤鐘舵�侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "杩斿洖浠撳簱淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇PDA浠撳簱鍒楄〃淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/GetWarehouseList_Json")]
+        [HttpGet]
+        public object GetWarehouseList_Json(string Warehouse, Int64 HStockOrgID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_Gy_WarehouseList_PDA '" + Warehouse + "'," + HStockOrgID.ToString(), "h_p_Gy_WarehouseList_PDA");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍浠撳簱璁板綍锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -432,7 +514,7 @@
                     sHWhID = DBUtility.ClsPub.isLong(sArray[0]);
                 }
 
-                if(HWhID==0)
+                if (HWhID == 0)
                 {
                     ds = oCn.RunProcReturn("select HItemID,HNumber,HName,HWHID,HWhNumber,HWhName from h_v_IF_StockPlace where HStopflag=0 and HItemID=" + sHSPID.ToString() + " and HWHID=" + sHWhID.ToString() + " and HUSEORGID = " + HStockOrgID.ToString(), "h_v_IF_StockPlace");
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -636,6 +718,44 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛岃纭鎵�鎵儴闂ㄦ潯鐮佹槸鍚︽甯革紝涓斾负闈炵鐢ㄧ姸鎬侊紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "杩斿洖閮ㄩ棬淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇閮ㄩ棬鍒楄〃淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/GetDepartmentList_Json")]
+        [HttpGet]
+        public object GetDepartmentList_Json(string Department, Int64 HStockOrgID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("select HItemID,HNumber,HName from Gy_Department with(nolock) where HStopflag=0 and HUSEORGID=" + HStockOrgID.ToString() + " and (HNumber like '%" + Department + "%' or HName like '%" + Department + "%')", "Gy_Department");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍閮ㄩ棬璁板綍锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -952,13 +1072,13 @@
         /// <returns></returns>
         [Route("WEBSController/GetEquipList_Json")]
         [HttpGet]
-        public object GetEquipList_Json(string Equip,int HCenterID)
+        public object GetEquipList_Json(string Equip, int HCenterID)
         {
             try
             {
-                if (HCenterID !=0)
+                if (HCenterID != 0)
                 {
-                    ds = oCn.RunProcReturn("select HInterID,HEquipFileNumber,HName,HSourceID,HSourceName,HCenterID from h_v_Gy_EquipFileBill where HCenterID='"+HCenterID+"' and ( HEquipFileNumber like '%" + Equip + "%' or HName like '%" + Equip + "%')", "h_v_Gy_EquipFileBill");
+                    ds = oCn.RunProcReturn("select HInterID,HEquipFileNumber,HName,HSourceID,HSourceName,HCenterID from h_v_Gy_EquipFileBill where HCenterID='" + HCenterID + "' and ( HEquipFileNumber like '%" + Equip + "%' or HName like '%" + Equip + "%')", "h_v_Gy_EquipFileBill");
                 }
                 else
                 {
@@ -1453,28 +1573,107 @@
         {
             try
             {
-                if (oWebs.set_DelPonderationBillMain_Temp_FIFO(HInterID, HBillType, ref DBUtility.ClsPub.sErrInfo))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                //鏇存柊鍏堣繘鍏堝嚭涓存椂琛ㄧ姸鎬�
+                oCn.RunProc("EXEC h_p_WMS_UPDateICInventory_FIFO_Tmp " + HInterID.ToString() + ",'" + HBillType + "'");
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鏇存柊鍏堣繘鍏堝嚭涓存椂琛℉lineStatus鍊煎け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鍑哄簱鎵爜妯″潡锛岄��鍑烘椂鏇存柊鍏堣繘鍏堝嚭涓存椂琛ㄧ姸鎬� HlineStatus  20250722
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_DelPonderationBillMain_Temp_FIFO_New_Json")]
+        [HttpGet]
+        public object set_DelPonderationBillMain_Temp_FIFO_New_Json(long HInterID, string HBillType, Int64 HStockOrgID)
+        {
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg = "";
+            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
+            {
+                string sERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;   //搴撳瓨鎺у埗-WMS搴撳瓨鎺у埗ERP妯″紡	(WISE銆丆LOUD銆丮ES)
+                string sFIFOCtl = "N";          //鍏堣繘鍏堝嚭鎺у埗锛�'Y'涓烘帶鍒讹級
+
+                //鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                if (HBillType == "1204" && (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //閿�鍞嚭搴撳崟-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鍏朵粬鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1206" && (oSystemParameter.omodel.Kf_OtherOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_OtherOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //濮斿鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鍒嗘寮忚皟鍑哄崟-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鐢熶骇琛ユ枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1254" && (oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //濮斿琛ユ枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1255" && (oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+
+                try
+                {
+                    if (sFIFOCtl == "Y")
+                    {
+                        //鏇存柊鍏堣繘鍏堝嚭涓存椂琛ㄧ姸鎬�
+                        oCn.RunProc("EXEC h_p_WMS_UPDateICInventory_FIFO_Tmp " + HInterID.ToString() + ",'" + HBillType + "'");
+                    }
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                catch (Exception e)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏇存柊鍏堣繘鍏堝嚭涓存椂琛℉lineStatus鍊煎け璐ワ紒" + e.ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -1629,6 +1828,101 @@
 
         #endregion
 
+        #region 鏍峰搧閿�鍞嚭搴撶紦瀛樺垪琛ㄧ晫闈紝杩斿洖缂撳瓨鍒楄〃淇℃伅
+
+        /// <summary>
+        /// 缂撳瓨鍒楄〃鐣岄潰锛岃繑鍥炵紦瀛樺垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/GetKf_PonderationBillMain_TempList_New_Json_YPSellOut")]
+        [HttpGet]
+        public object GetKf_PonderationBillMain_TempList_New_Json_YPSellOut(string HBillType, string HMaker, Int64 HStockOrgID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_New_YPSellOut '" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_New_YPSellOut");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁缂撳瓨鍒楄〃淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇鍗曟嵁缂撳瓨鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鏍峰搧閿�鍞嚭搴撶紦瀛樺垪琛ㄧ晫闈紝杩斿洖宸蹭笂浼犲垪琛ㄤ俊鎭�
+        [Route("WEBSController/GetKf_ICStockBillList_Json_YPSellOut")]
+        [HttpGet]
+        public object GetKf_ICStockBillList_Json_YPSellOut(string HBillType, string HBillNo, string HSourceBillNo, string HMaker, Int64 HStockOrgID, string sWhere)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList_New_YPSellOut '" + HBillType + "','" + HBillNo + "','" + HSourceBillNo + "','" + HMaker + "'," + HStockOrgID.ToString() + ",'" + sWhere + "'", "h_p_Kf_ICStockBillQueryList_New_YPSellOut");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ涓嶅埌璇ュ崟鎹褰曪紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇鍗曟嵁淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇宸蹭笂浼犲崟鎹俊鎭け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
         #region 缂撳瓨鍒楄〃    缂栬緫鍔熻兘璋冪敤
 
@@ -1778,7 +2072,7 @@
         {
             try
             {
-                ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList_New '" + HBillType + "','" + HBillNo + "','" + HSourceBillNo + "','" + HMaker + "'," + HStockOrgID.ToString() + ",'" + sWhere+"'", "h_p_Kf_ICStockBillQueryList_New");
+                ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList_New '" + HBillType + "','" + HBillNo + "','" + HSourceBillNo + "','" + HMaker + "'," + HStockOrgID.ToString() + ",'" + sWhere + "'", "h_p_Kf_ICStockBillQueryList_New");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -1956,27 +2250,114 @@
         }
 
         /// <summary>
-        /// 鍒犻櫎缂撳瓨鍒楄〃鍗曟嵁
+        /// 鍒犻櫎缂撳瓨鍒楄〃鍗曟嵁锛屽垹闄ゆ椂鍒ゆ柇鍗曟嵁鏄惁寮傚父锛屽啓鍏ユ棩蹇�   20250722
         /// </summary>
         /// <returns></returns>
         [Route("WEBSController/set_DelPonderationBillMain_Temp_Json")]
         [HttpGet]
-        public object set_DelPonderationBillMain_Temp_Json(long HInterID, string HBillType)
+        public object set_DelPonderationBillMain_Temp_Json(long HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID, string MvarReportTitle)
         {
-            try
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg = "";
+            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
-                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鍒犻櫎鎴愬姛";
-                objJsonResult.data = null;
-                return objJsonResult;
+                string sERPMode = oSystemParameter.omodel.WMS_WMSStockCtl_ERPMode;   //搴撳瓨鎺у埗-WMS搴撳瓨鎺у埗ERP妯″紡	(WISE銆丆LOUD銆丮ES)
+                string sFIFOCtl = "N";          //鍏堣繘鍏堝嚭鎺у埗锛�'Y'涓烘帶鍒讹級
+
+                //鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                if (HBillType == "1204" && (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //閿�鍞嚭搴撳崟-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鍏朵粬鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1206" && (oSystemParameter.omodel.Kf_OtherOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_OtherOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //濮斿鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鍒嗘寮忚皟鍑哄崟-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //鐢熶骇琛ユ枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1254" && (oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_MateReplenishOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+                //濮斿琛ユ枡鍗�-鍏堣繘鍏堝嚭鎺у埗
+                else if (HBillType == "1255" && (oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOCtl.ToUpper() == "Y" || oSystemParameter.omodel.Kf_EntrustReplenishOutBill_FIFOList.ToUpper() == "Y"))
+                {
+                    sFIFOCtl = "Y";
+                }
+
+                try
+                {
+                    string WorkList = "鍒犻櫎缂撳瓨鍗曟嵁锛屽崟鎹彿锛�" + HBillNo;
+                    string SystemName = "WMS-" + MvarReportTitle + "妯″潡";
+                    oCn.BeginTran();
+                    ds = oCn.RunProcReturn("exec h_p_WMS_PonderationBillMain_Temp_Delete " + HInterID + ",'" + HBillNo + "','" + HBillType + "','" + sFIFOCtl + "','" + sERPMode + "'", "h_p_WMS_PonderationBillMain_Temp_Delete");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        oCn.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎缂撳瓨鍗曟嵁澶辫触锛屽垹闄ょ紦瀛樺崟鎹垽鏂敊璇紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        oCn.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;  //澶辫触锛�
+                        objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        //鍐欏叆鏃ュ織
+                        oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
+                            "(getdate(),'" + HMaker + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','','鍒犻櫎')"
+                            );
+                        oCn.Commit();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍗曟嵁鍙凤細" + HBillNo + " 鍒犻櫎鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                catch (Exception e)
+                {
+                    oCn.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎鏉$爜鍑哄叆搴撶紦瀛樺垪琛ㄥ崟鎹け璐ワ紒" + e.ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
             }
-            catch (Exception e)
+            else
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鍒犻櫎鏉$爜鍑哄叆搴撶紦瀛樺垪琛ㄥ崟鎹け璐ワ紒" + e.ToString();
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -2212,6 +2593,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1202";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveProductInBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -2353,6 +2735,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1201";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SavePOStockInBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -2512,7 +2895,7 @@
                 websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
                 websLsmain.HStockStyle = lsmain[0].HStockStyle;
                 websLsmain.HBillSubType = lsmain[0].HBillSubType;
-                if(lsmain[0].HMainSourceBillType== "1241")
+                if (lsmain[0].HMainSourceBillType == "1241")
                 {
                     websLsmain.HMainSourceBillType = "鍏ュ簱鐢宠鍗�";
                 }
@@ -2578,6 +2961,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1203";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveOtherInBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -2674,7 +3058,7 @@
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                 websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
 
-                if(sSourceType== "3710")
+                if (sSourceType == "3710")
                 {
                     sSourceType = "3720";
                 }
@@ -2732,6 +3116,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1204";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveMateOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -2849,6 +3234,105 @@
 
         #endregion
 
+        #region 閿�鍞嚭搴�    鏂板妯″紡锛堟牱鍝侀攢鍞嚭搴擄級
+
+        /// <summary>
+        /// 閿�鍞嚭搴撴柊澧炰笂浼�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_SaveSellOutBill_Json_YP")]
+        [HttpPost]
+        public object set_SaveSellOutBill_Json_YP([FromBody] JObject oMain)
+        {
+            var _value = oMain["oMain"].ToString();
+            string msg1 = _value.ToString();
+            try
+            {
+                List<Model.ClsKf_SellOutBillMain> lsmain = new List<Model.ClsKf_SellOutBillMain>();
+                ListModels oListModels = new ListModels();
+                lsmain = oListModels.getSellOutBillMainByJson(msg1);
+                WebS.ClsKf_SellOutBillMain websLsmain = new WebS.ClsKf_SellOutBillMain();
+                string sSourceType = lsmain[0].HMainSourceBillType;
+                websLsmain.HInterID = lsmain[0].HInterID;
+                websLsmain.HBillNo = lsmain[0].HBillNo;
+                websLsmain.HBillType = lsmain[0].HBillType;
+                websLsmain.HDate = lsmain[0].HDate;
+                websLsmain.HDeptID = lsmain[0].HDeptID;
+                websLsmain.HWHID = lsmain[0].HWHID;
+                websLsmain.HSCWHID = lsmain[0].HSCWHID;
+                websLsmain.HSupID = lsmain[0].HSupID;
+                websLsmain.HKeeperID = lsmain[0].HKeeperID;
+                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
+                websLsmain.HEmpID = lsmain[0].HEmpID;
+                websLsmain.HManagerID = lsmain[0].HManagerID;
+                websLsmain.HRemark = lsmain[0].HRemark;
+                websLsmain.HExplanation = lsmain[0].HExplanation;
+                websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
+                websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
+                websLsmain.HBillSubType = lsmain[0].HBillSubType;
+                if (lsmain[0].HMainSourceBillType == "1402")
+                {
+                    websLsmain.HMainSourceBillType = "鍙戣揣閫氱煡鍗�";
+                }
+                else if (lsmain[0].HMainSourceBillType == "1401")
+                {
+                    websLsmain.HMainSourceBillType = "閿�鍞鍗�";
+                }
+                else
+                {
+                    websLsmain.HMainSourceBillType = "鎵嬪伐褰曞叆";
+                }
+                websLsmain.HMaker = lsmain[0].HMaker;
+                websLsmain.HBillerID = lsmain[0].HBillerID;
+                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
+                websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
+
+                if (oWebs.set_SaveSellOutBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                {
+                    oCn.BeginTran();
+                    try
+                    {
+                        string sql_reWriteTaxData = "exec h_p_Kf_SellOutBill_withOutSourceBill_ReWriteTax " + lsmain[0].HInterID + "," + lsmain[0].HIsTaxRate + "," + lsmain[0].HIsTaxRate_upper;
+                        oCn.RunProc(sql_reWriteTaxData);
+                        oCn.Commit();
+                    }
+                    catch (Exception e3)
+                    {
+                        oCn.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "閿�鍞嚭搴撳崟涓婁紶鎴愬姛锛侊紒绋庣巼璁$畻澶辫触锛侊紒" + e3.ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                    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 閿�鍞嚭搴�    鏍¢獙妯″紡
 
         /// <summary>
@@ -2873,6 +3357,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1205";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveSellOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -2957,6 +3442,8 @@
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                 websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
 
+
+
                 if (oWebs.set_SaveEntrustOutBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
                 {
                     objJsonResult.code = "0";
@@ -3010,6 +3497,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1211";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveEntrustOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -3148,6 +3636,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1206";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveOtherOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -3285,6 +3774,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1254";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveMateReplenishOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -3344,6 +3834,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1255";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveEntrustReplenishOutBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -3389,13 +3880,144 @@
         [HttpPost]
         public object set_SaveMoveStockBill_Json([FromBody] JObject oMain)
         {
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg = "";
+            if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+            {
+                var _value = oMain["oMain"].ToString();
+                string msg1 = _value.ToString();
+                try
+                {
+                    List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>();
+                    ListModels oListModels = new ListModels();
+                    lsmain = oListModels.getMoveStockBillMainByJson(msg1);
+                    WebS.ClsKf_MoveStockBillMain websLsmain = new WebS.ClsKf_MoveStockBillMain();
+                    string sSourceType = lsmain[0].HMainSourceBillType;
+                    websLsmain.HInterID = lsmain[0].HInterID;
+                    websLsmain.HBillNo = lsmain[0].HBillNo;
+                    websLsmain.HBillType = lsmain[0].HBillType;
+                    websLsmain.HDate = lsmain[0].HDate;
+                    websLsmain.HDeptID = lsmain[0].HDeptID;
+                    websLsmain.HWHID = lsmain[0].HWHID;
+                    websLsmain.HSCWHID = lsmain[0].HSCWHID;
+                    if (oSystemParameter.omodel.WMS_CampanyName == "灏忓崼") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                        websLsmain.HSupID = lsmain[0].HCusID;
+                    }
+                    else
+                    {
+                        websLsmain.HSupID = lsmain[0].HSupID;
+                    }
+                    websLsmain.HKeeperID = lsmain[0].HKeeperID;
+                    websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
+                    websLsmain.HEmpID = lsmain[0].HEmpID;
+                    websLsmain.HManagerID = lsmain[0].HManagerID;
+                    websLsmain.HRemark = lsmain[0].HRemark;
+                    websLsmain.HExplanation = lsmain[0].HExplanation;
+                    websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
+                    websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
+                    websLsmain.HBillSubType = lsmain[0].HBillSubType;
+                    websLsmain.HStockStyle = lsmain[0].HStockStyle;
+                    websLsmain.HTransferDirect = lsmain[0].HTransferDirect;
+                    websLsmain.HShipType = lsmain[0].HShipType;
+                    if (lsmain[0].HMainSourceBillType == "1402")
+                    {
+                        websLsmain.HMainSourceBillType = "鍙戣揣閫氱煡鍗�";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "1243")
+                    {
+                        websLsmain.HMainSourceBillType = "璋冩嫧鐢宠鍗�";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "3720")
+                    {
+                        websLsmain.HMainSourceBillType = "鐢熶骇鐢ㄦ枡娓呭崟";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "1604")
+                    {
+                        websLsmain.HMainSourceBillType = "濮斿鐢ㄦ枡娓呭崟";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "1214")
+                    {
+                        websLsmain.HMainSourceBillType = "鐢熶骇鍙戞枡閫氱煡鍗�";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "3721")
+                    {
+                        websLsmain.HMainSourceBillType = "鐢熶骇澶囨枡鍗�";
+                    }
+                    else if (lsmain[0].HMainSourceBillType == "1242")
+                    {
+                        websLsmain.HMainSourceBillType = "鍑哄簱鐢宠鍗�";
+                    }
+                    else
+                    {
+                        websLsmain.HMainSourceBillType = "鎵嬪伐褰曞叆";
+                    }
+                    websLsmain.HMaker = lsmain[0].HMaker;
+                    websLsmain.HBillerID = lsmain[0].HBillerID;
+                    websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
+                    websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
+                    websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
+                    websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
+
+                    if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                catch (Exception e)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鐩存帴璋冩嫧鍗曚笂浼犲け璐ワ紒" + e.ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #region 鐩存帴璋冩嫧鍏嶆壂鐗╂枡鏉$爜    鏂板妯″紡
+
+        /// <summary>
+        /// 鐩存帴璋冩嫧鏂板涓婁紶
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_SaveMoveStockBill_AutoBarCode_Json")]
+        [HttpPost]
+        public object set_SaveMoveStockBill_AutoBarCode_Json([FromBody] JObject oMain)
+        {
             var _value = oMain["oMain"].ToString();
             string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
             try
             {
+                //涓昏〃璧嬪��
                 List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>();
                 ListModels oListModels = new ListModels();
-                lsmain = oListModels.getMoveStockBillMainByJson(msg1);
+                lsmain = oListModels.getMoveStockBillMainByJson(sMainStr);
                 WebS.ClsKf_MoveStockBillMain websLsmain = new WebS.ClsKf_MoveStockBillMain();
                 string sSourceType = lsmain[0].HMainSourceBillType;
                 websLsmain.HInterID = lsmain[0].HInterID;
@@ -3418,33 +4040,9 @@
                 websLsmain.HStockStyle = lsmain[0].HStockStyle;
                 websLsmain.HTransferDirect = lsmain[0].HTransferDirect;
                 websLsmain.HShipType = lsmain[0].HShipType;
-                if (lsmain[0].HMainSourceBillType == "1402")
-                {
-                    websLsmain.HMainSourceBillType = "鍙戣揣閫氱煡鍗�";
-                }
-                else if (lsmain[0].HMainSourceBillType == "1243")
-                {
-                    websLsmain.HMainSourceBillType = "璋冩嫧鐢宠鍗�";
-                }
-                else if (lsmain[0].HMainSourceBillType == "3720")
+                if (lsmain[0].HMainSourceBillType == "3720")
                 {
                     websLsmain.HMainSourceBillType = "鐢熶骇鐢ㄦ枡娓呭崟";
-                }
-                else if (lsmain[0].HMainSourceBillType == "1604")
-                {
-                    websLsmain.HMainSourceBillType = "濮斿鐢ㄦ枡娓呭崟";
-                }
-                else if (lsmain[0].HMainSourceBillType == "1214")
-                {
-                    websLsmain.HMainSourceBillType = "鐢熶骇鍙戞枡閫氱煡鍗�";
-                }
-                else if (lsmain[0].HMainSourceBillType == "3721")
-                {
-                    websLsmain.HMainSourceBillType = "鐢熶骇澶囨枡鍗�";
-                }
-                else if (lsmain[0].HMainSourceBillType == "1242")
-                {
-                    websLsmain.HMainSourceBillType = "鍑哄簱鐢宠鍗�";
                 }
                 else
                 {
@@ -3457,21 +4055,55 @@
                 websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
                 websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
 
-                if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                //瀛愯〃璧嬪��
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                List<Models.ClsKf_ICStockBillSub> sub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsKf_ICStockBillSub>>(sSubStr);
+
+                foreach (var item in sub)
+                {
+                    //鏁伴噺涓庢簮鍗曟暟閲忎笉涓�鑷存椂锛屾洿鏂版潯鐮佸嚭鍏ュ簱涓存椂琛� HQty 瀛楁鍊�
+                    if (item.HQty != item.HQtyMust)
+                    {
+                        oCn.RunProc("Update KF_PonderationBillMain_Temp set HQty2=" + item.HQty.ToString() + " where HInterID= " + websLsmain.HInterID.ToString() + " and HBillType='" + websLsmain.HBillType + "' and HSourceInterID= " + item.HSourceInterID.ToString() + " and HSourceEntryID= " + item.HSourceEntryID.ToString());
+                    }
+                }
+
+                ds = oCn.RunProcReturn("exec h_p_WMS_AutoBarCode_MoveStockBill " + websLsmain.HInterID.ToString() + ",'" + websLsmain.HBillType + "'," + websLsmain.HWHID.ToString() + ",0," + websLsmain.HSCWHID.ToString() + ",0", "h_p_WMS_AutoBarCode_MoveStockBill");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍏嶆壂鐮佸垽鏂彂鐢熼敊璇紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
             }
             catch (Exception e)
@@ -3510,6 +4142,7 @@
                 websLsmain.HInterID = lsmain[0].HInterID;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HBillType = "1207";
+                websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
 
                 if (oWebs.set_SaveMoveStockBill_BillCheck(websLsmain, ref DBUtility.ClsPub.sErrInfo))
@@ -3804,6 +4437,10 @@
                 {
                     websLsmain.HMainSourceBillType = "閫�鏂欓�氱煡鍗�";
                 }
+                else if (lsmain[0].HMainSourceBillType == "1201")
+                {
+                    websLsmain.HMainSourceBillType = "閲囪喘鍏ュ簱鍗�";
+                }
                 else
                 {
                     websLsmain.HMainSourceBillType = "鎵嬪伐褰曞叆";
@@ -3885,6 +4522,10 @@
                 if (lsmain[0].HMainSourceBillType == "3720")
                 {
                     websLsmain.HMainSourceBillType = "鐢熶骇鐢ㄦ枡娓呭崟";
+                }
+                else if (lsmain[0].HMainSourceBillType == "1204")
+                {
+                    websLsmain.HMainSourceBillType = "鐢熶骇棰嗘枡鍗�";
                 }
                 else
                 {
@@ -4409,7 +5050,7 @@
         /// 灏忚溅閿佸畾鍗曟柊澧炰笂浼�
         /// </summary>
         /// <returns></returns>
-        [Route("WEBSController/set_SaveTrolleyPositionBill_Json2")]
+        [Route("WEBSController/set_SaveTrolleyPositionBill_Json")]
         [HttpPost]
         public object set_SaveTrolleyPositionBill_Json([FromBody] JObject msg)
         {
@@ -4431,7 +5072,7 @@
                 lsmain = oListModels.getObjectByJson_Kf_TrolleyPositionBillMain(msg2);
 
                 foreach (Model.ClsKf_TrolleyPositionBillMain oItem in lsmain)
-                {                                      
+                {
                     DBUtility.ClsPub.CurUserName = oItem.HMaker;
                     oItem.HBillType = "10004";
                     oItem.HBillSubType = "10004";
@@ -4473,7 +5114,7 @@
                 bool bResult;
                 if (OperationType == "1")
                 {
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);                   
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
                 {
@@ -4742,7 +5383,7 @@
             {
                 if (oSystemParameter.omodel.WMS_CloudMode.ToUpper() == "N") //绯荤粺鍙傛暟鏄惁涓虹鏈変簯妯″紡,N涓哄叕鏈変簯妯″紡锛孻涓虹鏈変簯妯″紡
                 {
-                    if(HSourceBillType == "1214")
+                    if (HSourceBillType == "1214")
                     {
                         //閲嶆柊鍚屾鐢熶骇鍙戞枡閫氱煡鍗�
                         Kf_MateOutRequestBillController obill = new Kf_MateOutRequestBillController();
@@ -4987,6 +5628,52 @@
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鎴愬姛";
                     objJsonResult.data = WebSoBar;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵弿婧愬崟鏉$爜澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鐩存帴璋冩嫧鍏嶆壂鐗╂枡鏉$爜妯″潡    鎵弿婧愬崟鏉$爜  20250818
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/get_SourceBarCode_MoveStock_AutoBarCode_Json")]
+        [HttpGet]
+        public object get_SourceBarCode_MoveStock_AutoBarCode_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HOWNERID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_MoveStock_AutoBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_MoveStock_AutoBarCode");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵弿婧愬崟鏉$爜鍙戠敓閿欒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
             }
@@ -5273,7 +5960,7 @@
                     sJXCode = POStockInBillController.JX_Json(sBarCode, HInterID, HBillType, HStockOrgID, HBillNo, HMaker);
                     SourceFlag = true;
                 }
-                else if(oSystemParameter.omodel.WMS_CampanyName == "妫シ" && HSourceBillType == "1241")
+                else if (oSystemParameter.omodel.WMS_CampanyName == "妫シ" && HSourceBillType == "1241")
                 {
                     //鑷姩鍖呰绾垮悓姝ラ噾铦剁敓浜у叆搴撶敵璇峰崟
                     sJXCode = Kf_OtherInBill_SK(sBarCode, HCustom1);
@@ -5328,7 +6015,7 @@
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-         }
+        }
 
         #endregion
 
@@ -5408,7 +6095,7 @@
             {
                 if (oSystemParameter.omodel.WMS_CampanyName == "瀹夌憺") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                 {
-                     sJXCode = POStockInBillController.JX_Json(sBarCode, HInterID, HBillType, HStockOutOrgID, HBillNo, HMaker);
+                    sJXCode = POStockInBillController.JX_Json(sBarCode, HInterID, HBillType, HStockOutOrgID, HBillNo, HMaker);
                     SourceFlag = true;
                 }
                 else
@@ -5913,6 +6600,7 @@
             string sJXCode = "";
             if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
+                string sAutoBarCode = "N";        //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
                 string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
 
                 #region 绯荤粺鍙傛暟鑾峰彇
@@ -5920,90 +6608,140 @@
                 if (HBillType == "1201")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //鐢熶骇鍏ュ簱鍗�
-                if (HBillType == "1202")
+                else if (HBillType == "1202")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
+                    }
                 }
                 //鍏朵粬鍏ュ簱鍗�
-                if (HBillType == "1203")
+                else if (HBillType == "1203")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //棰嗘枡鍑哄簱鍗�
                 else if (HBillType == "1204")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //閿�鍞嚭搴撳崟
                 else if (HBillType == "1205")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //鍏朵粬鍑哄簱鍗�
                 else if (HBillType == "1206")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //濮斿棰嗘枡鍗�
                 else if (HBillType == "1211")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //鐢熶骇琛ユ枡鍗�
                 else if (HBillType == "1254")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //濮斿琛ユ枡鍗�
                 else if (HBillType == "1255")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 //鐩存帴璋冩嫧鍗�
                 else if (HBillType == "1207")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
+                    }
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_AutoBarCode.ToUpper() == "Y")
+                    {
+                        sAutoBarCode = "Y";
                     }
                 }
                 #endregion
@@ -6018,8 +6756,17 @@
                 }
                 try
                 {
+                    //鍏嶆壂鐗╂枡鏉$爜妯″紡锛�'Y'涓轰笉鎵墿鏂欐潯鐮侊級
+                    if (sAutoBarCode == "Y")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏嶆壂鐗╂枡鏉$爜妯″紡锛屾棤闇�鎵弿鐗╂枡鏉$爜锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                     //鍘熷崟鎹负鎵爜鐢熸垚锛屾牎楠屾椂涓嶇敓鎴愭潯鐮佽褰曪紝鍙鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
-                    if (sSourceBarCodeCtl == "Y")
+                    else if (sSourceBarCodeCtl == "Y")
                     {
                         WebSoBar = oWebs.get_BillBarCode_Verify(HBillID, HBillNo, HBillType, sJXCode, HQty, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                         if (WebSoBar == null)
@@ -6068,8 +6815,8 @@
                     objJsonResult.Message = "鏍¢獙妯″紡锛屾壂鎻忔潯鐮佸け璐ワ紒" + e.ToString();
                     objJsonResult.data = null;
                     return objJsonResult;
-                    }
                 }
+            }
             else
             {
                 objJsonResult.code = "0";
@@ -6254,10 +7001,10 @@
         {
             //鑾峰彇绯荤粺鍙傛暟
             string sErrMsg = "";
-            if (oSystemParameter.ShowBillByOrgID(HStockOrgID,ref sErrMsg) == true)
+            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
                 string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                 {
                     //閿�鍞嚭搴撳崟
                     sSourceBarCodeCtl = "Y";
@@ -6380,25 +7127,25 @@
                 if (HBillType == "1201")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
                 }
                 //鐢熶骇鍏ュ簱鍗�
-                if (HBillType == "1202")
+                else if (HBillType == "1202")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
                 }
                 //鍏朵粬鍏ュ簱鍗�
-                if (HBillType == "1203")
+                else if (HBillType == "1203")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6407,7 +7154,7 @@
                 else if (HBillType == "1204")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6416,7 +7163,7 @@
                 else if (HBillType == "1205")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6425,7 +7172,7 @@
                 else if (HBillType == "1206")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6434,7 +7181,7 @@
                 else if (HBillType == "1211")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6443,7 +7190,7 @@
                 else if (HBillType == "1254")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6452,7 +7199,7 @@
                 else if (HBillType == "1255")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6461,7 +7208,7 @@
                 else if (HBillType == "1207")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6552,7 +7299,7 @@
             if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
                 string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                 {
                     //閿�鍞嚭搴撳崟
                     sSourceBarCodeCtl = "Y";
@@ -6688,25 +7435,25 @@
                 if (HBillType == "1201")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_POStockInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
                 }
                 //鐢熶骇鍏ュ簱鍗�
-                if (HBillType == "1202")
+                else if (HBillType == "1202")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_ProductInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
                 }
                 //鍏朵粬鍏ュ簱鍗�
-                if (HBillType == "1203")
+                else if (HBillType == "1203")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherInBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6715,7 +7462,7 @@
                 else if (HBillType == "1204")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6724,7 +7471,7 @@
                 else if (HBillType == "1205")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6733,7 +7480,7 @@
                 else if (HBillType == "1206")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_OtherOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6742,7 +7489,7 @@
                 else if (HBillType == "1211")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6751,7 +7498,7 @@
                 else if (HBillType == "1254")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MateReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6760,7 +7507,7 @@
                 else if (HBillType == "1255")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_EntrustReplenishOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6769,7 +7516,7 @@
                 else if (HBillType == "1207")
                 {
                     //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl == "Y")
+                    if (oSystemParameter.omodel.Kf_MoveStockBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                     {
                         sSourceBarCodeCtl = "Y";
                     }
@@ -6849,7 +7596,7 @@
             if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
                 string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
-                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+                if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl.ToUpper() == "Y")
                 {
                     //閿�鍞嚭搴撳崟
                     sSourceBarCodeCtl = "Y";
@@ -6897,15 +7644,64 @@
                 }
             }
             else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #region 鏍¢獙妯″潡    杩斿洖婧愬崟鍒楄〃淇℃伅
+        /// <summary>
+        /// 婧愬崟鍒楄〃淇℃伅锛屾牴鎹崟鎹被鍨嬨�佺粍缁嘔D杩斿洖婧愬崟鍒楄〃淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/GetCheckBillList_Json")]
+        [HttpGet]
+        public object GetCheckBillList_Json(string HBillType, Int64 HStockOrgID, string HBillNo, string HMater, string HCustom)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_WMS_GetCheckBillList '" + HBillType  + "'," + HStockOrgID.ToString() + ",'" + HBillNo + "','" + HMater + "','" + HCustom + "'", "h_p_WMS_GetCheckBillList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍婧愬崟淇℃伅锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇婧愬崟鍗曟嵁淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
             }
-
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇婧愬崟鍗曟嵁淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #endregion
 
         #endregion
@@ -6925,13 +7721,20 @@
         {
             try
             {
-                WebS.ClsGy_BarCodeBill_WMS_Model WebSoBarModel = new WebS.ClsGy_BarCodeBill_WMS_Model();
-                WebSoBarModel = oWebs.get_PackBarCode_PackUnionBill(HInterID, HBillNo, HBillType, HBarCode_Pack, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
-                if (WebSoBarModel == null)
+                ds = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_PackUnionBill " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode_Pack + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddPackBarCode_PackUnionBill");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
+                    objJsonResult.Message = "鎵弿鎵樻潯鐮佸彂鐢熼敊璇紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -6939,8 +7742,8 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "鎴愬姛";
-                    objJsonResult.data = WebSoBarModel;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
             }
@@ -7061,7 +7864,7 @@
             string sErrMsg = "";
             if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
             {
-                string sMaterialCtl = "Y";          //缁勬墭鏃舵墭鏉$爜瀵瑰簲鐗╂枡涓庨渶瑕佺粍鎵樼殑鏉$爜瀵瑰簲鐗╂枡瑕佷竴鑷达紙Y涓洪渶涓�鑷达級
+                string sMaterialCtl = "Y";          //缁勬墭鐗╂枡鏄惁涓�鑷存帶鍒讹紙Y涓烘帶鍒讹級
                 string sSourceBillTypeCtl = "Y";    //鏈叆搴撴潯鐮佽繘琛岀粍鎵樻椂锛岃繘琛屽悓婧愬崟绫诲瀷鎺у埗锛圷涓烘帶鍒讹級
                 string sSourceBillNoCtl = "Y";      //鏈叆搴撴潯鐮佽繘琛岀粍鎵樻椂锛岃繘琛屽悓婧愬崟鎺у埗锛圷涓烘帶鍒讹級
                 sMaterialCtl = oSystemParameter.omodel.Sc_PackUnionBill_MaterialCtl.ToUpper();
@@ -7518,28 +8321,18 @@
         {
             try
             {
-                string WorkList = "鍗曟嵁鍙凤細"+@HBillNo+ "锛屽搴旂锛堟墭锛夋潯鐮侊細" + @HBarCode_Pack+ "锛屾媶绠憋紙鎷嗘墭锛夋垚鍔燂紒";
-                string SystemName = "WMS-鎷嗙锛堟媶鎵橈級妯″潡";
-                oCn.BeginTran();
-                //鍒犻櫎缁勬墭鍗曡褰�
-                oCn.RunProc("Delete from Sc_PackUnionBillMain where HInterID=" + HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
-                oCn.RunProc("Delete from Sc_PackUnionBillSub where HInterID=" + HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
-                //鍥炲~鏉$爜妗f鎵樻潯鐮佹暟閲�
-                oCn.RunProc("Update Gy_BarCodeBill Set HQty=0 where HBarCodeType='鎵樼洏鏉$爜' and HBarCode='" + HBarCode_Pack+"'", ref DBUtility.ClsPub.sExeReturnInfo);
-                //鍐欏叆鏃ュ織
-                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
-                    "(getdate(),'" + HMaker + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','','鎷嗙锛堟媶鎵橈級')"
-                    );
-                oCn.Commit();
+                string HIPAddress = "";                         //IP
+                string HModCaption = "WMS-鎷嗙锛堟媶鎵橈級妯″潡";    //妯″潡鍚�
+                ds = oCn.RunProcReturn("exec h_p_Sc_PackUnionBill_Delete_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBarCode_Pack + "','" + HMaker + "','" + ComputerName + "','" + HIPAddress + "','" + HModCaption + "'", "h_p_Sc_PackUnionBill_Delete_New");
+
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;
-                objJsonResult.Message = "鏉$爜锛�" + HBarCode_Pack + " 鎷嗙锛堟媶鎵橈級鎴愬姛";
+                objJsonResult.Message = "鎴愬姛";
                 objJsonResult.data = null;
                 return objJsonResult;
             }
             catch (Exception e)
             {
-                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鎷嗙锛堟媶鎵橈級澶辫触锛�" + e.ToString();
@@ -8102,7 +8895,8 @@
             try
             {
                 ds = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarcode='" + HBarCode + "'", "Gy_BarCodeBill");
-                if (ds.Tables[0].Rows.Count == 0) {
+                if (ds.Tables[0].Rows.Count == 0)
+                {
                     DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
                     string sErrMsg = "";
                     oSystemParameter.ShowBill(ref sErrMsg);
@@ -8796,7 +9590,7 @@
         #endregion
 
 
-        #region 涓婃灦銆佷笅鏋跺崟妯″潡璋冪敤鏂规硶     20250520
+        #region 涓婃灦銆佷笅鏋跺崟銆佸皬杞﹂攣瀹氭ā鍧楄皟鐢ㄦ柟娉�     20250520
 
         #region 涓嬫灦鍗曟壂鐮佹ā鍧�  鎵弿婧愬崟鏉$爜璋冪敤鏂规硶
         /// <summary>
@@ -8897,7 +9691,7 @@
 
                 try
                 {
-                    ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_WorkShop " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString() + ",'" + HSourceBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HCarBarCode + "'," + HStockOrgID.ToString() + ",'" + HMaker + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + sBatchNoCtl + "','" + sMustQtyCtl + "'", "h_p_WMS_AddBarCode_WorkShop");
+                    ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_WorkShop_TestByLLJ " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString() + ",'" + HSourceBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HCarBarCode + "'," + HStockOrgID.ToString() + ",'" + HMaker + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + sBatchNoCtl + "','" + sMustQtyCtl + "'", "h_p_WMS_AddBarCode_WorkShop");
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -8933,14 +9727,14 @@
                 }
             }
             else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                objJsonResult.data = null;
+                return objJsonResult;
             }
+        }
 
         #endregion
 
@@ -8993,6 +9787,147 @@
         }
         #endregion
 
+        #region 涓嬫灦鍗曟ā鍧楋紝鎵簮鍗曟潯鐮佹煡璇㈢墿鏂欏簱瀛樹俊鎭�
+
+        /// <summary>
+        /// 鑾峰彇鍗曟嵁鍒楄〃淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/MaterialLowerBill_MaterInv")]
+        [HttpGet]
+        public object MaterialLowerBill_MaterInv(long HInterID, string HBillNo, string HBillType, Int64 HStockOrgID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_Kf_MaterialInventory " + HInterID + "," + HBillType + "," + HStockOrgID, "h_p_Kf_MaterialInventory");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #region 灏忚溅鎵爜缁戝畾鏃讹紝鍒ゆ柇鍏舵槸鍚﹀凡缁戝畾搴撲綅淇℃伅
+        [Route("WEBSController/CarIsused")]
+        [HttpGet]
+        public object CarIsused(string HCarBarCode)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("select * from h_v_Gy_MouldIsUsed where 灏忚溅鏉$爜='" + HCarBarCode + "'", "h_v_Gy_MouldIsUsed");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "灏忚溅鏉$爜锛�" + HCarBarCode + "锛屼笉鍦ㄧ郴缁熶腑锛岃鏍稿锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ灏忚溅鍦ㄥ簱鐘舵�佸け璐rr锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 灏忚溅缁戝畾鏈哄彴鏃讹紝鍒ゆ柇鎵�鎵満鍙帮紙璁惧锛夋潯鐮佹槸鍚﹀瓨鍦ㄤ簬璁惧妗f
+        [Route("WEBSController/IsExistEquip")]
+        [HttpGet]
+        public object IsExistEquip(string HEquipBarCode)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("select * from h_v_Gy_EquipIsExist where 鏈哄彴鏉$爜='" + HEquipBarCode + "'", "h_v_Gy_EquipIsExist");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈哄彴鏉$爜锛�" + HEquipBarCode + "锛屼笉鍦ㄧ郴缁熶腑锛岃鏍稿锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏈哄彴淇℃伅澶辫触err锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #endregion
 
 
@@ -9004,11 +9939,12 @@
         /// <returns></returns>
         [Route("WEBSController/GetGy_BarCodeBill_QiaoYi_PDA_Json")]
         [HttpGet]
-        public object GetGy_BarCodeBill_QiaoYi_PDA_Json(string sWhere)
+        public object GetGy_BarCodeBill_QiaoYi_PDA_Json(string sBarCode)
         {
             try
             {
-                ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBillList_QiaoYi '" + sWhere+ "'", "h_p_Gy_BarCodeBillList_QiaoYi");
+                ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBillList_QiaoYi '" + sBarCode + "'", "h_p_Gy_BarCodeBillList_QiaoYi");
+                //ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBillList_QiaoYi2 '" + sBarCode + "','" + sBarCodeOutDate + "','" + sCustomerName + "','" + sSellOutBillNo + "'", "h_p_Gy_BarCodeBillList_QiaoYi2");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -9196,6 +10132,70 @@
         }
         #endregion
 
+        #region [鏍规嵁鍗曟嵁鍙� 鐗╂枡缂栫爜 鐗╂枡鍚嶇О 鐢熶骇璁㈠崟 宸ュ簭 閮ㄩ棬鑾峰彇 宸ュ簭娴佽浆鍗
+        /// <summary>
+        /// 鑾峰彇鏉$爜淇℃伅 娣诲姞宸ュ簭 閮ㄩ棬鏌ヨ鏉′欢
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/GetMES_ProcessExchangeBillList_APP_HaiCheng")]
+        [HttpGet]
+        public object GetMES_ProcessExchangeBillList_APP_HaiCheng(string HBillNo, string HNumber, string HName, string HICMOBillNo, string user, string HProcID, string HDeptID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_MES_ProcessExchangeBillList_APP_HaiCheng " +
+                    "@HBillNo = N'" + HBillNo + "', " +
+                    "@HNumber = N'" + HNumber + "', " +
+                    "@HName = N'" + HName + "', " +
+                    "@HICMOBillNo = N'" + HICMOBillNo + "'," +
+                    "@HProcID = N'" + HProcID + "', " +
+                    "@HDeptID = N'" + HDeptID + "'"
+                    , "h_p_MES_ProcessExchangeBillList_PDA_QiaoYi");
+                if ((bool)ds.Tables[1].Rows[0]["returntype"] == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = ds.Tables[1].Rows[0]["mesg"].ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "褰撳墠鎵�杈撳叆杩囨护鏉′欢锛屾病鏈夎繑鍥炰换浣曠粨鏋滐紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    List<object> columnNameList = new List<object>();
+                    //娣诲姞鍒楀悕
+                    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 = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 瀛愯〃鏄庣粏璋冪敤鏂规硶
         /// <summary>
         /// 鏌ョ湅鏄庣粏
@@ -9207,7 +10207,7 @@
         {
             try
             {
-                ds = oCn.RunProcReturn("exec h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi '" + HInterID+ "'", "h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi");
+                ds = oCn.RunProcReturn("exec h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi '" + HInterID + "'", "h_p_MES_ProcessExchangeSubBillList_PDA_QiaoYi");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -9329,7 +10329,7 @@
                         string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                         columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                     }
-                   if (HDATA=="HSPE")
+                    if (HDATA == "HSPE")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -9338,7 +10338,7 @@
                         objJsonResult.list = columnNameList;
                         return objJsonResult;
                     }
-                   else if (HDATA == "HICM")
+                    else if (HDATA == "HICM")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -9347,7 +10347,7 @@
                         objJsonResult.list = columnNameList;
                         return objJsonResult;
                     }
-                   else 
+                    else
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -9844,13 +10844,13 @@
                     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;                
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -9870,7 +10870,7 @@
         /// <returns></returns>
         [Route("WEBSController/UpdateKf_ICInvBal")]
         [HttpGet]
-        public object UpdateKf_ICInvBal( )
+        public object UpdateKf_ICInvBal()
         {
             try
             {
@@ -9906,7 +10906,7 @@
             try
             {
                 ds = oCn.RunProcReturn("exec h_p_Kf_SellOutBarTraceReport '" + HBeginDate.ToShortDateString() + "','" + HEndDate.ToShortDateString() + "','" + HBarCode + "'," + HStockOrgID.ToString() + ",'" + HWhere + "'", "h_p_Kf_SellOutBarTraceReport");
-                
+
                 List<object> columnNameList = new List<object>();
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
@@ -10084,7 +11084,7 @@
                     "and HMaker = '" + HMaker + "' " +
                     "and HOrgID = " + HStockOrgID;
                 DataSet ds = oCn.RunProcReturn(sql, "Gy_getCusBarCodeBillMain");
-                if(ds!=null && ds.Tables[0].Rows.Count > 0)
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -10135,7 +11135,7 @@
         /// <returns></returns>
         [Route("WEBSController/Gy_getCusBarCodeBill_rushBarCode")]
         [HttpGet]
-        public object Gy_getCusBarCodeBill_rushBarCode(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, string HMaker, Int64 HStockOrgID,string HBarCode_Pre)
+        public object Gy_getCusBarCodeBill_rushBarCode(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, string HMaker, Int64 HStockOrgID, string HBarCode_Pre)
         {
             DataSet ds;
             try
@@ -10322,7 +11322,7 @@
         [HttpGet]
         public object Gy_getCusBarCodeBill_submitRushedBarCodeList(Int64 HInterID, string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
         {
-            
+
             DataSet ds;
             try
             {
@@ -10501,7 +11501,7 @@
                     return objJsonResult;
                 }
                 //=============================================================================================================================================
-                
+
                 //寮�鍚簨鍔�
                 oCn.BeginTran();
 
@@ -10851,7 +11851,7 @@
             {
                 string sql = "exec h_p_Gy_BarCodeConfirmBill_rushBarCode " + HInterID + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID + ",'" + HBarCode + "'";
                 ds = oCn.RunProcReturn(sql, "h_p_Gy_BarCodeConfirmBill_rushBarCode");
-                if(ds==null || ds.Tables[0].Rows.Count == 0)
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -11328,7 +12328,7 @@
 
 
         #region 妫シ鍏朵粬鍏ュ簱鎵爜
-        public string Kf_OtherInBill_SK(string sBarCode,string HCustom1)
+        public string Kf_OtherInBill_SK(string sBarCode, string HCustom1)
         {
             string HReturnResult;
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -11381,7 +12381,8 @@
                                 //鐢熶骇杩斾慨鐢宠
                                 model.Add("FBillTypeID", new JObject() { ["FNumber"] = "SCRKSQ004" }); //鍗曟嵁绫诲瀷
                             }
-                            else {
+                            else
+                            {
                                 //鏍囧噯鐢熶骇鍏ュ簱鐢宠鍗�
                                 model.Add("FBillTypeID", new JObject() { ["FNumber"] = "SCRUSQD" }); //鍗曟嵁绫诲瀷
                             }
@@ -11534,7 +12535,7 @@
                                 string sJXCode = "";
                                 if (oSystemParameter.ShowBill(ref sErrMsg) == true)
                                 {
-                                    if (oSystemParameter.omodel.Kf_StockInRequestBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                                    if (oSystemParameter.omodel.Kf_StockInRequestBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
                                     {
                                         result1 = InvokeHelper.Submit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//鎻愪氦
                                         result2 = InvokeHelper.Audit("k18d2ab4f14034c569576ec8e0835a80c", JsonConvert.SerializeObject(json));//瀹℃牳
@@ -11551,7 +12552,7 @@
                                             return "鍙戠敓寮傚父锛屽叆搴撶敵璇峰崟鍗曞彿:" + ",瀹℃牳澶辫触" + result2;
                                         }
                                     }
-                                }                               
+                                }
                             }
                         }
 
@@ -11569,7 +12570,7 @@
                         //鑾峰彇鍏ュ簱鐢宠鍗曞崟鎹彿
                         string HBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FBILLNO"]);
                         //鍖呰绾跨敓鎴愮殑鐢熶骇鍏ュ簱鐢宠鍗曞弬涓庤嚜鍔ㄥ鏍�
-                        if (HBillNo.Substring(0,2) == "RK" )
+                        if (HBillNo.Substring(0, 2) == "RK")
                         {
                             //鑾峰彇鍏ュ簱鐢宠鍗曞崟鎹姸鎬�
                             string HBillStatus = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["FDOCUMENTSTATUS"]);
@@ -11636,7 +12637,7 @@
                             //鎵ц鏇存柊璇彞
                             oCn.RunProc(sql);
                         }
-                                                                                                                                                                    
+
                     }
                 }
 
@@ -11650,5 +12651,167 @@
             return HReturnResult;
         }
         #endregion
+
+
+        #region 缁戝畾灏忚溅浠撳簱浠撲綅
+        /// <summary>
+        /// 缁戝畾灏忚溅浠撳簱浠撲綅
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/BindCarAndWH")]
+        [HttpGet]
+        public object BindCarAndWH( string HMaker, Int64 HWhID, Int64 HSPID, string HCarBarCode, Int64 HStockOrgID)
+        {
+            try
+            {
+                ds = oCn.RunProcReturn("exec h_p_bindingCarintoWh "  + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HCarBarCode + "','" + HMaker+ "'," + HStockOrgID.ToString(), "h_p_bindingCarintoWh");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵弿鐗╂枡鏉$爜锛屽啓鍏ヤ复鏃惰〃澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵弿鐗╂枡鏉$爜澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+
+
+        }
+        #endregion
+
+        //杞Щ妯″潡
+        [Route("WEBSController/CheckHW")]
+        [HttpGet]
+        public object CheckHW(int  HWhID,int HSPID,int HWhID2,int HSPID2,string HBarCode,string HCarBarCode1,string HCarBarCode2,string UserID)
+        {
+            try
+            {
+                if (HCarBarCode1 == null) HCarBarCode1 = "";
+                if (HCarBarCode2 == null) HCarBarCode2 = "";
+                string sql = $"exec Transfer_Operation {HWhID},{HSPID},{HWhID2},{HSPID2},'{HBarCode}','{HCarBarCode1}','{HCarBarCode2}','{UserID}'";
+                ds = oCn.RunProcReturn(sql, "Transfer_Operation");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵弿鐗╂枡鏉$爜锛屽啓鍏ヤ复鏃惰〃澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵弿鐗╂枡鏉$爜澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+       #region 鎯犲悍 鐢熶骇棰嗘枡鍗曟牎楠� 鎵弿婧愬崟 鑾峰彇鐢熶骇棰嗘枡鍗曞拰涓嬫父棰嗘枡鍗曟湭瀹℃牳 鍗曟嵁
+        [Route("WEBSController/get_BillBarCode_BillCheck_Json_MateOut_HuiKang")]
+        [HttpGet]
+        public Object get_BillBarCode_BillCheck_Json_MateOut_HuiKang(string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
+        {
+           
+            try
+            {
+                WebSoBar = null;
+                // 1. 鏌ヨ閲戣澏浜戜腑 鎵�鏈夌鍚堢殑鐢熶骇棰嗘枡鍗曞拰涓嬫父棰嗘枡鍗�
+                ds = oCn.RunProcReturn($@"
+                    select HBillNo, HChecker,HMaker from h_v_Kf_MateOutBillList_K3 where HBillNo like '%{HBillNo}%'
+                ", "h_v_Kf_MateOutBillList_K3");
+
+                List<string> HBillNoList = new List<string>();
+                foreach (DataRow row in ds.Tables[0].Rows)
+                {
+                    if (string.IsNullOrWhiteSpace(row["HChecker"].ToString())){
+                        // 2. 鍒ゆ柇鍗曟嵁瀹℃牳鐘舵�侊紝鏌ユ壘鏈瀹℃牳鐨勫崟鎹�
+                        WebSoBar = oWebs.get_BillBarCode_BillCheck(row["HBillNo"].ToString(), HBillType, row["HMaker"].ToString(), HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
+
+                        if (WebSoBar != null)
+                        {
+                            // 3. 鑾峰彇鍒扮鍚堟潯浠剁殑杩斿洖鍊硷紝绔嬪嵆杩斿洖
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鎴愬姛";
+                            objJsonResult.data = WebSoBar;
+                            return objJsonResult;
+                        }
+                    }
+                }
+
+
+                // 3. 鎵�鏈夊崟鎹兘琚鏍革紝鎴栬�呮病鏈夌鍚堣姹傜殑鍗曟嵁锛岃繑鍥為敊璇俊鎭�
+                if (WebSoBar == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛";
+                    objJsonResult.data = WebSoBar;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵弿鍗曟嵁鏉$爜澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.9.1