From 6e4713d36e144f8c6e67ed780e20004734818f84 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 19 八月 2025 13:55:18 +0800
Subject: [PATCH] 新增工序汇报单同步至金蝶云调用方法;新增直接调拨免扫码模块,扫描源单、上传生成单据调用方法

---
 WebAPI/Controllers/条码管理/WEBSController.cs |  363 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 363 insertions(+), 0 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 0b74922..b551237 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"
@@ -658,6 +658,44 @@
             }
         }
 
+        /// <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;
+                }
+                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
 
         #region 渚涘簲鍟嗚祫鏂�
@@ -1708,6 +1746,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 缂撳瓨鍒楄〃    缂栬緫鍔熻兘璋冪敤
 
@@ -3753,6 +3886,127 @@
 
         #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(sMainStr);
+                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;
+                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 == "3720")
+                {
+                    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;
+
+                //瀛愯〃璧嬪��
+                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 HQty=" + 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 = 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
+                {
+                    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;
+            }
+        }
+
+        #endregion
+
         #region 鐩存帴璋冩嫧    鏍¢獙妯″紡
 
         /// <summary>
@@ -5254,6 +5508,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;
                 }
             }
@@ -9654,6 +9954,69 @@
         }
         #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>
         /// 鏌ョ湅鏄庣粏

--
Gitblit v1.9.1