yxj
2022-07-05 7e5eba04d0518ad7fe842240f6c7c56d707a9a00
森楷增加一键扫码模式
1个文件已修改
616 ■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 616 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -34294,86 +34294,350 @@
                //其他入库、其他出库  森楷专用
                else if ((HBillType == "1203" || HBillType == "1206") && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数  客户定制化名称     空白为通用
                {
                    //根据单个条码获取对应整托条码信息写入条码出入库临时表
                    string sBarCode_New;
                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','整托扫码'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                    if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                    //判断是否启用一键扫码模式,Y为启用,未启用时只扫描物料条码
                    if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                    {
                        sErrMsg = "获取整托条码信息发生错误!";
                        return null;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                        //根据单个条码获取对应整托条码信息写入条码出入库临时表
                        string sBarCode_New;
                        DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','整托扫码'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                        {
                            sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                            return null;
                        }
                        else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                        {
                            sErrMsg = "此模块不允许反向拆码!";
                            sErrMsg = "获取整托条码信息发生错误!";
                            return null;
                        }
                        else
                        {
                            if (HBillType == "1203")
                            if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                            {
                                HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
                                HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
                                //oBar = get_SourceBarCode_OtherIn(HBillID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HOWNERID, ref sErrMsg);
                                //if (oBar == null)
                                //{
                                //    return null;
                                //}
                                //SourceFlag = true;
                                sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                                return null;
                            }
                            else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                            {
                                sErrMsg = "此模块不允许反向拆码!";
                                return null;
                            }
                            else
                            {
                                if (HBillType == "1203")
                                {
                                    HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
                                    HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
                                Int64 sMulSourceFlag = 0;   //多源单标志(0为非多源单模式,1为多源单模式)
                                if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数  其他入库单-多源单模式
                                {
                                    sMulSourceFlag = 1;
                                }
                                //将源单信息存入条码出入库临时表
                                DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
                                if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
                                {
                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!";
                                    return null;
                                }
                                else
                                {
                                    if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
                                    Int64 sMulSourceFlag = 0;   //多源单标志(0为非多源单模式,1为多源单模式)
                                    if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数  其他入库单-多源单模式
                                    {
                                        SourceFlag = true;
                                        sMulSourceFlag = 1;
                                    }
                                    //将源单信息存入条码出入库临时表
                                    DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
                                    if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
                                    {
                                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!";
                                        return null;
                                    }
                                    else
                                    {
                                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
                                        if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
                                        {
                                            SourceFlag = true;
                                        }
                                        else
                                        {
                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
                                            return null;
                                        }
                                    }
                                }
                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                {
                                    sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                    if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                    {
                                        oBar.HSourceBillType = sHSourceBillType;
                                        oBar.HSourceBillNo = sHSourceBillNo;
                                        oBar.HSupID = sHSupID;
                                        oBar.HSupName = sHSupName;
                                        oBar.HDeptID = sHDeptID;
                                        oBar.HDeptName = sHDeptName;
                                    }
                                    else
                                    {
                                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                        return null;
                                    }
                                }
                            }
                            return oBar;
                        }
                    }
                    //一键扫码模式,根据条码前缀走 不同方法(仓库、仓位、部门)(源单、物料条码)
                    else
                    {
                        string sRedBlue = "蓝字";
                        if (HRedBlueFlag)
                        {
                            sRedBlue = "红字";
                        }
                        else
                        {
                            sRedBlue = "蓝字";
                        }
                        DataSet Dss;
                        //根据递入的条码前三位,判断条码类型(仓库、仓位、部门、源单、物料条码)
                        Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
                            for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                        //无返回数据则为物料条码
                        if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                        {
                            //根据单个条码获取对应整托条码信息写入条码出入库临时表
                            string sBarCode_New;
                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','整托扫码'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                            {
                                sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                sErrMsg = "获取整托条码信息发生错误!";
                                return null;
                            }
                            else
                            {
                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                                {
                                    oBar.HSourceBillType = sHSourceBillType;
                                    oBar.HSourceBillNo = sHSourceBillNo;
                                    oBar.HSupID = sHSupID;
                                    oBar.HSupName = sHSupName;
                                    oBar.HDeptID = sHDeptID;
                                    oBar.HDeptName = sHDeptName;
                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                                    return null;
                                }
                                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                                {
                                    sErrMsg = "此模块不允许反向拆码!";
                                    return null;
                                }
                                else
                                {
                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                    if (HBillType == "1203")
                                    {
                                        HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]);
                                        HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]);
                                        Int64 sMulSourceFlag = 0;   //多源单标志(0为非多源单模式,1为多源单模式)
                                        if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数  其他入库单-多源单模式
                                        {
                                            sMulSourceFlag = 1;
                                        }
                                        //将源单信息存入条码出入库临时表
                                        DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn");
                                        if (dsyd == null || dsyd.Tables[0].Rows.Count == 0)
                                        {
                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!";
                                            return null;
                                        }
                                        else
                                        {
                                            if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0)
                                            {
                                                SourceFlag = true;
                                            }
                                            else
                                            {
                                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]);
                                                return null;
                                            }
                                        }
                                    }
                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                    {
                                        sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                        if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                        {
                                            oBar.HSourceBillType = sHSourceBillType;
                                            oBar.HSourceBillNo = sHSourceBillNo;
                                            oBar.HSupID = sHSupID;
                                            oBar.HSupName = sHSupName;
                                            oBar.HDeptID = sHDeptID;
                                            oBar.HDeptName = sHDeptName;
                                        }
                                        else
                                        {
                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                            return null;
                                        }
                                    }
                                }
                                return oBar;
                            }
                        }
                        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 == "基础资料条码")
                            {
                                //仓库条码
                                if (sBarBillName == "仓库")
                                {
                                    DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
                                    //将递入的条码去掉前三位后转化成整形,TryParse不能转换成整数时返回false,并返回ID=0
                                    int ID;
                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
                                    {
                                        if (dal.GetInfoByID(ID, HOWNERID))
                                        {
                                            oBar.HBarType = "仓库条码";
                                            oBar.HWhID = dal.omodel.HItemID;
                                            oBar.HWhNumber = dal.omodel.HNumber;
                                            oBar.HWhName = dal.omodel.HName;
                                            oBar.HSPFlag = dal.omodel.HIsStockMgr;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效仓库条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的仓库条码!";
                                        return null;
                                    }
                                }
                                //仓位条码
                                else if (sBarBillName == "仓位")
                                {
                                    DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
                                    //将递入的条码去掉前三位后转化成整形
                                    int sHSPID;
                                    int sHWHID;
                                    string[] sArray = sBarCode.Remove(0, 3).Split(';');
                                    if (int.TryParse(sArray[1], out sHSPID) && int.TryParse(sArray[0], out sHWHID))
                                    {
                                        if (dal.GetInfoByID(sHSPID, sHWHID, HOWNERID))
                                        {
                                            oBar.HBarType = "仓位条码";
                                            oBar.HSPID = dal.omodel.HItemID;
                                            oBar.HSPNumber = dal.omodel.HNumber;
                                            oBar.HSPName = dal.omodel.HName;
                                            oBar.HWhID = dal.omodel.HWHID;
                                            oBar.HWhNumber = dal.omodel.HWhNumber;
                                            oBar.HWhName = dal.omodel.HWhName;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效仓位条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的仓位条码!";
                                        return null;
                                    }
                                }
                                //部门条码
                                else if (sBarBillName == "部门")
                                {
                                    DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
                                    //将递入的条码去掉前三位后转化成整形
                                    int ID;
                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
                                    {
                                        if (dal.GetInfoByID(ID))
                                        {
                                            oBar.HBarType = "部门条码";
                                            oBar.HDeptID = dal.omodel.HItemID;
                                            oBar.HDeptNumber = dal.omodel.HNumber;
                                            oBar.HDeptName = dal.omodel.HName;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效部门条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的部门条码!";
                                        return null;
                                    }
                                }
                                else
                                {
                                    sErrMsg = "无效基础资料条码!";
                                    return null;
                                }
                            }
                            //源单条码
                            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)
                                {
                                    sErrMsg = "所扫源单条码不属于此模块源单范围!";
                                    return null;
                                }
                                else
                                {
                                    sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
                                    //扫描源单条码时判断是否已经扫描过源单信息
                                    if (SourceFlag)
                                    {
                                        sErrMsg = "明细信息列表已有扫码记录,不允许多次扫描源单条码!";
                                        return null;
                                    }
                                    else
                                    {
                                        if (sBarBillName == "发货通知单" && HBillType == "1205")
                                        {
                                            DAL.Cls_S_IF_SeOutStockBill_Lite dal = new DAL.Cls_S_IF_SeOutStockBill_Lite();
                                            DataSet DS;
                                            //根据单据号获取过滤条件
                                            string sWhere = " Where 单据号 like '" + sBarCode + "'";
                                            DS = dal.DisSourceBillList(sWhere);
                                            if (DS == null || DS.Tables[0].Rows.Count <= 0)
                                            {
                                                sErrMsg = "没有返回任何记录!";
                                                return null;
                                            }
                                            oBar.HBarType = "源单条码";
                                            oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
                                            oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
                                            oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
                                            oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
                                            oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
                                            oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
                                            oBar.HCustom = Convert.ToString(DS.Tables[0].Rows[0]["HCustom"]);
                                        }
                                        else
                                        {
                                            sErrMsg = "源单类型名称设置不正确!";
                                            return null;
                                        }
                                        // 将源单信息写入 临时缓存表
                                        if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg))
                                        {
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "保存源单信息失败!" + sErrMsg;
                                            return null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                sErrMsg = "无效条码类型!";
                                return null;
                            }
                        }
                        return oBar;
                    }
                }
                //生产入库  多源单模式
@@ -36304,49 +36568,237 @@
                //销售出库  森楷专用
                else if (HBillType == "1205" && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数  客户定制化名称     空白为通用
                {
                    //根据单个条码获取对应整托条码信息写入条码出入库临时表
                    string sBarCode_New;
                    DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                    if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                    //判断是否启用一键扫码模式,Y为启用,未启用时只扫描物料条码
                    if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
                    {
                        sErrMsg = "获取整托条码信息发生错误!";
                        return null;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                        //根据单个条码获取对应整托条码信息写入条码出入库临时表
                        string sBarCode_New;
                        DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                        if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                        {
                            sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                            sErrMsg = "获取整托条码信息发生错误!";
                            return null;
                        }
                        else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                        {
                            oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                            return oBar;
                        }
                        else
                        {
                            for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                            if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                            {
                                sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                                return null;
                            }
                            else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                            {
                                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                                return oBar;
                            }
                            else
                            {
                                for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                {
                                    oBar.HSourceBillType = sHSourceBillType;
                                    oBar.HSourceBillNo = sHSourceBillNo;
                                    oBar.HSupID = sHSupID;
                                    oBar.HSupName = sHSupName;
                                    oBar.HDeptID = sHDeptID;
                                    oBar.HDeptName = sHDeptName;
                                    SourceFlag = true;
                                    sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                    if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                    {
                                        oBar.HSourceBillType = sHSourceBillType;
                                        oBar.HSourceBillNo = sHSourceBillNo;
                                        oBar.HSupID = sHSupID;
                                        oBar.HSupName = sHSupName;
                                        oBar.HDeptID = sHDeptID;
                                        oBar.HDeptName = sHDeptName;
                                        SourceFlag = true;
                                    }
                                    else
                                    {
                                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                        return null;
                                    }
                                }
                            }
                            return oBar;
                        }
                    }
                    //一键扫码模式,根据条码前缀走 不同方法(仓库、仓位、部门)(源单、物料条码)
                    else
                    {
                        DataSet Dss;
                        //根据递入的条码前三位,判断条码类型(仓库、仓位、部门、源单、物料条码)
                        Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType");
                        //无返回数据则为物料条码
                        if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                        {
                            //根据单个条码获取对应整托条码信息写入条码出入库临时表
                            string sBarCode_New;
                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle");
                            if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                            {
                                sErrMsg = "获取整托条码信息发生错误!";
                                return null;
                            }
                            else
                            {
                                if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1)
                                {
                                    sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]);
                                    return null;
                                }
                                else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2)
                                {
                                    oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                                    return oBar;
                                }
                                else
                                {
                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                    {
                                        sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                        if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                        {
                                            oBar.HSourceBillType = sHSourceBillType;
                                            oBar.HSourceBillNo = sHSourceBillNo;
                                            oBar.HSupID = sHSupID;
                                            oBar.HSupName = sHSupName;
                                            oBar.HDeptID = sHDeptID;
                                            oBar.HDeptName = sHDeptName;
                                            SourceFlag = true;
                                        }
                                        else
                                        {
                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg;
                                            return null;
                                        }
                                    }
                                }
                                return oBar;
                            }
                        }
                        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 == "基础资料条码")
                            {
                                //仓库条码
                                if (sBarBillName == "仓库")
                                {
                                    DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
                                    //将递入的条码去掉前三位后转化成整形,TryParse不能转换成整数时返回false,并返回ID=0
                                    int ID;
                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
                                    {
                                        if (dal.GetInfoByID(ID, HOWNERID))
                                        {
                                            oBar.HBarType = "仓库条码";
                                            oBar.HWhID = dal.omodel.HItemID;
                                            oBar.HWhNumber = dal.omodel.HNumber;
                                            oBar.HWhName = dal.omodel.HName;
                                            oBar.HSPFlag = dal.omodel.HIsStockMgr;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效仓库条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的仓库条码!";
                                        return null;
                                    }
                                }
                                //仓位条码
                                else if (sBarBillName == "仓位")
                                {
                                    DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
                                    //将递入的条码去掉前三位后转化成整形
                                    int sHSPID;
                                    int sHWHID;
                                    string[] sArray = sBarCode.Remove(0, 3).Split(';');
                                    if (int.TryParse(sArray[1], out sHSPID) && int.TryParse(sArray[0], out sHWHID))
                                    {
                                        if (dal.GetInfoByID(sHSPID, sHWHID, HOWNERID))
                                        {
                                            oBar.HBarType = "仓位条码";
                                            oBar.HSPID = dal.omodel.HItemID;
                                            oBar.HSPNumber = dal.omodel.HNumber;
                                            oBar.HSPName = dal.omodel.HName;
                                            oBar.HWhID = dal.omodel.HWHID;
                                            oBar.HWhNumber = dal.omodel.HWhNumber;
                                            oBar.HWhName = dal.omodel.HWhName;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效仓位条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的仓位条码!";
                                        return null;
                                    }
                                }
                                //部门条码
                                else if (sBarBillName == "部门")
                                {
                                    DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
                                    //将递入的条码去掉前三位后转化成整形
                                    int ID;
                                    if (int.TryParse(sBarCode.Remove(0, 3), out ID))
                                    {
                                        if (dal.GetInfoByID(ID))
                                        {
                                            oBar.HBarType = "部门条码";
                                            oBar.HDeptID = dal.omodel.HItemID;
                                            oBar.HDeptNumber = dal.omodel.HNumber;
                                            oBar.HDeptName = dal.omodel.HName;
                                            return oBar;
                                        }
                                        else
                                        {
                                            sErrMsg = "无效部门条码!";
                                            return null;
                                        }
                                    }
                                    else
                                    {
                                        sErrMsg = "错误的部门条码!";
                                        return null;
                                    }
                                }
                                else
                                {
                                    sErrMsg = "无效基础资料条码!";
                                    return null;
                                }
                            }
                            //源单条码
                            else if (sBarBillType == "源单条码")
                            {
                                if (sBarBillName == "发货通知单")
                                {
                                    oBar = get_SourceBarCode_SellOut(HBillID, HBillNo, HBillType, sBarCode, "1402", HMaker, 0, HOWNERID, ref sErrMsg);
                                    if (oBar == null)
                                    {
                                        return null;
                                    }
                                    return oBar;
                                }
                                else
                                {
                                    sErrMsg = "源单类型名称设置不正确!";
                                    return null;
                                }
                            }
                            else
                            {
                                sErrMsg = "无效条码类型!";
                                return null;
                            }
                        }
                        return oBar;
                    }
                }
                //生产入库  多源单模式