From 94d3e60d2d4b5f56826ef1511e13d79662a4cb55 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期日, 12 六月 2022 13:26:33 +0800
Subject: [PATCH] 合并

---
 CLOUDWEB/WebService1.asmx.cs |  871 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 764 insertions(+), 107 deletions(-)

diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs
index 259fa54..6ed28e5 100644
--- a/CLOUDWEB/WebService1.asmx.cs
+++ b/CLOUDWEB/WebService1.asmx.cs
@@ -2114,6 +2114,19 @@
 
         #region 鍏朵粬鍏ュ簱--鏉ユ簮鍗曟嵁  *
 
+        //杩斿洖鍏ュ簱鐢宠鍒楄〃
+        /// <summary>
+        /// 杩斿洖鍏ュ簱鐢宠鍒楄〃
+        /// </summary>
+        /// <param name="sWhere">杩囨护鏉′欢</param>
+        /// <returns></returns>
+        [WebMethod]
+        public DataSet GetKf_StockInRequestBillList(string sWhere)
+        {
+            DAL.Cls_S_IF_StockInRequestBill_Lite dal = new DAL.Cls_S_IF_StockInRequestBill_Lite();
+            return dal.DisSourceBillList(sWhere);
+        }
+
         //杩斿洖k3鏈鏍稿叾浠栧叆搴�
         /// <summary>
         /// 杩斿洖k3鏈鏍稿叾浠栧叆搴�
@@ -8443,7 +8456,7 @@
 
                             sJson_Entry = sJson_Entry + " {" +
                             "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," +
-                            "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\"," +
+                            "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\" " +
                             "}";
                         }
                         string sJson_End = "  ]  }}";
@@ -13021,7 +13034,7 @@
                     string sJson_MainCustom = "";    //涓昏〃鑷畾涔夊瓧娈�
                     sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
                     string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
-                        "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
+                        "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                         "\"Model\":{ " +
                         //\"FID\":\"0\",
                         "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," +
@@ -15762,7 +15775,7 @@
 
                             sJson_Entry = sJson_Entry + "{" +
                             "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," +
-                            "\"FActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FActualQty"]) + "\"," +
+                            "\"FActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FActualQty"]) + "\" " +
                             "}";
                         }
                         string sJson_End = "  ]  }}";
@@ -21706,11 +21719,13 @@
                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                 ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                 ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ",HArrivalDate" +
                 ") " +
                 " values('1201','1201'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" +
                 ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
                 ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() +
                 ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) +
+                ",'" + oMain.HArrivalDate.ToShortDateString() + "'" +
                 ") ");
 
                 //鏂板K3瀛愯〃銆佷富琛�
@@ -27460,22 +27475,45 @@
 
         #endregion
 
-        #region 鍏跺畠鍏ュ簱CLOUD   *New
+        #region 鍏朵粬鍏ュ簱CLOUD   *New
 
         //鐢熸垚鍏ュ簱鍗� 
         [WebMethod]
         public bool set_SaveOtherInBill_CLD_New(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
-            if (SaveOtherInBill_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
+            if (sHSourceType == "-1")   //鏃犳簮鍗�
             {
-                //"淇濆瓨鎴愬姛锛�";
-                sErrMsg = "淇濆瓨鎴愬姛锛�" + oMain.HBillNo;
-                return true;
+                if (SaveOtherInBill_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
+                {
+                    //"淇濆瓨鎴愬姛锛�";
+                    sErrMsg = "淇濆瓨鎴愬姛锛�" + oMain.HBillNo;
+                    return true;
+                }
+                else
+                {
+                    //"淇濆瓨澶辫触锛�";
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + sErrMsg;
+                    return false;
+                }
+            }
+            else if (oSystemParameterMain.WMS_CampanyName == "妫シ" || sHSourceType == "1241")    //鍏ュ簱鐢宠鍗�
+            {
+                if (SaveOtherInBill_StockInRequest_CLD_SenKai(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
+                {
+                    //"淇濆瓨鎴愬姛锛�";
+                    sErrMsg = "淇濆瓨鎴愬姛锛�" + oMain.HBillNo;
+                    return true;
+                }
+                else
+                {
+                    //"淇濆瓨澶辫触锛�";
+                    sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + sErrMsg;
+                    return false;
+                }
             }
             else
             {
-                //"淇濆瓨澶辫触锛�";
-                sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛�" + sErrMsg;
+                sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涢敊璇殑婧愬崟绫诲瀷";
                 return false;
             }
         }
@@ -27722,6 +27760,491 @@
             catch (Exception e)
             {
                 sErrMsg = "鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 鍏朵粬鍏ュ簱鍗�   婧愬崟锛氬叆搴撶敵璇峰崟
+        /// </summary>
+        /// <param name="oMain"></param>
+        /// <param name="sErrMsg"></param>
+        /// <returns></returns>
+        public bool SaveOtherInBill_StockInRequest_CLD_SenKai(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            try
+            {
+                //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    sErrMsg = s;
+                    return false;
+                }
+                oMain.HYear = sYear;
+                oMain.HPeriod = sPeriod;
+
+                oCn.BeginTran();
+                //鐢熸垚鍑哄叆搴撳崟鎹�
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("EXEC h_p_Kf_OtherInBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'");
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ",HStockStyle" +
+                ",HSTOCKORGID,HOWNERID" +
+                ") " +
+                " values('1203','1203'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" +
+                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() +
+                ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) +
+                ",'" + oMain.HStockStyle + "'" +
+                ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() +
+                ") ");
+                //鏇存柊鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Kf_UpDateRelation_StockInRequestToOtherIn_Add " + oMain.HInterID.ToString());
+
+                if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                {
+                    //瀹℃牳鍗曟嵁
+                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
+                }
+
+                //鏍规嵁TMP琛� 杩斿洖 瀛愯〃淇℃伅
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("exec h_p_Kf_GetOtherInBill_StockInRequest_CLD_SenKai " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetOtherInBill_StockInRequest_CLD_SenKai");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
+                {
+                    sErrMsg = "鑾峰彇瀛愯〃淇℃伅澶辫触锛�";
+                    oCn.RollBack();
+                    return false;
+                }
+                else
+                {
+                    string sJson_MainCustom = "";    //涓昏〃鑷畾涔夊瓧娈�
+                    sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
+                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\",\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
+                        "\"Model\":{ " +
+                        //"FID": 0,
+                        "\"FBillNo\":\"" + oMain.HBillNo + "\"," +
+                        "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," +
+                        "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," +
+                        "\"FStockDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockDirect"]) + "\"," +
+                        "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
+                        "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," +
+                        "\"FDeptId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDeptId"]) + "\"}," +
+                        "\"FACCEPTANCE\":{\"FStaffNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FACCEPTANCE"]) + "\"}," +
+                        "\"FStockerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockerId"]) + "\"}," +
+                        "\"FSTOCKERGROUPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKERGROUPID"]) + "\"}," +
+                        "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," +
+                        "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," +
+                        "\"FNOTE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FNOTE"]) + "\"," +
+                        "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," +
+                        //"FScanBox": "",
+                        //"F_paez_Text": "",
+                        sJson_MainCustom +
+                        "\"FEntity\":[";
+                    string sJson_Entry = "";
+                    for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
+                    {
+                        if (sJson_Entry != "")
+                        {
+                            sJson_Entry = sJson_Entry + " , ";
+                        }
+                        string sJson_BatchNo = "";          //鎵瑰彿
+                        string sJson_StockPlace = "";       //浠撲綅
+                        string sJson_FAUXPROPID = "";       //杈呭姪灞炴��
+                        string sJson_FProduceDate = "";     //鐢熶骇鏃ユ湡
+                        string sJson_FExpiryDate = "";      //鏈夋晥鏈熻嚦
+                        string sJson_SubCustom = "";        //瀛愯〃鑷畾涔夊瓧娈�
+
+                        //瀛愯〃鑷畾涔夊瓧娈�
+                        sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]);
+                        //鏄惁鍚敤鎵规绠$悊
+                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1")
+                        {
+                            sJson_BatchNo = "  \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"},    \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"  , ";
+                        }
+                        else
+                        {
+                            sJson_BatchNo = "";
+                        }
+                        //浠撲綅
+                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) == "")
+                        {
+                            sJson_StockPlace = "";
+                        }
+                        else
+                        {
+                            sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},";
+                        }
+                        //杈呭姪灞炴��
+                        sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
+                        //鏄惁鍚敤淇濊川鏈熸帶鍒�
+                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1")
+                        {
+                            sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\",";
+                            sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\",";
+                        }
+                        else
+                        {
+                            sJson_FProduceDate = "";
+                            sJson_FExpiryDate = "";
+                        }
+
+                        sJson_Entry = sJson_Entry + "{" +
+                        //"FEntryID": 0,
+                        " \"FInStockType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInStockType"]) + "\"," +
+                        " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
+                        " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
+                        " \"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," +
+                        sJson_StockPlace +
+                        " \"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," +
+                        sJson_BatchNo +
+                        sJson_FAUXPROPID +
+                        //"F_TFKO_Assistant2": {
+                        //            "FNumber": ""
+                        //},
+                        //"F_TFKO_Assistant": {
+                        //            "FNumber": ""
+                        //},
+                        //"F_TFKO_Assistant1": {
+                        //            "FNumber": ""
+                        //},
+                        //"F_TFKO_Assistant3": {
+                        //            "FNumber": ""
+                        //},
+                        //"F_TFKO_Text": "",
+                        //"F_TFKO_Text1": "",
+                        //"F_TFKO_Text2": "",
+                        //"F_TFKO_Text3": "",
+                        //"FExtAuxUnitQty": 0,
+                        " \"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," +
+                        //"FEntryNote": "",
+                        " \"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," +
+                        sJson_FProduceDate +
+                        sJson_FExpiryDate +
+                        " \"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," +
+                        " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," +
+                        " \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," +
+                        " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
+                        " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," +
+                        " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
+                        " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," +
+                        " \"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," +
+                        " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," +
+                        " \"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," +
+                        " \"FSECUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSECUNITID"]) + "\"}," +
+                        " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," +
+                        sJson_SubCustom +
+
+                        //"FSerialSubEntity": [
+                        //    {
+                        //            "FDetailID": 0,
+                        //        "FSerialNo": "",
+                        //        "FSerialNote": ""
+                        //    }
+                        //]
+
+                        " \"FEntity_Link\": [{" +
+                            " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," +
+                            " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," +
+                            " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," +
+                            " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," +
+                            " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," +
+                            " \"FEntity_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," +
+                            " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" +
+                        " } ]   }  ";
+                    }
+                    string sJson_End = "  ]  }}";
+                    string sJson = sJson_Main + sJson_Entry + sJson_End;
+
+                    //浠庨厤缃枃浠惰幏鍙� 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)
+                    {
+                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
+                        new object[] { "STK_MISCELLANEOUS", sJson });
+
+                        if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                            var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
+                            new object[] { "STK_MISCELLANEOUS", sJson2 });
+
+                            string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                            var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                            new object[] { "STK_MISCELLANEOUS", sJson3 });
+
+                            HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString();
+                        }
+                        else
+                        {
+                            HReturn = result.ToString();
+                        }
+                        if (HReturn.Contains("\"IsSuccess\":false") == true)
+                        {
+                            sErrMsg = "鐢熸垚鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + HReturn + sJson;
+                            oCn.RollBack();
+                            return false;
+                        }
+                        else
+                        {
+                            oCn.Commit();
+                            return true;
+                        }
+                    }
+                    else
+                    {
+                        sErrMsg = "鐢熸垚鍏朵粬鍏ュ簱鍗曞け璐ワ紒閲戣澏浜戠櫥褰曞け璐ワ紒";
+                        oCn.RollBack();
+                        return false;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + e.Message;
+                oCn.RollBack();
+                return false;
+            }
+        }
+
+        #endregion
+
+        #region 鍏朵粬鍏ュ簱    鏍¢獙妯″紡*
+
+        //鏍¢獙鍏跺畠鍏ュ簱 
+        [WebMethod]
+        public bool set_SaveOtherInBill_BillCheck(Model.ClsKf_OtherInBillMain oMain, ref string sErrMsg)
+        {
+            if (set_SaveOtherInBill_CLD_BillCheck(oMain, ref sErrMsg) == true)
+            {
+                //涓婁紶鎴愬姛
+                return true;
+            }
+            else
+            {
+                //涓婁紶澶辫触
+                sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涗笂浼犲崟鎹け璐ワ紒" + sErrMsg;
+                return false;
+            }
+        }
+
+        public bool set_SaveOtherInBill_CLD_BillCheck(Model.ClsKf_OtherInBillMain oMain, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            //鑾峰彇绯荤粺鍙傛暟
+            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
+            {
+                sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                return false;
+            }
+            //涓婁紶鍓嶅垽鏂�
+            DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_OtherInBillCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "','" + oSystemParameter.omodel.Kf_OtherInBillCheck_MustQtyCtl + "'", "h_p_WMS_BeforeUpload_OtherInBillCheck");
+            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_Insert_New " + 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"]);
+                }
+
+                if (oSystemParameter.omodel.Kf_OtherInBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹")
+                {
+                    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[] { "STK_MISCELLANEOUS", sJson2 });
+                        //瀹℃牳鍗曟嵁
+                        string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                        var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                        new object[] { "STK_MISCELLANEOUS", sJson3 });
+
+                        HReturn = result3.ToString();
+
+                        if (HReturn.Contains("\"IsSuccess\":false") == true)
+                        {
+                            sErrMsg = "瀹℃牳鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + HReturn;
+                            oCn.RollBack();
+                            return false;
+                        }
+                        else
+                        {
+                            oCn.Commit();
+                            return true;
+                        }
+                    }
+                    else
+                    {
+                        sErrMsg = "鏍¢獙瀹℃牳鍏朵粬鍏ュ簱鍗曞け璐ワ紒閲戣澏浜戠櫥褰曞け璐ワ紒";
+                        oCn.RollBack();
+                        return false;
+                    }
+                }
+                else
+                {
+                    //鏍规嵁TMP琛� 杩斿洖 淇敼淇℃伅
+                    DataSet Ds2;
+                    Ds2 = oCn.RunProcReturn("exec h_p_Kf_GetOtherInBillCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetOtherInBillCheck");
+                    if (Ds2 == null || Ds2.Tables[0].Rows.Count == 0 || Ds2.Tables[1].Rows.Count == 0)
+                    {
+                        sErrMsg = "鑾峰彇瀛愯〃淇℃伅澶辫触锛�";
+                        oCn.RollBack();
+                        return false;
+                    }
+                    else
+                    {
+                        string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[\"FEntity\",\"FQty\"]," +
+                            "\"NeedReturnFields\":[],\"IsDeleteEntry\":\"false\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
+                            "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
+                            "\"Model\":{ \"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[0].Rows[0]["FID"]) + "\"," +
+                            "\"FEntity\":[";
+                        string sJson_Entry = "";
+                        for (int i = 0; i < Ds2.Tables[1].Rows.Count; i++)
+                        {
+                            if (sJson_Entry != "")
+                            {
+                                sJson_Entry = sJson_Entry + " , ";
+                            }
+
+                            sJson_Entry = sJson_Entry + "{" +
+                            "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," +
+                            "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\" " +
+                            "}";
+                        }
+                        string sJson_End = "  ]  }}";
+                        string sJson = sJson_Main + sJson_Entry + sJson_End;
+
+                        //楠岃瘉鐢ㄦ埛淇℃伅
+                        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)
+                        {
+                            //淇敼鍗曟嵁
+                            var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
+                            new object[] { "STK_MISCELLANEOUS", sJson });
+
+                            HReturn = result.ToString();
+
+                            if (HReturn.Contains("\"IsSuccess\":false") == true)
+                            {
+                                sErrMsg = "淇敼鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + HReturn + sJson;
+                                oCn.RollBack();
+                                return false;
+                            }
+                            else
+                            {
+                                HReturn = "";
+                                //鎻愪氦鍗曟嵁
+                                string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                                var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
+                                new object[] { "STK_MISCELLANEOUS", sJson2 });
+                                //瀹℃牳鍗曟嵁
+                                string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
+                                var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
+                                new object[] { "STK_MISCELLANEOUS", sJson3 });
+
+                                HReturn = result3.ToString();
+
+                                if (HReturn.Contains("\"IsSuccess\":false") == true)
+                                {
+                                    sErrMsg = "鏍¢獙瀹℃牳鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + HReturn + sJson;
+                                    oCn.RollBack();
+                                    return false;
+                                }
+                                else
+                                {
+                                    //閲嶆柊鍚屾鍏朵粬鍏ュ簱鍗�
+                                    oCn.RunProc("exec h_p_IFCLD_ERPSourceBillToLocal_OtherIn '" + oMain.HBillNo + "'");
+                                    oCn.Commit();
+                                    return true;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            sErrMsg = "鏍¢獙瀹℃牳鍏朵粬鍏ュ簱鍗曞け璐ワ紒閲戣澏浜戠櫥褰曞け璐ワ紒";
+                            oCn.RollBack();
+                            return false;
+                        }
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鏍¢獙瀹℃牳鍏朵粬鍏ュ簱鍗曞け璐ワ紒" + e.Message;
                 oCn.RollBack();
                 return false;
             }
@@ -33183,8 +33706,8 @@
             }
             //钃濆瓧浜у搧鍏ュ簱銆佸璐叆搴撱�佸澶栧叆搴撱�佺敓浜ф眹鎶ワ紝鏍规嵁鐗╂枡鏉$爜寰楀埌瀵瑰簲婧愬崟淇℃伅锛岄潪澶氭簮鍗曟ā寮�
             //鏈壂鎻忔簮鍗曠殑鎯呭喌涓嬶紝绗竴娆℃壂鎻忕墿鏂欐潯鐮佽幏鍙栨簮鍗曚俊鎭苟瀛樺叆涓存椂琛�
-            //閲囪喘鍏ュ簱锛�1201锛夈�佷骇鍝佸叆搴擄紙1202锛夈�佸澶栧叆搴擄紙1210锛夈�佺敓浜ф眹鎶ワ紙3711锛�
-            if (SourceFlag == false && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210" || HBillType == "3711"))
+            //閲囪喘鍏ュ簱锛�1201锛夈�佷骇鍝佸叆搴擄紙1202锛夈�佸叾浠栧叆搴擄紙1203锛夈�佸澶栧叆搴擄紙1210锛夈�佺敓浜ф眹鎶ワ紙3711锛�
+            if (SourceFlag == false && (HBillType == "1201" || HBillType == "1202" || HBillType == "1203" || HBillType == "1210" || HBillType == "3711"))
             {
                 if (HSourceBillType != "-1")
                 {
@@ -33468,6 +33991,7 @@
                                 {
                                     dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0]["HMaterID"]);
                                     HQty = DBUtility.ClsPub.isDoule(ds6.Tables[0].Rows[0]["HQty"]);
+                                    sRelQty = HQty;
                                 }
                                 else
                                 {
@@ -35054,7 +35578,63 @@
 
         #endregion
 
-        
+
+
+
+        #region 鍏朵粬鍏ュ簱    鎵弿婧愬崟鏉$爜
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_OtherIn(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, 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_OtherInBill_MulSourceBill.ToUpper() == "Y") //绯荤粺鍙傛暟  鍏朵粬鍏ュ簱鍗�-澶氭簮鍗曟ā寮�
+            //{
+            //    sMulSourceFlag = 1;
+            //}
+
+            //灏嗘簮鍗曚俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
+            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)
+                {
+                    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.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"]);
+                    return oBar;
+                }
+                else
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return null;
+                }
+            }
+        }
+
+        #endregion
 
         #region 鐢熶骇棰嗘枡    鎵弿婧愬崟鏉$爜
 
@@ -36095,6 +36675,43 @@
 
         #endregion
 
+        #region 鎵弿鍗曟嵁鏉$爜      *鏍¢獙妯″紡
+
+        [WebMethod]
+        public Model.ClsKf_ICStockBill_WMS get_BillBarCode_BillCheck(string HBillNo, string HBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg)
+        {
+            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
+            //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+            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 + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�";
+                return null;
+            }
+            else
+            {
+                if (DBUtility.ClsPub.isLong(ds1.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"]);
+                    return oBar;
+                }
+                else
+                {
+                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
+                    return null;
+                }
+            }
+        }
+
+        #endregion
+
         #region 鎵弿鍗曟嵁鏉$爜      棰嗘枡鍑哄簱    *鏍¢獙妯″紡
 
         [WebMethod]
@@ -36262,26 +36879,40 @@
                         if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
                         {
                             //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                            DataSet dsTBarCode;
-                            string sBarCode_MX;
-                            dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " +
-                            " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum");
+                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                             if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                             {
-                                sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒";
+                                sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
                                 return null;
                             }
                             else
                             {
-                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                                 {
-                                    sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
-
-                                    //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                    if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
+                                    return null;
+                                }
+                                else
+                                {
+                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                     {
-                                        sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                        return null;
+                                        dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
+                                        dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
+                                        dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
+                                        dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
+                                        dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
+                                        dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
+                                        dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
+                                        dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
+                                        dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                                        dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+
+                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                        if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                        {
+                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                            return null;
+                                        }
                                     }
                                 }
                                 return oBar;
@@ -36291,7 +36922,7 @@
                         //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
                         {
                             //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                            if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                            if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
                             {
                                 sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
                                 return null;
@@ -36315,7 +36946,7 @@
 
         //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃
         [WebMethod]
-        public bool set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        public bool set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(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, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
@@ -36330,7 +36961,7 @@
             }
 
             //鍒ゆ柇鏄惁瀛樺湪鐩稿悓鏉$爜锛屽垽鏂槸鍚﹀惎鐢ㄤ竴娆℃壂鐮佹帶鍒讹紝鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓�
-            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck");
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck");
             if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
             {
                 sErrMsg = "鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓彂鐢熼敊璇紒";
@@ -36417,10 +37048,10 @@
             double sERPQty = 0;     //ERP搴撳瓨鏁伴噺
 
             //搴撳瓨鎺у埗-WMS璐熷簱瀛樻帶鍒�
-            if (oSystemParameterMain.WMS_WMSStockCtl == "Y")
+            if (omodel_View.HBarCodeType == "鍞竴鏉$爜" && oSystemParameterMain.WMS_WMSStockCtl == "Y")
             {
                 //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
-                DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP");
+                DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP");
                 if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0)
                 {
                     sErrMsg = "鍒ゆ柇WMS鏉$爜搴撳瓨锛屽彂鐢熼敊璇紒";
@@ -36438,7 +37069,7 @@
             }
 
             //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
-            DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
+            DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
             if (DsERP == null || DsERP.Tables[0].Rows.Count == 0)
             {
                 sErrMsg = "鍒ゆ柇ERP搴撳瓨锛屽彂鐢熼敊璇紒";
@@ -36512,7 +37143,7 @@
 
         //鎵弿鐗╂枡鏉$爜  瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃
         [WebMethod]
-        public bool set_SavePonderationBillMain_Temp_BarCode_BillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        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)
         {
             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
             DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
@@ -36520,9 +37151,9 @@
 
             double sRelQty = 0;
             string sBillTypeOneScan = "";   //鏄惁鍚敤涓�娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級
-            if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y")
+            if (HBillType == "1203" && oSystemParameterMain.Kf_OtherInBill_BillTypeOneScan == "Y")
             {
-                //鍏朵粬鍑哄簱鍗�
+                //鍏朵粬鍏ュ簱鍗�
                 sBillTypeOneScan = "Y";
             }
             else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBill_BillTypeOneScan == "Y")
@@ -36530,9 +37161,14 @@
                 //棰嗘枡鍑哄簱鍗�
                 sBillTypeOneScan = "Y";
             }
+            else if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y")
+            {
+                //鍏朵粬鍑哄簱鍗�
+                sBillTypeOneScan = "Y";
+            }
 
             //鍒ゆ柇鏄惁瀛樺湪鐩稿悓鏉$爜锛屽垽鏂槸鍚﹀惎鐢ㄤ竴娆℃壂鐮佹帶鍒讹紝鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓�
-            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_BillCheck");
+            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_BillCheck");
             if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
             {
                 sErrMsg = "鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓彂鐢熼敊璇紒";
@@ -36581,8 +37217,22 @@
                     sRelQty = omodel_View.HQty;
                 }
 
+                //鍏朵粬鍏ュ簱鏍¢獙锛屾牴鎹郴缁熷弬鏁帮細鍏朵粬鍏ュ簱鏍¢獙-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
+                if (HBillType == "1203" && (oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                {
+                    if (omodel_View.HSourceQty == 0)
+                    {
+                        sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                    else if (sRelQty > omodel_View.HSourceQty)
+                    {
+                        sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲婧愬崟鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                }
                 //棰嗘枡鍑哄簱鏍¢獙锛屾牴鎹郴缁熷弬鏁帮細棰嗘枡鍑哄簱鏍¢獙-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
-                if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                else if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
                 {
                     if (omodel_View.HSourceQty == 0)
                     {
@@ -36626,8 +37276,22 @@
                     sRelQty = omodel_View.HQty;
                 }
 
+                //鍏朵粬鍏ュ簱鏍¢獙锛屾牴鎹郴缁熷弬鏁帮細鍏朵粬鍏ュ簱鏍¢獙-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
+                if (HBillType == "1203" && (oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                {
+                    if (omodel_View.HSourceQty == 0)
+                    {
+                        sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                    else if (sRelQty > omodel_View.HSourceQty)
+                    {
+                        sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲婧愬崟鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�";
+                        return false;
+                    }
+                }
                 //棰嗘枡鍑哄簱鏍¢獙锛屾牴鎹郴缁熷弬鏁帮細棰嗘枡鍑哄簱鏍¢獙-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛�
-                if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
+                else if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "瀹屽叏绛変簬搴旀敹"))
                 {
                     if (omodel_View.HSourceQty == 0)
                     {
@@ -36667,10 +37331,10 @@
                 || HBillType == "1254")
             {
                 //搴撳瓨鎺у埗-WMS璐熷簱瀛樻帶鍒�
-                if (oSystemParameterMain.WMS_WMSStockCtl == "Y")
+                if (omodel_View.HBarCodeType == "鍞竴鏉$爜" && oSystemParameterMain.WMS_WMSStockCtl == "Y")
                 {
                     //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
-                    DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP");
+                    DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP");
                     if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0)
                     {
                         sErrMsg = "鍒ゆ柇WMS鏉$爜搴撳瓨锛屽彂鐢熼敊璇紒";
@@ -36688,7 +37352,7 @@
                 }
 
                 //鍒ゆ柇ERP搴撳瓨   杩斿洖ERP搴撳瓨鏁伴噺
-                DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
+                DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory");
                 if (DsERP == null || DsERP.Tables[0].Rows.Count == 0)
                 {
                     sErrMsg = "鍒ゆ柇ERP搴撳瓨锛屽彂鐢熼敊璇紒";
@@ -36720,7 +37384,7 @@
             else
             {
                 //鍒ゆ柇鏉$爜鎵弿鏁伴噺   杩斿洖鍓╀綑鏈壂鎻忔暟閲�
-                if (!tem.IsBarCode_New(sBarCode, HBillType, false, ref sRelQty, ref sErrMsg))
+                if (!tem.IsBarCode_New(omodel_View.HBarCode, HBillType, false, ref sRelQty, ref sErrMsg))
                 {
                     sErrMsg = sErrMsg;
                     return false;
@@ -36822,26 +37486,40 @@
                             if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
                             {
                                 //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                                DataSet dsTBarCode;
-                                string sBarCode_MX;
-                                dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " +
-                                " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum");
+                                DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                                 if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                                 {
-                                    sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒";
+                                    sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
                                     return null;
                                 }
                                 else
                                 {
-                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                    if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                                     {
-                                        sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
-
-                                        //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                        if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                        sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
+                                        return null;
+                                    }
+                                    else
+                                    {
+                                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                         {
-                                            sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                            return null;
+                                            dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
+                                            dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
+                                            dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
+                                            dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
+                                            dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
+                                            dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
+                                            dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
+                                            dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
+                                            dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                                            dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+
+                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                            if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                            {
+                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                                return null;
+                                            }
                                         }
                                     }
                                     return oBar;
@@ -36851,7 +37529,7 @@
                             //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
                             {
                                 //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
                                 {
                                     sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
                                     return null;
@@ -36891,26 +37569,40 @@
                                 if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜")
                                 {
                                     //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃
-                                    DataSet dsTBarCode;
-                                    string sBarCode_MX;
-                                    dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " +
-                                    " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum");
+                                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                                     if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                                     {
-                                        sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒";
+                                        sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�";
                                         return null;
                                     }
                                     else
                                     {
-                                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
+                                        if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                                         {
-                                            sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
-
-                                            //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                            if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                            sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
+                                            return null;
+                                        }
+                                        else
+                                        {
+                                            for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                             {
-                                                sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
-                                                return null;
+                                                dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]);
+                                                dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]);
+                                                dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]);
+                                                dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]);
+                                                dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]);
+                                                dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]);
+                                                dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]);
+                                                dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]);
+                                                dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
+                                                dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]);
+
+                                                //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
+                                                if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                                {
+                                                    sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
+                                                    return null;
+                                                }
                                             }
                                         }
                                         return oBar;
@@ -36920,7 +37612,7 @@
                                 //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜
                                 {
                                     //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
-                                    if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
+                                    if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg))
                                     {
                                         sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg;
                                         return null;
@@ -37015,51 +37707,16 @@
                         //鍗曟嵁鏉$爜
                         else if (sBarBillType == "婧愬崟鏉$爜")
                         {
-                            DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType");
-
-                            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                            oBar = get_BillBarCode_BillCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg);
+                            if (oBar == null)
                             {
-                                sErrMsg = "鎵�鎵崟鎹潯鐮佷笉灞炰簬褰撳墠妯″潡锛�";
+                                sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
                                 return null;
                             }
                             else
                             {
-                                sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
-                                //鍏朵粬鍑哄簱鍗� 婧愬崟锛氬叾浠栧嚭搴撳崟
-                                if (sBarBillName == "鍏朵粬鍑哄簱鍗�" && HBillType == "1206")
-                                {
-                                    oBar = get_BillBarCode_OtherOutCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg);
-                                    if (oBar == null)
-                                    {
-                                        sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        oBar.HBarType = "鍗曟嵁鏉$爜";
-                                        return oBar;
-                                    }
-                                }
-                                //棰嗘枡鍑哄簱鍗� 婧愬崟锛氶鏂欏嚭搴撳崟
-                                else if (sBarBillName == "棰嗘枡鍑哄簱鍗�" && HBillType == "1204")
-                                {
-                                    oBar = get_BillBarCode_MateOutCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg);
-                                    if (oBar == null)
-                                    {
-                                        sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg;
-                                        return null;
-                                    }
-                                    else
-                                    {
-                                        oBar.HBarType = "鍗曟嵁鏉$爜";
-                                        return oBar;
-                                    }
-                                }
-                                else
-                                {
-                                    sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝鎵�鎵潯鐮佸墠缂�涓嶅睘浜庡綋鍓嶆ā鍧楀崟鎹彿鍓嶇紑锛�";
-                                    return null;
-                                }
+                                oBar.HBarType = "鍗曟嵁鏉$爜";
+                                return oBar;
                             }
                         }
                         else

--
Gitblit v1.9.1