From 502c7f58c13d8373e82640368b4ec47d80680629 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期一, 26 六月 2023 09:06:17 +0800
Subject: [PATCH] 新增销售出库二次校验功能(原单据为扫码生成,审核时对原扫描的条码进行核对)

---
 CLOUDWEB/WebService1.asmx.cs |  392 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 355 insertions(+), 37 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 2cb2592..b7c1b96 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -17659,19 +17659,47 @@
         [WebMethod]
         public bool set_SaveSellOutBill_BillCheck(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
         {
-            if (set_SaveSellOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true)
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBillByOrgID(oMain.HSTOCKORGID, ref sErrMsg) == false)
             {
-                //涓婁紶鎴愬姛
-                return true;
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return false;
             }
+
+            //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
+            if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+            {
+                if (set_SaveSellOutBill_CLD_BillCheck_Verify(oMain, ref sErrMsg) == true)
+                {
+                    //涓婁紶鎴愬姛
+                    return true;
+                }
+                else
+                {
+                    //涓婁紶澶辫触
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涗笂浼犲崟鎹け璐ワ紒" + sErrMsg;
+                    return false;
+                }
+            }
+            //鍘熷崟鎹潪鎵爜鐢熸垚
             else
             {
-                //涓婁紶澶辫触
-                sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涗笂浼犲崟鎹け璐ワ紒" + sErrMsg;
-                return false;
+                if (set_SaveSellOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true)
+                {
+                    //涓婁紶鎴愬姛
+                    return true;
+                }
+                else
+                {
+                    //涓婁紶澶辫触
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涗笂浼犲崟鎹け璐ワ紒" + sErrMsg;
+                    return false;
+                }
             }
         }
 
+        //鍘熷崟鎹潪鎵爜鐢熸垚
         private bool set_SaveSellOutBill_CLD_BillCheck(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -17701,12 +17729,8 @@
             try
             {
                 oCn.BeginTran();
-
-                if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl != "Y")
-                {
-                    //鍐欏叆鏉$爜鍑哄叆搴撹〃
-                    oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
-                }
+                //鍐欏叆鏉$爜鍑哄叆搴撹〃
+                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
 
                 //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮�
                 if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
@@ -17857,6 +17881,98 @@
                             return false;
                         }
                     }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鏍¢獙瀹℃牳閿�鍞嚭搴撳崟澶辫触锛�" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+        }
+
+        //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
+        private bool set_SaveSellOutBill_CLD_BillCheck_Verify(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            //涓婁紶鍓嶅垽鏂�
+            DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_SellOutBillCheck_Verify " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_BeforeUpload_SellOutBillCheck_Verify");
+            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+            {
+                sErrMsg = "鏍¢獙涓婁紶鍓嶅垽鏂紝鍙戠敓閿欒锛�";
+                return false;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
+                {
+                    sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                    return false;
+                }
+            }
+
+            try
+            {
+                oCn.BeginTran();
+                //鍐欏叆鏉$爜鍑哄叆搴撴牎楠岃〃
+                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Verify_Insert " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
+
+                //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮�
+                if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
+                {
+                    sErrMsg = Pub_Class.ClsPub.sExeReturnInfo;
+                    return false;
+                }
+
+                //鑾峰彇CLOUD璐﹀彿瀵嗙爜
+                string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName;
+                string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd;
+                DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID);
+                if (ds11 == null || ds11.Tables[0].Rows.Count == 0)
+                {
+                }
+                else
+                {
+                    sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]);
+                    sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]);
+                }
+
+                //閲戣澏浜戝鏍稿崟鎹�
+                string HReturn;
+                ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl);
+                string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
+                bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
+                if (bLogin)
+                {
+                    //鎻愪氦鍗曟嵁
+                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
+                    new object[] { "SAL_OUTSTOCK", sJson2 });
+                    //瀹℃牳鍗曟嵁
+                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                    new object[] { "SAL_OUTSTOCK", sJson3 });
+
+                    HReturn = result3.ToString();
+
+                    if (HReturn.Contains("\"IsSuccess\":false") == true)
+                    {
+                        sErrMsg = "瀹℃牳閿�鍞嚭搴撳崟澶辫触锛�" + HReturn;
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        sErrMsg = "鏍¢獙瀹℃牳閿�鍞嚭搴撳崟鎴愬姛锛佸崟鎹彿涓猴細" + oMain.HBillNo;
+                        oCn.Commit();
+                        return true;
+                    }
+                }
+                else
+                {
+                    sErrMsg = "鏍¢獙瀹℃牳閿�鍞嚭搴撳崟澶辫触锛侀噾铦朵簯鐧诲綍澶辫触锛�";
+                    oCn.RollBack();
+                    return false;
                 }
             }
             catch (Exception e)
@@ -52188,43 +52304,44 @@
                 sSourceBarCodeCtl = "Y";
             }
 
-            //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
+            //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
             if (sSourceBarCodeCtl == "Y")
             {
-                //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� KF_PonderationBillMain_Temp锛屽崟鎹搴旀潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱璁板綍涓存椂琛� Kf_ICStockBillSub_WMS_Temp
-                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
-                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+                //灏嗗崟鎹俊鎭�佸崟鎹搴旀潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱鏍¢獙涓存椂琛↘F_PonderationBillMain_Temp_Verify
+                DataSet dsVerify = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
+                if (dsVerify == null || dsVerify.Tables[0].Rows.Count == 0)
                 {
-                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅鍐欏叆鏉$爜鍑哄叆搴撴牎楠屼复鏃惰〃澶辫触锛�";
                     return null;
                 }
                 else
                 {
-                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
+                    if (DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0][0]) == 0)
                     {
-                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
-                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
-                        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.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
-                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
+                        oBar.HInterID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HInterID"]);
+                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HBillNo"]);
+                        oBar.HWhID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HWhID"]);
+                        oBar.HWhName = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HWhName"]);
+                        oBar.HSPFlag = DBUtility.ClsPub.isBool(dsVerify.Tables[0].Rows[0]["HSPFlag"]);
+                        oBar.HSPID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HSPID"]);
+                        oBar.HSPName = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HSPName"]);
                         return oBar;
                     }
                     else
                     {
-                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                        sErrMsg = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HRemark"]);
                         return null;
                     }
                 }
             }
+            //鍘熷崟鎹潪鎵爜鐢熸垚
             else
             {
-                //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                //灏嗗崟鎹俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛↘F_PonderationBillMain_Temp
                 DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
                 if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                 {
-                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
                     return null;
                 }
                 else
@@ -52242,7 +52359,7 @@
                     }
                     else
                     {
-                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                        sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                         return null;
                     }
                 }
@@ -52749,7 +52866,7 @@
 
         #region 鎵弿鐗╂枡鏉$爜    *鏍¢獙妯″紡
 
-        //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃
+        //鍘熷崟鎹潪鎵爜鐢熸垚锛屾壂鎻忕墿鏂欐潯鐮�  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃
         [WebMethod]
         public bool set_SavePonderationBillMain_Temp_BarCode_BillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
@@ -53286,7 +53403,7 @@
 
         #endregion
 
-        #region 涓�閿壂鐮�        *鏍¢獙妯″紡
+        #region 涓�閿壂鐮侊紙鍘熷崟鎹潪鎵爜鐢熸垚锛�        *鏍¢獙妯″紡
 
         //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撴潯鐮併�佷粨浣嶆潯鐮併�佸崟鎹彿鏉$爜銆佺墿鏂欐潯鐮侊級
         [WebMethod]
@@ -53593,20 +53710,187 @@
 
         #endregion
 
+        #region 涓�閿壂鐮侊紙鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿锛�        *鏍¢獙妯″紡
+
+        //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_BillBarCode_Verify(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, Double HQty, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
+        {
+            try
+            {
+                //鑾峰彇绯荤粺鍙傛暟
+                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+                if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == false)
+                {
+                    sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    return null;
+                }
+
+                if (HBarCode.Trim() == "")
+                {
+                    sErrMsg = "鏉$爜涓嶈兘涓虹┖锛岃鎵弿鏉$爜锛�";
+                    return null;
+                }
+                else
+                {
+                    //鍒ゆ柇鏉$爜鏄惁鍚壒娈婄鍙� # 锛屽鏋滃惈鏈夊垯 鎷嗗垎
+                    string[] NewBarCode;
+                    if (HBarCode.Contains("#"))
+                    {
+                        NewBarCode = HBarCode.Split(Convert.ToChar("#"));
+                        HBarCode = NewBarCode[0];
+                        if (HQty == 0)
+                        {
+                            HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
+                        }
+                    }
+                }
+
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+
+                //鏍规嵁绯荤粺鍙傛暟锛屽垽鏂槸鍚﹀惎鐢ㄤ竴閿壂鐮佹ā寮忥紝Y涓哄惎鐢�
+                //鏈惎鐢紝鍙壂鎻忕墿鏂欐潯鐮�
+                if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
+                {
+                    //灏嗗崟鎹俊鎭�佸崟鎹搴旀潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱鏍¢獙涓存椂琛↘F_PonderationBillMain_Temp_Verify
+                    DataSet ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheckVerify " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString(), "h_p_WMS_AddBarCode_BillCheckVerify");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涙壂鎻忕墿鏂欐潯鐮佹牎楠屽け璐ワ紒";
+                        return null;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
+                        {
+                            oBar.HBarType = "鐗╂枡鏉$爜";
+                            return oBar;
+                        }
+                        else
+                        {
+                            sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                            return null;
+                        }
+                    }
+                }
+                //鍚敤锛屾牴鎹潯鐮佸墠缂�璧颁笉鍚屾柟娉曪紙鍗曟嵁鏉$爜銆佺墿鏂欐潯鐮侊級
+                else
+                {
+                    //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�佸崟鎹潯鐮併�佺墿鏂欐潯鐮侊級
+                    string sBarCodePrefix = HBarCode.Substring(0, Math.Min(3, HBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆
+                    DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
+
+                    //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮�
+                    if (Dss == null || Dss.Tables[0].Rows.Count == 0)
+                    {
+                        //灏嗗崟鎹俊鎭�佸崟鎹搴旀潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱鏍¢獙涓存椂琛↘F_PonderationBillMain_Temp_Verify
+                        DataSet ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheckVerify " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString(), "h_p_WMS_AddBarCode_BillCheckVerify");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涙壂鎻忕墿鏂欐潯鐮佹牎楠屽け璐ワ紒";
+                            return null;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
+                            {
+                                oBar.HBarType = "鐗╂枡鏉$爜";
+                                return oBar;
+                            }
+                            else
+                            {
+                                sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                                return null;
+                            }
+                        }
+                    }
+                    //鍗曟嵁鏉$爜
+                    else
+                    {
+                        string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
+                        string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
+
+                        //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜
+                        if(sBarBillType == "婧愬崟鏉$爜")
+                        {
+                            oBar = get_BillBarCode_BillCheck(HBillNo, HBillType, HMaker, HStockOrgID, ref sErrMsg);
+                            if (oBar == null)
+                            {
+                                sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
+                                return null;
+                            }
+                            else
+                            {
+                                oBar.HBarType = "鍗曟嵁鏉$爜";
+                                return oBar;
+                            }
+                        }
+                        else
+                        {
+                            sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝鎵�鎵潯鐮佸墠缂�涓嶄负鍗曟嵁鏉$爜鍓嶇紑锛�";
+                            return null;
+                        }
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = e.Message + ";" + e.StackTrace;
+                return null;
+            }
+        }
+
+        #endregion
+
         #region 杩斿洖鍗曟嵁鐗╂枡鍒楄〃淇℃伅  *鏍¢獙妯″紡
 
         [WebMethod]
         public DataSet GetKf_PonderationBillMain_Temp_BillCheck(long HInterID, string sBillType, string sWhere)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-            DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck");
-            if (DS == null)
+
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg="";
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
             {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 return null;
             }
+
+            string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
+            if (sBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+            {
+                //閿�鍞嚭搴撳崟
+                sSourceBarCodeCtl = "Y";
+            }
+
+            //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
+            if (sSourceBarCodeCtl == "Y")
+            {
+                DataSet DSVerify = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_Verify " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_Verify");
+                if (DSVerify == null)
+                {
+                    return null;
+                }
+                else
+                {
+                    return DSVerify;
+                }
+            }
+            //鍘熷崟鎹潪鎵爜鐢熸垚
             else
             {
-                return DS;
+                DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck");
+                if (DS == null)
+                {
+                    return null;
+                }
+                else
+                {
+                    return DS;
+                }
             }
         }
 
@@ -53670,14 +53954,48 @@
         public DataSet GetKf_PonderationBillMain_TempList_BillCheck(string sHBillType, string sHMaker, Int64 sHOWNERID)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-            DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck");
-            if (Ds == null)
+
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg = "";
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
             {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                 return null;
             }
+
+            string sSourceBarCodeCtl = "N";   //鏍¢獙-鏄惁杩涜婧愬崟瀵瑰簲鏉$爜鏍稿锛�'Y'涓烘牳瀵癸級
+            if (sHBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
+            {
+                //閿�鍞嚭搴撳崟
+                sSourceBarCodeCtl = "Y";
+            }
+
+            //鍘熷崟鎹负鎵爜鐢熸垚锛屽鍘熸壂鎻忕殑鏉$爜杩涜鏍稿
+            if (sSourceBarCodeCtl == "Y")
+            {
+                DataSet DSVerify = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_Verify '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_Verify");
+                if (DSVerify == null)
+                {
+                    return null;
+                }
+                else
+                {
+                    return DSVerify;
+                }
+            }
+            //鍘熷崟鎹潪鎵爜鐢熸垚
             else
             {
-                return Ds;
+                DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck");
+                if (Ds == null)
+                {
+                    return null;
+                }
+                else
+                {
+                    return Ds;
+                }
             }
         }
 

--
Gitblit v1.9.1