From 43cb643cab5795943c1b2ff380e1be27e4756e1c Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期一, 27 六月 2022 16:48:45 +0800
Subject: [PATCH] 新增直接调拨单扫描源单条码方法,新增直接调拨单先进先出功能

---
 CLOUDWEB/WebService1.asmx.cs |  140 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 136 insertions(+), 4 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index b55b75b..05dcf95 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -35788,7 +35788,7 @@
                     //鍏堣繘鍏堝嚭鎺у埗
                     if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y")  //绯荤粺鍙傛暟  鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭鎺у埗
                     {
-                        DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut");
+                        DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut");
                         if (FIFO == null || FIFO.Tables[0].Rows.Count == 0)
                         {
                             sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘瓨鍏ュ厛杩涘厛鍑轰复鏃惰〃澶辫触锛�";
@@ -35806,7 +35806,7 @@
                     //鍏堣繘鍏堝嚭涓嬫灦娓呭崟
                     else if (oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y")  //绯荤粺鍙傛暟  鐢熶骇棰嗘枡鍗�-鍏堣繘鍏堝嚭涓嬫灦娓呭崟
                     {
-                        DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MateOut");
+                        DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MateOut");
                         if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0)
                         {
                             sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘瓨鍏ュ厛杩涘厛鍑轰笅鏋舵竻鍗曞け璐ワ紒";
@@ -35986,6 +35986,106 @@
                     oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]);
                     oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]);
                     oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]);
+                    return oBar;
+                }
+                else
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return null;
+                }
+            }
+        }
+
+        #endregion
+
+        #region 鐩存帴璋冩嫧    鎵弿婧愬崟鏉$爜
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_MoveStock(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+            Int64 sMulSourceFlag = 0;   //澶氭簮鍗曟爣蹇楋紙0涓洪潪澶氭簮鍗曟ā寮忥紝1涓哄婧愬崟妯″紡锛�
+
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+            {
+                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涙壂鎻忔簮鍗曟椂鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return null;
+            }
+
+            if (oSystemParameter.omodel.Kf_MoveStockBill_MulSourceBill.ToUpper() == "Y") //绯荤粺鍙傛暟  鐩存帴璋冩嫧鍗�-澶氭簮鍗曟ā寮�
+            {
+                sMulSourceFlag = 1;
+            }
+
+            //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_MoveStock " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HFIFOWhID.ToString() + "," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_MoveStock");
+            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘皢婧愬崟淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                return null;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                {
+                    //鍏堣繘鍏堝嚭鎺у埗
+                    if (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y")  //绯荤粺鍙傛暟  鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭鎺у埗
+                    {
+                        DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MoveStock " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MoveStock");
+                        if (FIFO == null || FIFO.Tables[0].Rows.Count == 0)
+                        {
+                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘瓨鍏ュ厛杩涘厛鍑轰复鏃惰〃澶辫触锛�";
+                            return null;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0][0]) == 1)
+                            {
+                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HRemark"]);
+                                return null;
+                            }
+                        }
+                    }
+                    //鍏堣繘鍏堝嚭涓嬫灦娓呭崟
+                    else if (oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y")  //绯荤粺鍙傛暟  鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭涓嬫灦娓呭崟
+                    {
+                        DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MoveStock " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MoveStock");
+                        if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0)
+                        {
+                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涘瓨鍏ュ厛杩涘厛鍑轰笅鏋舵竻鍗曞け璐ワ紒";
+                            return null;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(FIFOList.Tables[0].Rows[0][0]) == 1)
+                            {
+                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(FIFOList.Tables[0].Rows[0]["HRemark"]);
+                                return null;
+                            }
+                        }
+                    }
+                    oBar.HBarType = "婧愬崟鏉$爜";
+                    oBar.HMulSourceFlag = sMulSourceFlag;
+                    oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]);
+                    oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
+                    oBar.HSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]);
+                    oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]);
+                    oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]);
+                    oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]);
+                    oBar.HStockOutOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockOutOrgID"]);
+                    oBar.HStockOutOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockOutOrgName"]);
+                    oBar.HStockInOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockInOrgID"]);
+                    oBar.HStockInOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockInOrgName"]);
+                    oBar.HStockStyle = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockStyle"]);
+                    oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
+                    oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
+                    oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
+                    oBar.HSCWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCWhID"]);
+                    oBar.HSCWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSCWhName"]);
+                    oBar.HSCSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSCSPFlag"]);
                     return oBar;
                 }
                 else
@@ -37015,6 +37115,11 @@
                     return false;
                 }
             }
+            //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+            if (SourceFlag == false)
+            {
+                HSourceBillType = "-1";
+            }
 
             //1銆侀娆℃壂鐮侀槻涓插崟鍒ゆ柇锛� 2銆佹簮鍗曠被鍨嬫槸鍚﹀湪婧愬崟鍒楄〃閲屽垽鏂紱3銆佸敮涓�鏉$爜鏄惁瀛樺湪鐩稿悓鏉$爜鍒ゆ柇锛� 4銆佹湁婧愬崟锛岀墿鏂欐槸鍚﹀湪婧愬崟涓垽鏂�
             DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStock '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag), "h_p_WMS_AddBarCode_MoveStock");
@@ -37235,6 +37340,29 @@
             oMain.HPieceQty = 1;
             oMain.HSTOCKORGID = HStockOutOrgID;
             oMain.HOWNERID = HStockInOrgID;
+
+            //鍏堣繘鍏堝嚭鎺у埗
+            if ((HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_FIFOCtl == "Y")      //绯荤粺鍙傛暟  鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭鎺у埗
+                )
+            {
+                DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + oMain.HBatchNo + "','" + oMain.HBarCode + "'," + oMain.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode");
+                if (FIFO == null || FIFO.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "璇锋牴鎹厛杩涘厛鍑烘竻鍗曟壂鐮侊紒";
+                    return false;
+                }
+                else
+                {
+                    oMain.HWhID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HWHID"]);
+                    oMain.HStockPlaceID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSPID"]);
+                    oMain.HQty = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HQty"]);
+                    oMain.HQtyMust = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HSumQtyMust"]);
+                    oMain.HSourceInterID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceInterID"]);
+                    oMain.HSourceEntryID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceEntryID"]);
+                    oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillNo"]);
+                    oMain.HSourceBillType = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillType"]);
+                }
+            }
 
             oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                 "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
@@ -37879,11 +38007,15 @@
                     sSimpleMode = "Y";
                 }
             }
-            if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y"))   //閿�鍞嚭搴撳崟-鍏堣繘鍏堝嚭鎺у埗
+            else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y"))   //閿�鍞嚭搴撳崟-鍏堣繘鍏堝嚭鎺у埗
             {
                 sFIFOCtl = "Y";
             }
-            if (HBillType == "1211" && oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y")   //濮斿鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+            else if (HBillType == "1211" && oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y")   //濮斿鍑哄簱鍗�-鍏堣繘鍏堝嚭鎺у埗
+            {
+                sFIFOCtl = "Y";
+            }
+            else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y"))   //鐩存帴璋冩嫧鍗�-鍏堣繘鍏堝嚭鎺у埗
             {
                 sFIFOCtl = "Y";
             }

--
Gitblit v1.9.1