新增销售出库二次校验功能(原单据为扫码生成,审核时对原扫描的条码进行核对)
1个文件已修改
392 ■■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 392 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -17659,19 +17659,47 @@
        [WebMethod]
        public bool set_SaveSellOutBill_BillCheck(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
        {
            if (set_SaveSellOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true)
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBillByOrgID(oMain.HSTOCKORGID, ref sErrMsg) == false)
            {
                //上传成功
                return true;
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return false;
            }
            //原单据为扫码生成,对原扫描的条码进行核对
            if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
            {
                if (set_SaveSellOutBill_CLD_BillCheck_Verify(oMain, ref sErrMsg) == true)
                {
                    //上传成功
                    return true;
                }
                else
                {
                    //上传失败
                    sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";上传单据失败!" + sErrMsg;
                    return false;
                }
            }
            //原单据非扫码生成
            else
            {
                //上传失败
                sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";上传单据失败!" + sErrMsg;
                return false;
                if (set_SaveSellOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true)
                {
                    //上传成功
                    return true;
                }
                else
                {
                    //上传失败
                    sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";上传单据失败!" + sErrMsg;
                    return false;
                }
            }
        }
        //原单据非扫码生成
        private bool set_SaveSellOutBill_CLD_BillCheck(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -17701,12 +17729,8 @@
            try
            {
                oCn.BeginTran();
                if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl != "Y")
                {
                    //写入条码出入库表
                    oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
                }
                //写入条码出入库表
                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
                //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
@@ -17857,6 +17881,98 @@
                            return false;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                sErrMsg = "校验审核销售出库单失败!" + e.Message;
                oCn.RollBack();
                return false;
            }
        }
        //原单据为扫码生成,对原扫描的条码进行核对
        private bool set_SaveSellOutBill_CLD_BillCheck_Verify(Model.ClsKf_SellOutBillMain oMain, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            //上传前判断
            DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_SellOutBillCheck_Verify " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_BeforeUpload_SellOutBillCheck_Verify");
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "校验上传前判断,发生错误!";
                return false;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
                {
                    sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
            }
            try
            {
                oCn.BeginTran();
                //写入条码出入库校验表
                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Verify_Insert " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
                //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
                {
                    sErrMsg = Pub_Class.ClsPub.sExeReturnInfo;
                    return false;
                }
                //获取CLOUD账号密码
                string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName;
                string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd;
                DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID);
                if (ds11 == null || ds11.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]);
                    sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]);
                }
                //金蝶云审核单据
                string HReturn;
                ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl);
                string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
                bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
                if (bLogin)
                {
                    //提交单据
                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                    new object[] { "SAL_OUTSTOCK", sJson2 });
                    //审核单据
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "SAL_OUTSTOCK", sJson3 });
                    HReturn = result3.ToString();
                    if (HReturn.Contains("\"IsSuccess\":false") == true)
                    {
                        sErrMsg = "审核销售出库单失败!" + HReturn;
                        oCn.RollBack();
                        return false;
                    }
                    else
                    {
                        sErrMsg = "校验审核销售出库单成功!单据号为:" + oMain.HBillNo;
                        oCn.Commit();
                        return true;
                    }
                }
                else
                {
                    sErrMsg = "校验审核销售出库单失败!金蝶云登录失败!";
                    oCn.RollBack();
                    return false;
                }
            }
            catch (Exception e)
@@ -52188,43 +52304,44 @@
                sSourceBarCodeCtl = "Y";
            }
            //校验-是否进行源单对应条码核对('Y'为核对)
            //原单据为扫码生成,对原扫描的条码进行核对
            if (sSourceBarCodeCtl == "Y")
            {
                //将单据信息存入条码出入库临时表 KF_PonderationBillMain_Temp,单据对应条码信息写入条码出入库记录临时表 Kf_ICStockBillSub_WMS_Temp
                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                //将单据信息、单据对应条码信息写入条码出入库校验临时表KF_PonderationBillMain_Temp_Verify
                DataSet dsVerify = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
                if (dsVerify == null || dsVerify.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!";
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息写入条码出入库校验临时表失败!";
                    return null;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                    if (DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0][0]) == 0)
                    {
                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
                        oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                        oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
                        oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
                        oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
                        oBar.HInterID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HInterID"]);
                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HBillNo"]);
                        oBar.HWhID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HWhID"]);
                        oBar.HWhName = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HWhName"]);
                        oBar.HSPFlag = DBUtility.ClsPub.isBool(dsVerify.Tables[0].Rows[0]["HSPFlag"]);
                        oBar.HSPID = DBUtility.ClsPub.isLong(dsVerify.Tables[0].Rows[0]["HSPID"]);
                        oBar.HSPName = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HSPName"]);
                        return oBar;
                    }
                    else
                    {
                        sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                        sErrMsg = DBUtility.ClsPub.isStrNull(dsVerify.Tables[0].Rows[0]["HRemark"]);
                        return null;
                    }
                }
            }
            //原单据非扫码生成
            else
            {
                //将单据信息存入条码出入库临时表
                //将单据信息写入条码出入库临时表KF_PonderationBillMain_Temp
                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!";
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息写入条码出入库临时表失败!";
                    return null;
                }
                else
@@ -52242,7 +52359,7 @@
                    }
                    else
                    {
                        sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                        sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                        return null;
                    }
                }
@@ -52749,7 +52866,7 @@
        #region 扫描物料条码    *校验模式
        //扫描物料条码  存入条码出入库临时表
        //原单据非扫码生成,扫描物料条码  存入条码出入库临时表
        [WebMethod]
        public bool set_SavePonderationBillMain_Temp_BarCode_BillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
@@ -53286,7 +53403,7 @@
        #endregion
        #region 一键扫码        *校验模式
        #region 一键扫码(原单据非扫码生成)        *校验模式
        //一键扫码模式,根据条码前缀走 不同方法(仓库条码、仓位条码、单据号条码、物料条码)
        [WebMethod]
@@ -53593,20 +53710,187 @@
        #endregion
        #region 一键扫码(原单据为扫码生成,对原扫描的条码进行核对)        *校验模式
        //原单据为扫码生成,对原扫描的条码进行核对
        [WebMethod]
        public Model.ClsKf_ICStockBill_WMS get_BillBarCode_Verify(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, Double HQty, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
        {
            try
            {
                //获取系统参数
                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
                if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == false)
                {
                    sErrMsg = "获取系统参数失败! " + sErrMsg;
                    return null;
                }
                if (HBarCode.Trim() == "")
                {
                    sErrMsg = "条码不能为空,请扫描条码!";
                    return null;
                }
                else
                {
                    //判断条码是否含特殊符号 # ,如果含有则 拆分
                    string[] NewBarCode;
                    if (HBarCode.Contains("#"))
                    {
                        NewBarCode = HBarCode.Split(Convert.ToChar("#"));
                        HBarCode = NewBarCode[0];
                        if (HQty == 0)
                        {
                            HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]);
                        }
                    }
                }
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
                //根据系统参数,判断是否启用一键扫码模式,Y为启用
                //未启用,只扫描物料条码
                if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                {
                    //将单据信息、单据对应条码信息写入条码出入库校验临时表KF_PonderationBillMain_Temp_Verify
                    DataSet ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheckVerify " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString(), "h_p_WMS_AddBarCode_BillCheckVerify");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        sErrMsg = "单据号:" + HBillNo + ";扫描物料条码校验失败!";
                        return null;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                        {
                            oBar.HBarType = "物料条码";
                            return oBar;
                        }
                        else
                        {
                            sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                            return null;
                        }
                    }
                }
                //启用,根据条码前缀走不同方法(单据条码、物料条码)
                else
                {
                    //根据递入的条码前三位,判断条码类型(仓库条码、仓位条码、单据条码、物料条码)
                    string sBarCodePrefix = HBarCode.Substring(0, Math.Min(3, HBarCode.Length));//截取条码前三位字符串
                    DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
                    //无返回数据则为物料条码
                    if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                    {
                        //将单据信息、单据对应条码信息写入条码出入库校验临时表KF_PonderationBillMain_Temp_Verify
                        DataSet ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheckVerify " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "'," + HQty.ToString(), "h_p_WMS_AddBarCode_BillCheckVerify");
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                            sErrMsg = "单据号:" + HBillNo + ";扫描物料条码校验失败!";
                            return null;
                        }
                        else
                        {
                            if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                            {
                                oBar.HBarType = "物料条码";
                                return oBar;
                            }
                            else
                            {
                                sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                                return null;
                            }
                        }
                    }
                    //单据条码
                    else
                    {
                        string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
                        string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
                        //判断条码类型为 基础资料条码 或 源单条码
                        if(sBarBillType == "源单条码")
                        {
                            oBar = get_BillBarCode_BillCheck(HBillNo, HBillType, HMaker, HStockOrgID, ref sErrMsg);
                            if (oBar == null)
                            {
                                sErrMsg = "启用一键扫码模式," + sErrMsg;
                                return null;
                            }
                            else
                            {
                                oBar.HBarType = "单据条码";
                                return oBar;
                            }
                        }
                        else
                        {
                            sErrMsg = "启用一键扫码模式,所扫条码前缀不为单据条码前缀!";
                            return null;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                sErrMsg = e.Message + ";" + e.StackTrace;
                return null;
            }
        }
        #endregion
        #region 返回单据物料列表信息  *校验模式
        [WebMethod]
        public DataSet GetKf_PonderationBillMain_Temp_BillCheck(long HInterID, string sBillType, string sWhere)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck");
            if (DS == null)
            //获取系统参数
            string sErrMsg="";
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
            {
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return null;
            }
            string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
            if (sBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
            {
                //销售出库单
                sSourceBarCodeCtl = "Y";
            }
            //原单据为扫码生成,对原扫描的条码进行核对
            if (sSourceBarCodeCtl == "Y")
            {
                DataSet DSVerify = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_Verify " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_Verify");
                if (DSVerify == null)
                {
                    return null;
                }
                else
                {
                    return DSVerify;
                }
            }
            //原单据非扫码生成
            else
            {
                return DS;
                DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck");
                if (DS == null)
                {
                    return null;
                }
                else
                {
                    return DS;
                }
            }
        }
@@ -53670,14 +53954,48 @@
        public DataSet GetKf_PonderationBillMain_TempList_BillCheck(string sHBillType, string sHMaker, Int64 sHOWNERID)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck");
            if (Ds == null)
            //获取系统参数
            string sErrMsg = "";
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
            {
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return null;
            }
            string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
            if (sHBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
            {
                //销售出库单
                sSourceBarCodeCtl = "Y";
            }
            //原单据为扫码生成,对原扫描的条码进行核对
            if (sSourceBarCodeCtl == "Y")
            {
                DataSet DSVerify = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_Verify '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_Verify");
                if (DSVerify == null)
                {
                    return null;
                }
                else
                {
                    return DSVerify;
                }
            }
            //原单据非扫码生成
            else
            {
                return Ds;
                DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck");
                if (Ds == null)
                {
                    return null;
                }
                else
                {
                    return Ds;
                }
            }
        }