CLOUDWEB/WebService1.asmx.cs
@@ -24917,7 +24917,6 @@
                if (SaveProductInBill_ICMO_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
                {
                    //"保存成功!";
                    sErrMsg = "保存成功!" + oMain.HBillNo;
                    return true;
                }
                else
@@ -24932,7 +24931,6 @@
                if (SaveProductInBill_ICMOReport_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
                {
                    //"保存成功!";
                    sErrMsg = "保存成功!" + oMain.HBillNo;
                    return true;
                }
                else
@@ -24957,7 +24955,32 @@
        /// <returns></returns>
        public bool SaveProductInBill_ICMO_CLD(Model.ClsKf_ProductInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务;
            //从配置文件获取 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);
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            try
            {
                //判断会计期是否合理
@@ -24993,12 +25016,6 @@
                //更新关联数量
                oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + oMain.HInterID.ToString());
                if (oSystemParameterMain.Kf_ProductInBill_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_GetProductInBill_ICMO_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ICMO_CLD_New");
@@ -25010,6 +25027,17 @@
                }
                else
                {
                    string sCheckFlag = "";         //是否审核标志
                    string sJson_MainCustom = "";   //主表自定义字段
                    //根据组织获取是否审核标志,返回 不为空,获取对应组织 是否审核标志
                    sCheckFlag = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckFlag"]);
                    if (sCheckFlag != "")
                    {
                        oSystemParameterMain.Kf_ProductInBill_AutoCheck = sCheckFlag;
                    }
                    sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
                        "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                        "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," +
@@ -25028,6 +25056,7 @@
                        //\"FCurrId\":{\"FNumber\":\"\"},
                        //\"FEntrustInStockId\":\"0\",
                        //\"FScanBox\":\"\",
                        sJson_MainCustom +
                        "\"FEntity\": [   ";
                    string sJson_Entry = "";
                    for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
@@ -25145,31 +25174,7 @@
                    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",
@@ -25178,22 +25183,8 @@
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  自动审核
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                            new object[] { "PRD_INSTOCK", sJson2 }); //提交单据
                        HReturn = result.ToString();
                            string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                            new object[] { "PRD_INSTOCK", sJson3 }); //审核单据
                            HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString();
                        }
                        else
                        {
                            HReturn = result.ToString();
                        }
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成生产入库单失败!" + HReturn + sJson;
@@ -25203,12 +25194,11 @@
                        else
                        {
                            oCn.Commit();
                            return true;
                        }
                    }
                    else
                    {
                        sErrMsg = "生成生产入库单失败!登录失败!";
                        sErrMsg = "生成生产入库单失败!金蝶云登录失败!";
                        oCn.RollBack();
                        return false;
                    }
@@ -25220,6 +25210,52 @@
                oCn.RollBack();
                return false;
            }
            if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  自动审核
            {
                try
                {
                    oCn.BeginTran();
                    //审核WMS单据
                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
                    //提交、审核金蝶云单据
                    HReturn = "";
                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                    new object[] { "PRD_INSTOCK", sJson2 }); //提交单据
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "PRD_INSTOCK", sJson3 }); //审核单据
                    HReturn = result2.ToString() + "," + result3.ToString();
                    if (HReturn.Contains("\"IsSuccess\":false") == true)
                    {
                        sErrMsg = "生成生产入库单成功,审核单据失败!" + HReturn;
                        oCn.RollBack();
                        return true;
                    }
                    else
                    {
                        sErrMsg = "生成并审核生产入库单成功!单据号为:" + oMain.HBillNo;
                        oCn.Commit();
                        return true;
                    }
                }
                catch (Exception e)
                {
                    sErrMsg = "审核生产入库单失败!" + e.Message;
                    oCn.RollBack();
                    return false;
                }
            }
            else
            {
                sErrMsg = "生成生产入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
        }
        /// <summary>
@@ -25230,7 +25266,32 @@
        /// <returns></returns>
        public bool SaveProductInBill_ICMOReport_CLD(Model.ClsKf_ProductInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务;
            //从配置文件获取 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);
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            try
            {
                //判断会计期是否合理
@@ -25266,12 +25327,6 @@
                //更新关联数量
                oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOReportToProductIn_Add " + oMain.HInterID.ToString());
                if (oSystemParameterMain.Kf_ProductInBill_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_GetProductInBill_ICMOReport_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ICMOReport_CLD_New");
@@ -25283,6 +25338,17 @@
                }
                else
                {
                    string sCheckFlag = "";         //是否审核标志
                    string sJson_MainCustom = "";   //主表自定义字段
                    //根据组织获取是否审核标志,返回 不为空,获取对应组织 是否审核标志
                    sCheckFlag = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckFlag"]);
                    if(sCheckFlag!="")
                    {
                        oSystemParameterMain.Kf_ProductInBill_AutoCheck = sCheckFlag;
                    }
                    sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
                        "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                        "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," +
@@ -25301,6 +25367,7 @@
                        //\"FCurrId\":{\"FNumber\":\"\"},
                        //\"FEntrustInStockId\":\"0\",
                        //\"FScanBox\":\"\",
                        sJson_MainCustom +
                        "\"FEntity\": [   ";
                    string sJson_Entry = "";
                    for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
@@ -25444,31 +25511,7 @@
                    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",
@@ -25477,22 +25520,8 @@
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  自动审核
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                            new object[] { "PRD_INSTOCK", sJson2 }); //提交单据
                        HReturn = result.ToString();
                            string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                            new object[] { "PRD_INSTOCK", sJson3 }); //审核单据
                            HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString();
                        }
                        else
                        {
                            HReturn = result.ToString();
                        }
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成生产入库单失败!" + HReturn + sJson;
@@ -25502,12 +25531,11 @@
                        else
                        {
                            oCn.Commit();
                            return true;
                        }
                    }
                    else
                    {
                        sErrMsg = "生成生产入库单失败!登录失败!";
                        sErrMsg = "生成生产入库单失败!金蝶云登录失败!";
                        oCn.RollBack();
                        return false;
                    }
@@ -25518,6 +25546,52 @@
                sErrMsg = "生成生产入库单失败!" + e.Message;
                oCn.RollBack();
                return false;
            }
            if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  自动审核
            {
                try
                {
                    oCn.BeginTran();
                    //审核WMS单据
                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
                    //提交、审核金蝶云单据
                    HReturn = "";
                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                    new object[] { "PRD_INSTOCK", sJson2 }); //提交单据
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "PRD_INSTOCK", sJson3 }); //审核单据
                    HReturn = result2.ToString() + "," + result3.ToString();
                    if (HReturn.Contains("\"IsSuccess\":false") == true)
                    {
                        sErrMsg = "生成生产入库单成功,审核单据失败!" + HReturn;
                        oCn.RollBack();
                        return true;
                    }
                    else
                    {
                        sErrMsg = "生成并审核生产入库单成功!单据号为:" + oMain.HBillNo;
                        oCn.Commit();
                        return true;
                    }
                }
                catch (Exception e)
                {
                    sErrMsg = "审核生产入库单失败!" + e.Message;
                    oCn.RollBack();
                    return false;
                }
            }
            else
            {
                sErrMsg = "生成生产入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
        }
@@ -32699,10 +32773,11 @@
            }
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //根据物料条码得到对应源单信息,非多源单模式,判断是否已有源单记录(单据类型=1203,其他入库单除外)
            if (SourceFlag || HBillType == "1203")
@@ -33256,10 +33331,11 @@
            }
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //根据条码获取条码信息,存在相同物料时自动获取一行源单信息
            DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
@@ -33764,10 +33840,11 @@
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //根据条码获取条码信息
            DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
@@ -34500,10 +34577,11 @@
            }
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //根据条码获取条码信息
@@ -34911,11 +34989,13 @@
            }
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
@@ -38571,10 +38651,11 @@
                {
                    //判断条码是否含特殊符号 # ,如果含有则 拆分
                    string[] NewBarCode;
                    if (sBarCode.CompareTo("#") > 0)
                    if (sBarCode.Contains("#"))
                    {
                        NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                        sBarCode = NewBarCode[0];
                        HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
                    }
                }
@@ -39050,7 +39131,7 @@
            #endregion
        #endregion
            //        #region 扫描物料条码调用方法
@@ -39406,9 +39487,9 @@
            //        #endregion
            #region 模具条码处理方法
        #region 模具条码处理方法
            #region 扫描模具源单条码
        #region 扫描模具源单条码
            [WebMethod]
        public Model.ClsKf_ICStockBill_Mould get_CheckTypeByMouldSource(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HHMaker, Int64 HOWNERID, ref string sErrMsg)
@@ -40134,10 +40215,11 @@
                {
                    //判断条码是否含特殊符号 # ,如果含有则 拆分
                    string[] NewBarCode;
                    if (sBarCode.CompareTo("#") > 0)
                    if (sBarCode.Contains("#"))
                    {
                        NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                        sBarCode = NewBarCode[0];
                        HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
                    }
                }
@@ -40231,15 +40313,22 @@
            Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp();
            double sRelQty = 0;
            string sBillTypeOneScan = "";   //是否启用一次扫码控制('Y'为启用)
            if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y")
            string sWHSPCtl = "Y";   //校验-是否校对仓库仓位('Y'为校对)
            if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBillCheck_WHSPCtl == "N")
            {
                //直接调拨单
                sBillTypeOneScan = "Y";
                sWHSPCtl = "N";
            }
            //判断是否存在相同条码,判断是否启用一次扫码控制,判断所扫条码是否在单据中
            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");
            string sMultilineCtl = "N";   //校验-多行相同物料自动拆分换行匹配('Y'为自动拆分)
            if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBillCheck_MultilineCtl == "Y")
            {
                //直接调拨单
                sMultilineCtl = "Y";
            }
            //判断是否存在相同条码,判断所扫条码是否在单据中
            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sWHSPCtl + "','" + sMultilineCtl + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck_New");
            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "判断所扫条码是否在单据中发生错误!";
@@ -40250,10 +40339,11 @@
                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                {
                    omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]);
                    omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
                    omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]);
                    omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
                    omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]);     //源单可扫数量
                    omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HSumQtyMust"]);     //HSumQtyMust为源单相同物料剩余可扫数量
                    HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                    HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                    HSCWHID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCWHID"]);
                    HSCSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCSPID"]);
                }
                else
                {
@@ -40332,11 +40422,12 @@
                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条码库存,发生错误!";
                    return false;
                    sRelQty = 0;
                }
                else
                {
                    HSCWHID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HWhID"]);
                    HSCSPID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HSPID"]);
                    sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]);
                    //判断扫描条码数量与条码库存数量
                    if (sRelQty > sWMSQty)
@@ -40373,45 +40464,101 @@
                return false;
            }
            oMain.HInterID = HBillID;
            oMain.HBillNo = HBillNo;
            oMain.HBillType = HBillType;
            oMain.HMaker = HMaker;
            oMain.HMaterID = omodel_View.HMaterID;
            oMain.HAuxPropID = omodel_View.HAuxPropID;
            oMain.HQty = sRelQty;
            oMain.HQtyMust = 0;
            oMain.HBarCode = omodel_View.HBarCode;
            oMain.HBatchNo = omodel_View.HBatchNo;
            oMain.HMTONo = omodel_View.HMTONo;
            oMain.HWhID = HWhID;
            oMain.HStockPlaceID = HSPID;
            oMain.HSCWHID = HSCWHID;
            oMain.HOutStockPlaceID = HSCSPID;
            oMain.HSourceInterID = omodel_View.HSourceInterID;
            oMain.HSourceEntryID = omodel_View.HSourceEntryID;
            oMain.HSourceBillNo = omodel_View.HSourceBillNo;
            oMain.HSourceBillType = HBillType;
            oMain.HRedBlueFlag = false;
            oMain.HPieceQty = 1;
            oMain.HSTOCKORGID = HOWNERID;
            oMain.HOWNERID = HOWNERID;
            if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y")
            {
                //直接调拨单
                //一次扫码控制,同一条码、同一单据类型,在WMS表和TEMP表里,只允许进行一次扫码
                DataSet dsOneScan = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan_New");
                if (dsOneScan == null || dsOneScan.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(dsOneScan.Tables[0].Rows[0][0]) == 1)
                    {
                        sErrMsg = DBUtility.ClsPub.isStrNull(dsOneScan.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
            }
            oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
                ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
                ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
                ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
                ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
                ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
                "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
                "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" +
                ",0,0,'" + oMain.HCusBarCode + "',0)");
            double sSumQty = 0;
            double sRemQty = 0;
            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {
                omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[i]["HQtyMust"]);   //存在相同物料时,其中一行源单剩余可扫数量
                sSumQty = sSumQty + omodel_View.HSourceQty;
                sRemQty = sRelQty - sSumQty;
                //数量
                //只存在一行数据时,数量=条码可扫数量
                if (ds1.Tables[0].Rows.Count==1)
                {
                    oMain.HQty = sRelQty;
                }
                //存在多行相同物料,条码剩余数量<所选行源单剩余可扫数量 或 所选行源单为最后一条数据时 ,数量=条码剩余数量
                else if (sRemQty <= 0 || (i == ds1.Tables[0].Rows.Count-1 && sRemQty > 0))
                {
                    oMain.HQty = sRemQty + omodel_View.HSourceQty;
                }
                //存在多行相同物料,条码剩余数量>所选行源单剩余可扫数量 ,数量=所选行源单剩余可扫数量
                else
                {
                    oMain.HQty = omodel_View.HSourceQty;
                }
                //条码条数
                if (i == 0)
                {
                    oMain.HPieceQty = 1;
                }
                else
                {
                    oMain.HPieceQty = 0;
                }
                oMain.HInterID = HBillID;
                oMain.HBillNo = HBillNo;
                oMain.HBillType = HBillType;
                oMain.HMaker = HMaker;
                oMain.HMaterID = omodel_View.HMaterID;
                oMain.HAuxPropID = omodel_View.HAuxPropID;
                oMain.HQtyMust = 0;
                oMain.HBarCode = omodel_View.HBarCode;
                oMain.HBatchNo = omodel_View.HBatchNo;
                oMain.HMTONo = omodel_View.HMTONo;
                oMain.HWhID = HWhID;
                oMain.HStockPlaceID = HSPID;
                oMain.HSCWHID = HSCWHID;
                oMain.HOutStockPlaceID = HSCSPID;
                oMain.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceInterID"]);
                oMain.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceEntryID"]);
                oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[i]["HSourceBillNo"]);
                oMain.HSourceBillType = HBillType;
                oMain.HRedBlueFlag = false;
                oMain.HSTOCKORGID = HOWNERID;
                oMain.HOWNERID = HOWNERID;
                oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                    "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
                    ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
                    ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
                    ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                    ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
                    ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
                    ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
                    " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                    "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                    "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                    ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
                    "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
                    "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" +
                    ",0,0,'" + oMain.HCusBarCode + "',0)");
                if (sRemQty <= 0)
                {
                    break;
                }
            }
            return true;
        }
@@ -40428,25 +40575,42 @@
            Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp();
            double sRelQty = 0;
            string sBillTypeOneScan = "";   //是否启用一次扫码控制('Y'为启用)
            if (HBillType == "1203" && oSystemParameterMain.Kf_OtherInBill_BillTypeOneScan == "Y")
            string sWHSPCtl = "Y";   //校验-是否校对仓库仓位('Y'为校对)
            if (HBillType == "1203")
            {
                //其他入库单
                sBillTypeOneScan = "Y";
                sWHSPCtl = "Y";
            }
            else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBill_BillTypeOneScan == "Y")
            else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBillCheck_WHSPCtl == "N")
            {
                //领料出库单
                sBillTypeOneScan = "Y";
                sWHSPCtl = "N";
            }
            else if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y")
            else if (HBillType == "1206")
            {
                //其他出库单
                sBillTypeOneScan = "Y";
                sWHSPCtl = "Y";
            }
            //判断是否存在相同条码,判断是否启用一次扫码控制,判断所扫条码是否在单据中
            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");
            string sMultilineCtl = "N";   //校验-多行相同物料自动拆分换行匹配('Y'为自动拆分)
            if (HBillType == "1203")
            {
                //其他入库单
                sMultilineCtl = "N";
            }
            else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBillCheck_MultilineCtl == "Y")
            {
                //领料出库单
                sMultilineCtl = "Y";
            }
            else if (HBillType == "1206")
            {
                //其他出库单
                sMultilineCtl = "N";
            }
            //判断是否存在相同条码,判断所扫条码是否在单据中
            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sWHSPCtl + "','" + sMultilineCtl + "'", "h_p_WMS_AddBarCode_BillCheck_New");
            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "判断所扫条码是否在单据中发生错误!";
@@ -40457,10 +40621,9 @@
                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                {
                    omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]);
                    omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
                    omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]);
                    omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
                    omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]);     //源单可扫数量
                    omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HSumQtyMust"]);     //HSumQtyMust为源单相同物料剩余可扫数量
                    HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                    HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                }
                else
                {
@@ -40615,11 +40778,12 @@
                    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条码库存,发生错误!";
                        return false;
                        sRelQty = 0;
                    }
                    else
                    {
                        HWhID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HWhID"]);
                        HSPID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HSPID"]);
                        sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]);
                        //判断扫描条码数量与条码库存数量
                        if(sRelQty> sWMSQty)
@@ -40669,43 +40833,100 @@
                }
            }
            oMain.HInterID = HBillID;
            oMain.HBillNo = HBillNo;
            oMain.HBillType = HBillType;
            oMain.HMaker = HMaker;
            oMain.HMaterID = omodel_View.HMaterID;
            oMain.HAuxPropID = omodel_View.HAuxPropID;
            oMain.HQty = sRelQty;
            oMain.HQtyMust = 0;
            oMain.HBarCode = omodel_View.HBarCode;
            oMain.HBatchNo = omodel_View.HBatchNo;
            oMain.HMTONo = omodel_View.HMTONo;
            oMain.HWhID = HWhID;
            oMain.HStockPlaceID = HSPID;
            oMain.HSourceInterID = omodel_View.HSourceInterID;
            oMain.HSourceEntryID = omodel_View.HSourceEntryID;
            oMain.HSourceBillNo = omodel_View.HSourceBillNo;
            oMain.HSourceBillType = HBillType;
            oMain.HRedBlueFlag = false;
            oMain.HPieceQty = 1;
            oMain.HSTOCKORGID = HOWNERID;
            oMain.HOWNERID = HOWNERID;
            //一次扫码控制,同一条码、同一单据类型,在WMS表和TEMP表里,只允许进行一次扫码
            if ((HBillType == "1203" && oSystemParameterMain.Kf_OtherInBill_BillTypeOneScan == "Y")
                || (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBill_BillTypeOneScan == "Y")
                || (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y"))
            {
                DataSet dsOneScan = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",0,0,'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan_New");
                if (dsOneScan == null || dsOneScan.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(dsOneScan.Tables[0].Rows[0][0]) == 1)
                    {
                        sErrMsg = DBUtility.ClsPub.isStrNull(dsOneScan.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
            }
            oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
                ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
                ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
                ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
                ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
                ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
                " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
                "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
                "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" +
                ",0,0,'" + oMain.HCusBarCode + "',0)");
            double sSumQty = 0;
            double sRemQty = 0;
            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {
                omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[i]["HQtyMust"]);   //存在相同物料时,其中一行源单剩余可扫数量
                sSumQty = sSumQty + omodel_View.HSourceQty;
                sRemQty = sRelQty - sSumQty;
                //数量
                //只存在一行数据时,数量=条码可扫数量
                if (ds1.Tables[0].Rows.Count == 1)
                {
                    oMain.HQty = sRelQty;
                }
                //存在多行相同物料,条码剩余数量<所选行源单剩余可扫数量 或 所选行源单为最后一条数据时 ,数量=条码剩余数量
                else if (sRemQty <= 0 || (i == ds1.Tables[0].Rows.Count - 1 && sRemQty > 0))
                {
                    oMain.HQty = sRemQty + omodel_View.HSourceQty;
                }
                //存在多行相同物料,条码剩余数量>所选行源单剩余可扫数量 ,数量=所选行源单剩余可扫数量
                else
                {
                    oMain.HQty = omodel_View.HSourceQty;
                }
                //条码条数
                if (i == 0)
                {
                    oMain.HPieceQty = 1;
                }
                else
                {
                    oMain.HPieceQty = 0;
                }
                oMain.HInterID = HBillID;
                oMain.HBillNo = HBillNo;
                oMain.HBillType = HBillType;
                oMain.HMaker = HMaker;
                oMain.HMaterID = omodel_View.HMaterID;
                oMain.HAuxPropID = omodel_View.HAuxPropID;
                oMain.HQtyMust = 0;
                oMain.HBarCode = omodel_View.HBarCode;
                oMain.HBatchNo = omodel_View.HBatchNo;
                oMain.HMTONo = omodel_View.HMTONo;
                oMain.HWhID = HWhID;
                oMain.HStockPlaceID = HSPID;
                oMain.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceInterID"]);
                oMain.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceEntryID"]);
                oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[i]["HSourceBillNo"]);
                oMain.HSourceBillType = HBillType;
                oMain.HRedBlueFlag = false;
                oMain.HSTOCKORGID = HOWNERID;
                oMain.HOWNERID = HOWNERID;
                oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                    "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
                    ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
                    ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
                    ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                    ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
                    ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
                    ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
                    " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() +
                    "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" +
                    "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" +
                    ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" +
                    "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" +
                    "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" +
                    ",0,0,'" + oMain.HCusBarCode + "',0)");
                if (sRemQty <= 0)
                {
                    break;
                }
            }
            return true;
        }
@@ -40736,10 +40957,11 @@
                {
                    //判断条码是否含特殊符号 # ,如果含有则 拆分
                    string[] NewBarCode;
                    if (sBarCode.CompareTo("#") > 0)
                    if (sBarCode.Contains("#"))
                    {
                        NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                        sBarCode = NewBarCode[0];
                        HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
                    }
                }
@@ -41028,6 +41250,56 @@
            else
            {
                return DS;
            }
        }
        #endregion
        #region 界面同步单据按钮调用方法    *校验模式
        [WebMethod]
        public bool set_UpdateTemp_BillCheck(Int64 HBillID, string HBillNo, string HBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg)
        {
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
            {
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return false;
            }
            string sWHSPCtl = "Y";   //校验-是否校对仓库仓位('Y'为校对)
            if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBillCheck_WHSPCtl == "N")
            {
                //领料出库单
                sWHSPCtl = "N";
            }
            else if (HBillType == "1207" && oSystemParameter.omodel.Kf_MoveStockBillCheck_WHSPCtl == "N")
            {
                //直接调拨单
                sWHSPCtl = "N";
            }
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_UpdateTemp_BillCheck " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString() + ",'" + sWHSPCtl + "'", "h_p_WMS_UpdateTemp_BillCheck");
            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "单据号:" + HBillNo + ";同步单据信息发生错误!";
                return false;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                {
                    sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                    return true;
                }
                else
                {
                    sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
            }
        }
@@ -41491,11 +41763,13 @@
            }
            //判断条码是否含特殊符号 # ,如果含有则 拆分
            string[] NewBarCode;
            if (sBarCode.CompareTo("#") > 0)
            if (sBarCode.Contains("#"))
            {
                NewBarCode = sBarCode.Split(Convert.ToChar("#"));
                sBarCode = NewBarCode[0];
                HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
            }
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)