From 3a1193b927397baee7d8d2f2e967f5164616c982 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期四, 04 五月 2023 09:21:50 +0800
Subject: [PATCH] 新增扫描托条码调用方法

---
 DLL/Model.dll                |    0 
 CLOUDWEB/WebService1.asmx.cs |  175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 171 insertions(+), 4 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index c5a7acb..fb0fa7e 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -47712,6 +47712,7 @@
                 oMain.HBillType = HBillType;
                 oMain.HMaker = HMaker;
                 oMain.HMaterID = omodel_View.HMaterID;
+                oMain.HUnitID = omodel_View.HUnitID;
                 oMain.HAuxPropID = omodel_View.HAuxPropID;
                 oMain.HQtyMust = 0;
                 oMain.HBarCode = omodel_View.HBarCode;
@@ -47746,14 +47747,14 @@
                 oMain.HCusBarCode = HCustom1;
 
                 oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
-                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
+                "(HInterID,HBillNo,HBillType,HMaterID,HUnitID,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,HBeginDate,HEndDate) " +
-                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
+                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HUnitID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                 "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                 "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                 ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
@@ -47769,6 +47770,171 @@
             }
             oBar.HBarType = "鐗╂枡鏉$爜";
             return oBar;
+        }
+
+        #endregion
+
+        #region 涓�閿壂鐮�    鎵弿鐗╂枡鏉$爜锛堟潯鐮佺被鍨� = "鎵樼洏鏉$爜"锛�
+
+        //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_SavePonderationBillMain_Temp_PackBarCode(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, bool SourceFlag, string HSourceBillType, Int64 HStockOrgID, Int64 HStockOutOrgID, string HCusBarCode, string HCustom2, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+
+            string HMaterNumber;            //鐗╂枡浠g爜
+            string sSourceBillCtl = "N";    //鏄惁杩涜婧愬崟淇℃伅鏍稿锛�'Y'涓烘牳瀵规簮鍗曚俊鎭級
+            string sBatchNoCtl = "N";       //鏄惁杩涜鎵瑰彿鏍稿锛�'Y'涓烘牳瀵规壒鍙凤級
+            string sMultilineCtl = "N";     //鏄惁瀛樺湪澶氳鐩稿悓鐗╂枡鏃惰嚜鍔ㄦ媶鍒嗘崲琛岋紙'Y'涓鸿嚜鍔ㄦ媶鍒嗭級
+            string sMustQtyCtl = "涓嶆帶鍒�";  //鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺鎺у埗锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
+            string sMaterWHSPCtl = "N";     //鏄惁鍙栫墿鏂欓粯璁や粨搴撲粨浣嶏紙'Y'涓烘槸锛�
+            string sSourceWHSPCtl = "N";    //鏄惁鍙栨簮鍗曚腑浠撳簱浠撲綅锛�'Y'涓烘槸锛�
+            string sOneScanCtl = "N";       //涓�娆℃壂鐮佹帶鍒讹紙'Y'涓烘帶鍒讹級
+            string sFIFOCtl = "N";          //鍏堣繘鍏堝嚭鎺у埗锛�'Y'涓烘帶鍒讹級
+            string sMulSourceCtl = "N";     //鏄惁鍚敤澶氭簮鍗曟壂鐮佹ā寮忥紙'Y'涓哄惎鐢級
+
+            //鏍规嵁鍗曟嵁绫诲瀷锛岃幏鍙栧搴斿崟鎹郴缁熷弬鏁板��
+            if (get_SystemParameter_BarCode(HBillType, oSystemParameterMain, ref sSourceBillCtl, ref sBatchNoCtl, ref sMultilineCtl, ref sMustQtyCtl, ref sMaterWHSPCtl, ref sSourceWHSPCtl, ref sOneScanCtl, ref sFIFOCtl, ref sMulSourceCtl, ref sErrMsg))
+            {
+
+            }
+
+            try
+            {
+                oCn.BeginTran();
+                //钃濆瓧鍏ュ簱銆佹眹鎶ユā鍧楋紝闈炴棤婧愬崟鎵爜銆佹潯鐮佺被鍨嬩负 鍞竴鏉$爜 涓斾负鏈夋簮鍗曠敓鎴愮殑鐗╂枡鏉$爜锛屾壂鎻忔潯鐮佹椂鑷姩甯﹀嚭婧愬崟淇℃伅锛岀涓�娆℃壂鐮佹垨鍚敤澶氭簮鍗曟壂鐮佹ā寮�
+                //閲囪喘鍏ュ簱锛�1201锛夈�佺敓浜у叆搴擄紙1202锛夈�佸叾浠栧叆搴擄紙1203锛夈�佸澶栧叆搴擄紙1210锛夈�佺敓浜ф眹鎶ワ紙3711锛�
+                if (HSourceBillType != "-1" && (SourceFlag == false || sMulSourceCtl == "Y")
+                && (HBillType == "1201" || HBillType == "1202" || HBillType == "1203" || HBillType == "1210" || HBillType == "3711"))
+                {
+                    Int64 HAccessFlag = 1;   //鏄惁鐗╂枡鏉$爜甯﹀嚭婧愬崟淇℃伅鏍囧織锛�0涓虹洿鎺ユ壂婧愬崟鏉$爜锛�1涓虹墿鏂欐潯鐮佸甫鍑烘簮鍗曚俊鎭級
+                    oBar = get_SourceBill_MaterBarCode(HInterID, HBillNo, HBillType, omodel_View.HSourceBillNo, omodel_View.HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg);
+                    if (oBar == null)
+                    {
+                        oCn.RollBack();
+                        return null;
+                    }
+                    else
+                    {
+                        SourceFlag = true;
+                    }
+                }
+                else
+                {
+                    //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1
+                    if (SourceFlag == false)
+                    {
+                        //閿�鍞嚭搴撲笉鍏佽鏃犳簮鍗曞嚭搴�
+                        if (HBillType == "1205")
+                        {
+                            sErrMsg = "涓嶅厑璁告棤婧愬崟鍑哄簱锛岃鍏堟壂鎻忔簮鍗曪紒";
+                            oCn.RollBack();
+                            return null;
+                        }
+                        HSourceBillType = "-1";
+                    }
+                }
+
+                //鎵弿鎵樻潯鐮侊紝灏嗘墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
+                DataSet ds = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + omodel_View.HBarCode + "','" + HSourceBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HCusBarCode + "'," + HStockOrgID.ToString() + "," + HStockOutOrgID.ToString() + ",'" + HMaker + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + "," + sSourceBillCtl + ",'" + sBatchNoCtl + "','" + sMaterWHSPCtl + "','" + sSourceWHSPCtl + "','" + sMustQtyCtl + "','" + oSystemParameterMain.WMS_WMSStockCtl + "','" + sFIFOCtl + "','" + sMulSourceCtl + "'", "h_p_WMS_AddPackBarCode");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鎵弿鎵樻潯鐮佸啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛ㄥ彂鐢熼敊璇紒";
+                    oCn.RollBack();
+                    return null;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
+                    {
+                        omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBarCodeType"]);
+                    }
+                    else
+                    {
+                        sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                        oCn.RollBack();
+                        return null;
+                    }
+                }
+
+                //鐢熶骇棰嗘枡锛�1204锛夈�侀攢鍞嚭搴擄紙1205锛夈�佸叾浠栧嚭搴撹摑瀛楋紙1206锛夈�佸澶栧嚭搴擄紙1211锛夈�佺敓浜цˉ鏂欙紙1254锛�
+                //澶栬喘閫�鏂欙紙1239锛夈�佷骇鍝侀��搴擄紙1245锛夈�佸叾浠栧叆搴撶孩瀛楋紙1248锛夈�佸澶栭��搴擄紙1246锛�
+                //鍑哄簱銆佺孩瀛楀叆搴擄紝鍒ゆ柇鏉$爜搴撳瓨銆丒RP搴撳瓨
+                if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211" || HBillType == "1254"
+                    || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246")
+                {
+                    //搴撳瓨鎺у埗-ERP璐熷簱瀛樻帶鍒�     绉佹湁浜戞ā寮�
+                    if (oSystemParameterMain.WMS_ERPStockCtl == "Y" && oSystemParameterMain.WMS_CloudMode == "Y")
+                    {
+                        string HRemark = "";
+                        double sERPQty = 0;
+                        string sWhName = "";
+                        string sSPName = "";
+                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                        {
+                            HMaterNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HMaterNumber"]);
+                            omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]);
+                            omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]);
+                            HWhID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWhID"]);
+                            HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]);
+                            omodel_View.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]);
+                            //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
+                            DataSet DsERP = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_GetERPICInventory " + HInterID.ToString() + ",'" + HBillType + "','" + HMaterNumber + "'," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_GetERPICInventory");
+                            if (DsERP == null || DsERP.Tables[0].Rows.Count == 0)
+                            {
+                                HRemark = HRemark+ "瀵瑰簲鐗╂枡浠g爜锛�" + HMaterNumber + "銆佹壒鍙凤細" + omodel_View.HBatchNo + " 锛屾棤閲戣澏搴撳瓨锛�";
+                            }
+                            else
+                            {
+                                sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]);
+                                sWhName = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HWhName"]);
+                                sSPName = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HSPName"]);
+
+                                if (omodel_View.HQty > sERPQty)
+                                {
+                                    HRemark = HRemark + "瀵瑰簲鐗╂枡浠g爜锛�" + HMaterNumber + "銆佹壒鍙凤細" + omodel_View.HBatchNo + " 锛屽湪閲戣澏浠撳簱[ " + sWhName + " ]銆佷粨浣峓 " + sSPName + " ]涓暟閲忎负锛�" + sERPQty + " 锛屽皬浜庢墍鎵潯鐮佹暟閲忥細" + omodel_View.HQty + " 閲戣澏搴撳瓨涓嶈冻锛�";
+                                }
+                            }
+                        }
+                        if(HRemark!="")
+                        {
+                            sErrMsg = "鎵�鎵弿鎵樻潯鐮侊細" + omodel_View.HBarCode + "锛�" + HRemark;
+                            oCn.RollBack();
+                            return null;
+                        }
+                    }
+                }
+
+                //鍞竴鏉$爜锛屾槸鍚﹀惎鐢ㄤ竴娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級
+                if (omodel_View.HBarCodeType == "鍞竴鏉$爜" && sOneScanCtl == "Y")
+                {
+                    //涓�娆℃壂鐮佹帶鍒讹紝鍚屼竴鏉$爜銆佸悓涓�鍗曟嵁绫诲瀷锛屽湪WMS琛ㄥ拰TEMP琛ㄩ噷锛屽彧鍏佽杩涜涓�娆℃壂鐮�
+                    DataSet dsOneScan = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_OneScan '" + omodel_View.HBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HMaker + "'", "h_p_WMS_AddPackBarCode_OneScan");
+                    if (dsOneScan == null || dsOneScan.Tables[0].Rows.Count == 0)
+                    {
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(dsOneScan.Tables[0].Rows[0][0]) == 1)
+                        {
+                            sErrMsg = DBUtility.ClsPub.isStrNull(dsOneScan.Tables[0].Rows[0]["HRemark"]);
+                            oCn.RollBack();
+                            return null;
+                        }
+                    }
+                }
+
+                oBar.HBarType = "鐗╂枡鏉$爜";
+                oCn.Commit();
+                return oBar;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message;
+                oCn.RollBack();
+                return null;
+            }
         }
 
         #endregion
@@ -48312,6 +48478,7 @@
             oMain.HBillType = HBillType;
             oMain.HMaker = HMaker;
             oMain.HMaterID = omodel_View.HMaterID;
+            oMain.HUnitID = omodel_View.HUnitID;
             oMain.HAuxPropID = omodel_View.HAuxPropID;
             oMain.HQty = sRelQty;
             oMain.HQtyMust = 0;
@@ -48372,14 +48539,14 @@
             }
 
             oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
-                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
+                "(HInterID,HBillNo,HBillType,HMaterID,HUnitID,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,HBeginDate,HEndDate) " +
-                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
+                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HUnitID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                 "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                 "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                 ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
diff --git a/DLL/Model.dll b/DLL/Model.dll
index 514c176..f2daecb 100644
--- a/DLL/Model.dll
+++ b/DLL/Model.dll
Binary files differ

--
Gitblit v1.9.1