From 64e198107180dcffa137cc9d5fb59b4ea6df4d56 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 23 九月 2022 16:06:14 +0800
Subject: [PATCH] 森楷直接调拨单扫描物料条码调用方法新增、优化

---
 CLOUDWEB/WebService1.asmx.cs |  223 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 179 insertions(+), 44 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 487baa7..cebbb74 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -42162,52 +42162,12 @@
                             //妫シ涓撶敤
                             if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                             {
-                                DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','鏁存墭鎵爜'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
-                                if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+                                if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, "鏁存墭鎵爜", oSystemParameter.omodel, ref sErrMsg))
                                 {
-                                    sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
+                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
                                     return null;
                                 }
-                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
-                                {
-                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
-                                    return null;
-                                }
-                                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
-                                {
-                                    sErrMsg = "姝ゆā鍧椾笉鍏佽鍙嶅悜鎷嗙爜锛�";
-                                    return null;
-                                }
-                                else
-                                {
-                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
-                                    {
-                                        dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
-                                        dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
-                                        dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
-                                        dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
-                                        dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
-                                        dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
-                                        dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
-                                        //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
-                                        if (SourceFlag == false)
-                                        {
-                                            HSourceBillType = "-1";
-                                        }
-                                        if (i!=0)
-                                        {
-                                            SourceFlag = true;
-                                        }
-
-                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                        if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg))
-                                        {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                            return null;
-                                        }
-                                    }
-                                    return oBar;
-                                }
+                                return oBar;
                             }
                             else
                             {
@@ -42595,6 +42555,181 @@
             return true;
         }
 
+        //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃      璋冩嫧
+        [WebMethod]
+        public bool set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, string HScanStyle, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp();
+            string sBarCode_New = "";
+
+            //鍒ゆ柇璋冨叆浠撳簱銆佷粨浣嶆槸鍚︽湁鏁�
+            if (HWhID == 0)
+            {
+                sErrMsg = "璋冨叆浠撳簱娌℃湁閫夋嫨锛�";
+                return false;
+            }
+            else
+            {
+                //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣�
+                DataSet dsWh = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HWhID.ToString() + " and HUSEORGID= " + HStockInOrgID.ToString(), "Gy_Warehouse");
+                if (dsWh == null || dsWh.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鎵�閫夎皟鍏ヤ粨搴撲笉灞炰簬璇ヨ皟鍏ョ粍缁囷紒";
+                    return false;
+                }
+                else if (HSPID == 0 && DBUtility.ClsPub.isBool(dsWh.Tables[0].Rows[0]["HSPFlag"]) == true)
+                {
+                    sErrMsg = "璋冨叆浠撲綅娌℃湁閫夋嫨锛�";
+                    return false;
+                }
+            }
+
+            //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅
+            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
+            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
+                {
+                    sErrMsg = "姝ゆā鍧椾笉鍏佽鍙嶅悜鎷嗙爜锛�";
+                    return false;
+                }
+                else
+                {
+                    omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                    omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
+                    omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
+                    HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
+                    //鑾峰彇璋冨嚭浠撳簱浠撲綅淇℃伅
+                    if (HSCWHID == 0)
+                    {
+                        HSCWHID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]);
+                        HSCSPID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"]);
+                    }
+                    else
+                    {
+                        if (HSCWHID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]) || HSCSPID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"]))
+                        {
+                            sErrMsg = "鏉$爜瀵瑰簲鐗╂枡鍦ㄧ晫闈㈡墍閫夎皟鍑轰粨搴撱�佽皟鍑轰粨浣嶄笂鏃犲簱瀛橈紒";
+                            return false;
+                        }
+                    }
+
+                    //灏嗘暣鎵樻潯鐮佸搴旂殑鏉$爜缂栧彿鎷兼垚涓�涓插瓧绗︿覆
+                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                    {
+                        sBarCode_New = sBarCode_New + "," + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
+                    }
+                    sBarCode_New = sBarCode_New.Remove(0, 1);   //鍘绘帀瀛楃涓茬涓�涓瓧绗�
+
+                    //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+                    if (SourceFlag == false)
+                    {
+                        HSourceBillType = "-1";
+                    }
+                }
+            }
+
+            //鍒ゆ柇璋冨嚭浠撳簱銆佷粨浣嶆槸鍚︽湁鏁�
+            if (HSCWHID == 0)
+            {
+                sErrMsg = "璋冨嚭浠撳簱娌℃湁閫夋嫨锛�";
+                return false;
+            }
+            else
+            {
+                //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣�
+                DataSet dsSCWH = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HSCWHID.ToString() + " and HUSEORGID= " + HStockOutOrgID.ToString(), "Gy_Warehouse");
+                if (dsSCWH == null || dsSCWH.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鎵�閫夎皟鍑轰粨搴撲笉灞炰簬璇ヨ皟鍑虹粍缁囷紒";
+                    return false;
+                }
+                else if (HSCSPID == 0 && DBUtility.ClsPub.isBool(dsSCWH.Tables[0].Rows[0]["HSPFlag"]) == true)
+                {
+                    sErrMsg = "璋冨嚭浠撲綅娌℃湁閫夋嫨锛�";
+                    return false;
+                }
+            }
+
+            if (HWhID == HSCWHID && HSPID == HSCSPID)
+            {
+                sErrMsg = "璋冨叆浠撳簱銆佷粨浣嶄笉鑳戒笌璋冨嚭浠撳簱銆佷粨浣嶇浉鍚岋紒";
+                return false;
+            }
+
+            //鍞竴鏉$爜锛屾槸鍚﹀惎鐢ㄤ竴娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級
+            if (omodel_View.HBarCodeType == "鍞竴鏉$爜" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan.ToUpper() == "Y")
+            {
+                //涓�娆℃壂鐮佹帶鍒讹紝鍚屼竴鏉$爜銆佸悓涓�鍗曟嵁绫诲瀷锛屽湪WMS琛ㄥ拰TEMP琛ㄩ噷锛屽彧鍏佽杩涜涓�娆℃壂鐮�
+                DataSet ds = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan " + HBillID.ToString() + ",'" + omodel_View.HBarCode + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
+                    {
+                        sErrMsg = "瀵逛笉璧凤紝鎮ㄦ壂鎻忕殑鏉″舰鐮佸凡琚壂鎻忚繃锛屼笉绗﹀悎涓�娆℃壂鐮佺郴缁熷弬鏁扮殑瑕佹眰锛�";
+                        return false;
+                    }
+                }
+            }
+
+            oMain.HInterID = HBillID;
+            oMain.HBillNo = HBillNo;
+            oMain.HBillType = HBillType;
+            oMain.HMaker = HMaker;
+            oMain.HMaterID = omodel_View.HMaterID;
+            oMain.HAuxPropID = omodel_View.HAuxPropID;
+            oMain.HQty = omodel_View.HQty;
+            oMain.HQtyMust = 0;
+            oMain.HBarCode = omodel_View.HBarCode;
+            oMain.HBatchNo = omodel_View.HBatchNo;
+            oMain.HMTONo = omodel_View.HMTONo;
+            oMain.HWhID = HWhID;
+            oMain.HStockPlaceID = HSPID;
+            oMain.HSCWHID = HSCWHID;
+            oMain.HOutStockPlaceID = HSCSPID;
+            oMain.HSourceInterID = omodel_View.HSourceInterID;
+            oMain.HSourceEntryID = omodel_View.HSourceEntryID;
+            oMain.HSourceBillNo = omodel_View.HSourceBillNo;
+            oMain.HSourceBillType = HSourceBillType;
+            oMain.HRedBlueFlag = false;
+            oMain.HPieceQty = 1;
+            oMain.HSTOCKORGID = HStockOutOrgID;
+            oMain.HOWNERID = HStockInOrgID;
+
+            oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
+                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
+                ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
+                ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
+                ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
+                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
+                ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
+                ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
+                " select " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "',HMaterID,HAuxPropID," + oMain.HProcID.ToString() +
+                "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
+                "," + oMain.HQtyMust.ToString() + ",HQty," + oMain.HPieceQty.ToString() + ",HBatchNo,HBarCode,''" +
+                ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
+                "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
+                "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + "," + oMain.HSTOCKORGID.ToString() + ",'','',0" +
+                ",0,0,'" + oMain.HCusBarCode + "',0" +
+                "from  Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0"
+                );
+            return true;
+        }
+
         #endregion
 
 
@@ -42606,7 +42741,7 @@
 
         #region 鎵弿妯″叿婧愬崟鏉$爜
 
-            [WebMethod]
+        [WebMethod]
         public Model.ClsKf_ICStockBill_Mould get_CheckTypeByMouldSource(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HHMaker, Int64 HOWNERID, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();

--
Gitblit v1.9.1