yxj
2024-06-20 1e846aea31e8d7fd74dd134b5bf01b1b005baef8
斯莫尔条码解析调整
1个文件已修改
598 ■■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 598 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -49904,8 +49904,97 @@
                        }
                        else
                        {
                            //杭州斯莫尔,条码不存在,解析条码后执行扫码操作
                            if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔")
                            {
                                //解析条码
                                if (!GetJXBarCode_SiMoEr(sBarCode, HQty, ref sErrMsg))
                                {
                                    return null;
                                }
                                if (dal.GetInfoByBarCode_View(sBarCode))
                                {
                                    if (dal.omodel_View.HStopflag)
                                    {
                                        sErrMsg = "条码已被禁用,不允许扫描!";
                                        return null;
                                    }
                                    else
                                    {
                                        //判断条码类型是否为托盘条码,如果是托盘条码则分解并模拟扫码
                                        if (dal.omodel_View.HBarCodeType == "托盘条码")
                                        {
                                            //分解托盘条码得到明细条码信息写入条码出入库临时表
                                            DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                                            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
                                                {
                                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                                    {
                                                        dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                                        dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
                                                        dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
                                                        dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
                                                        dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
                                                        dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
                                                        dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
                                                        dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
                                                        dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
                                                        dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
                                                        //将物料条码信息写入条码出入库临时表
                                                        oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                                        if (oBar == null)
                                                        {
                                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + dal.omodel_View.HBarCode + sErrMsg;
                                                            return null;
                                                        }
                                                        SourceFlag = true;
                                                    }
                                                }
                                                return oBar;
                                            }
                                        }
                                        else
                                        //条码类型不为托盘条码
                                        {
                                            //将物料条码信息写入条码出入库临时表
                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                            if (oBar == null)
                                            {
                                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + sErrMsg;
                                                return null;
                                            }
                                            else
                                            {
                                                return oBar;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                            sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!";
                            return null;
                                }
                            }
                            else
                            {
                                sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!";
                                return null;
                            }
                        }
                    }
                }
@@ -49946,262 +50035,6 @@
                        }
                        else
                        {
                            if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔")
                            {
                                if (!dal.GetInfoByBarCode_View(sBarCode))
                                {
                                    //条码解析
                                    string[] str = sBarCode.Split('@');
                                    if (str[0] != "CMR")
                                    {
                                        sErrMsg = "条码解析失败,请确认条码是否正确!";
                                        return null;
                                    }
                                    int HOrgIDs = 0;
                                    //查询组织
                                    DataSet ds = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + str[1] + "' ", "Xt_ORGANIZATIONS");
                                    if (ds.Tables[0].Rows.Count == 0)
                                    {
                                        sErrMsg = "条码解析失败,请确认条码组织是否正确!";
                                        return null;
                                    }
                                    else
                                    {
                                        HOrgIDs = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
                                    }
                                    string HMaterNames = "";
                                    string HMaterModels = "";
                                    string HMaterIDs = "0";
                                    //查询物料
                                    ds = oCn.RunProcReturn("select  * from Gy_Material where HNumber='" + str[4] + "' and HUSEORGID=" + HOrgIDs, "Gy_Material");
                                    if (ds.Tables[0].Rows.Count == 0)
                                    {
                                        sErrMsg = "条码解析失败,请确认条码物料是否正确!";
                                        return null;
                                    }
                                    else
                                    {
                                        HMaterIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
                                        HMaterNames = ds.Tables[0].Rows[0]["HName"].ToString();
                                        HMaterModels = ds.Tables[0].Rows[0]["HModel"].ToString();
                                    }
                                    string HSupIDs = "0";
                                    //查询供应商
                                    ds = oCn.RunProcReturn("select * from Gy_Supplier where HNumber='" + str[2] + "' and HUSEORGID=" + HOrgIDs, "Gy_Supplier");
                                    if (ds.Tables[0].Rows.Count == 0)
                                    {
                                        //sErrMsg = "条码解析失败,请确认条码供应商是否正确!";
                                        //return null;
                                    }
                                    else
                                    {
                                        HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
                                    }
                                    string HSourceInterIDs = "0";
                                    string HSourceEntryIDs = "0";
                                    string HSourceBillNos = "0";
                                    string HUnitIDs = "0";
                                    //查询采购订单
                                    ds = oCn.RunProcReturn(@"select  a.HInterID,b.HEntryID,a.HBillNo,b.HUnitID from Cg_POOrderBillMain a
inner join Cg_POOrderBillSub b on a.HInterID = b.HInterID where HBillNo='" + str[3] + "' and b.HMaterID=" + HMaterIDs, "Cg_POOrderBillMain");
                                    if (ds.Tables[0].Rows.Count == 0)
                                    {
                                        //sErrMsg = "条码解析失败,请确认条码采购订单是否正确!";
                                        //return null;
                                    }
                                    else
                                    {
                                        HSourceInterIDs = ds.Tables[0].Rows[0]["HInterID"].ToString();
                                        HSourceEntryIDs = ds.Tables[0].Rows[0]["HEntryID"].ToString();
                                        HSourceBillNos = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                                        HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString();
                                    }
                                    string HInnerBillNos = "";
                                    //查询内部采购订单号
                                    ds = oCn.RunProcReturn(@" select * from h_v_IF_POInStockList where 采购订单号= '" + str[3] + "' ", "h_v_IF_POInStockList");
                                    if (ds.Tables[0].Rows.Count == 0)
                                    {
                                        HInnerBillNos = str[3];
                                        //HInnerBillNos = "9624";
                                        //sErrMsg = "条码解析失败,请确认条码内部采购订单号是否正确!";
                                        //return null;
                                    }
                                    else
                                    {
                                        HInnerBillNos = ds.Tables[0].Rows[0]["内部采购订单号"].ToString();
                                    }
                                    if (HQty == 0)
                                    {
                                        HQty = double.Parse(str[6]);
                                    }
                                    //日期获取方式
                                    string sDate = DateTime.Now.ToString();
                                    string HWei = "0";      //尾数
                                    string HBarCodeType = "批次条码";
                                    Int64 HMaterID = int.Parse(HMaterIDs);
                                    Int64 HAuxPropID = 0;
                                    Int64 HUnitID = int.Parse(HUnitIDs);
                                    double HQty2 = HQty;
                                    string HBatchNo2 = str[5];
                                    Int64 HSupID = int.Parse(HSupIDs);
                                    Int64 HGroupID = 0;
                                    int HPrintQty = 0;
                                    Int64 HSourceInterID = int.Parse(HSourceInterIDs);
                                    Int64 HSourceEntryID = int.Parse(HSourceEntryIDs);
                                    HSourceBillNo = HSourceBillNos;
                                    //HSourceBillType = "1102";
                                    Int64 HBarcodeNo = 0;       //托号
                                    Int64 HBarcodeQtys = 0;     //总托数
                                    Int64 HDeptID = 0;
                                    //Int64 HWhID = 0;
                                    //Int64 HSPID = 0;
                                    string HRemark = "条码解析";
                                    string HMaterName = HMaterNames;
                                    string HMaterModel = HMaterModels;
                                    string HPinfan = "";
                                    string HMTONo = "";
                                    Int64 HCusID = 0;
                                    string HCusType = "";
                                    DateTime HEndDate = DateTime.Now;
                                    string HWorkLineName = "";
                                    string HSeOrderBillNo = "";
                                    string HInnerBillNo = HInnerBillNos;
                                    bool HGiveAwayFlag = false;
                                    Int64 HEntryID = 1;
                                    Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
                                    int HOrgID = HOrgIDs;
                                    oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                                       ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                                                       ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                                                       ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                                                       ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                                       ",HGiveAwayFlag " +
                                                       ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                                                       ",HProduceDate,HExpiryDate " +
                                                       ") values ("
                                                       + "'" + sBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                                       + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
                                                       + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
                                                       + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                                                       + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                                                       + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + ""
                                                       + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
                                                       + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')");
                                }
                                if (dal.GetInfoByBarCode_View(sBarCode))
                                {
                                    HQty = dal.omodel_View.HQty;
                                    if (dal.omodel_View.HStopflag)
                                    {
                                        sErrMsg = "条码已被禁用,不允许扫描!";
                                        return null;
                                    }
                                    else
                                    {
                                        //判断条码类型是否为托盘条码,如果是托盘条码则分解并模拟扫码
                                        if (dal.omodel_View.HBarCodeType == "托盘条码")
                                        {
                                            if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔")
                                            {
                                                //分解托盘条码得到明细条码信息写入条码出入库临时表
                                                DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                                                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
                                                    {
                                                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                                        {
                                                            dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                                            dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
                                                            dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
                                                            dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
                                                            dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
                                                            dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
                                                            dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
                                                            dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
                                                            dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
                                                            dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
                                                            //将物料条码信息写入条码出入库临时表
                                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                                            if (oBar == null)
                                                            {
                                                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + dal.omodel_View.HBarCode + sErrMsg;
                                                                return null;
                                                            }
                                                            SourceFlag = true;
                                                        }
                                                    }
                                                    return oBar;
                                                }
                                            }
                                            else
                                            {
                                                //将托条码信息写入条码出入库临时表
                                                oBar = get_SavePonderationBillMain_Temp_PackBarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, 0, 0, SourceFlag, HSourceBillType, HStockOrgID, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                                if (oBar == null)
                                                {
                                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + sErrMsg;
                                                    return null;
                                                }
                                                else
                                                {
                                                    return oBar;
                                                }
                                            }
                                        }
                                        else
                                        //条码类型不为托盘条码
                                        {
                                            //将物料条码信息写入条码出入库临时表
                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                            if (oBar == null)
                                            {
                                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + sErrMsg;
                                                return null;
                                            }
                                            else
                                            {
                                                return oBar;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!";
                                    return null;
                                }
                            }
                            if (dal.GetInfoByBarCode_View(sBarCode))
                            {
                                if (dal.omodel_View.HStopflag)
@@ -50292,8 +50125,97 @@
                            }
                            else
                            {
                                //杭州斯莫尔,条码不存在,解析条码后执行扫码操作
                                if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔")
                                {
                                    //解析条码
                                    if (!GetJXBarCode_SiMoEr(sBarCode, HQty, ref sErrMsg))
                                    {
                                        return null;
                                    }
                                    if (dal.GetInfoByBarCode_View(sBarCode))
                                    {
                                        if (dal.omodel_View.HStopflag)
                                        {
                                            sErrMsg = "条码已被禁用,不允许扫描!";
                                            return null;
                                        }
                                        else
                                        {
                                            //判断条码类型是否为托盘条码,如果是托盘条码则分解并模拟扫码
                                            if (dal.omodel_View.HBarCodeType == "托盘条码")
                                            {
                                                //分解托盘条码得到明细条码信息写入条码出入库临时表
                                                DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode");
                                                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
                                                    {
                                                        for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                                        {
                                                            dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]);
                                                            dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]);
                                                            dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]);
                                                            dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]);
                                                            dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]);
                                                            dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]);
                                                            dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]);
                                                            dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]);
                                                            dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]);
                                                            dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]);
                                                            //将物料条码信息写入条码出入库临时表
                                                            oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                                            if (oBar == null)
                                                            {
                                                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + dal.omodel_View.HBarCode + sErrMsg;
                                                                return null;
                                                            }
                                                            SourceFlag = true;
                                                        }
                                                    }
                                                    return oBar;
                                                }
                                            }
                                            else
                                            //条码类型不为托盘条码
                                            {
                                                //将物料条码信息写入条码出入库临时表
                                                oBar = get_SavePonderationBillMain_Temp_BarCode(dal.omodel_View, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, SourceFlag, HSourceBillType, HStockOrgID, HCustom1, HCustom2, oSystemParameter.omodel, ref sErrMsg);
                                                if (oBar == null)
                                                {
                                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描失败!" + sErrMsg;
                                                    return null;
                                                }
                                                else
                                                {
                                                    return oBar;
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!";
                                return null;
                                    }
                                }
                                else
                                {
                                    sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!";
                                    return null;
                                }
                            }
                        }
                    }
@@ -52574,7 +52496,171 @@
        #endregion
        #region 斯莫尔条码解析
        [WebMethod]
        public bool GetJXBarCode_SiMoEr(string sBarCode, Double HQty, ref string sErrMsg)
        {
            try
            {
                //条码解析
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                string[] str = sBarCode.Split('@');
                if (str[0] != "CMR")
                {
                    sErrMsg = "条码解析失败,请确认条码是否正确!";
                    return false;
                }
                int HOrgIDs = 0;
                //查询组织
                DataSet ds = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HNumber='" + str[1] + "' ", "Xt_ORGANIZATIONS");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "条码解析失败,请确认条码组织是否正确!";
                    return false;
                }
                else
                {
                    HOrgIDs = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
                }
                string HMaterNames = "";
                string HMaterModels = "";
                string HMaterIDs = "0";
                //查询物料
                ds = oCn.RunProcReturn("select  * from Gy_Material with(nolock) where HNumber='" + str[4] + "' and HUSEORGID=" + HOrgIDs, "Gy_Material");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "条码解析失败,请确认条码物料是否正确!";
                    return false;
                }
                else
                {
                    HMaterIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
                    HMaterNames = ds.Tables[0].Rows[0]["HName"].ToString();
                    HMaterModels = ds.Tables[0].Rows[0]["HModel"].ToString();
                }
                string HSupIDs = "0";
                //查询供应商
                ds = oCn.RunProcReturn("select * from Gy_Supplier with(nolock) where HNumber='" + str[2] + "' and HUSEORGID=" + HOrgIDs, "Gy_Supplier");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //sErrMsg = "条码解析失败,请确认条码供应商是否正确!";
                    //return false;
                }
                else
                {
                    HSupIDs = ds.Tables[0].Rows[0]["HItemID"].ToString();
                }
                string HSourceInterIDs = "0";
                string HSourceEntryIDs = "0";
                string HSourceBillNos = "0";
                string HUnitIDs = "0";
                //查询采购订单
                ds = oCn.RunProcReturn(@"select  a.HInterID,b.HEntryID,a.HBillNo,b.HUnitID from Cg_POOrderBillMain a with(nolock) inner join Cg_POOrderBillSub b with(nolock) on a.HInterID = b.HInterID where HBillNo='" + str[3] + "' and b.HMaterID=" + HMaterIDs, "Cg_POOrderBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    //sErrMsg = "条码解析失败,请确认条码采购订单是否正确!";
                    //return false;
                }
                else
                {
                    HSourceInterIDs = ds.Tables[0].Rows[0]["HInterID"].ToString();
                    HSourceEntryIDs = ds.Tables[0].Rows[0]["HEntryID"].ToString();
                    HSourceBillNos = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    HUnitIDs = ds.Tables[0].Rows[0]["HUnitID"].ToString();
                }
                string HInnerBillNos = "";
                //查询内部采购订单号
                ds = oCn.RunProcReturn(@" select * from h_v_IF_POInStockList where 采购订单号= '" + str[3] + "' ", "h_v_IF_POInStockList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    HInnerBillNos = str[3];
                    //HInnerBillNos = "9624";
                    //sErrMsg = "条码解析失败,请确认条码内部采购订单号是否正确!";
                    //return false;
                }
                else
                {
                    HInnerBillNos = ds.Tables[0].Rows[0]["内部采购订单号"].ToString();
                }
                if (HQty == 0)
                {
                    HQty = double.Parse(str[6]);
                }
                //日期获取方式
                string sDate = DateTime.Now.ToString();
                string HWei = "0";      //尾数
                string HBarCodeType = "批次条码";
                Int64 HMaterID = int.Parse(HMaterIDs);
                Int64 HAuxPropID = 0;
                Int64 HUnitID = int.Parse(HUnitIDs);
                double HQty2 = HQty;
                string HBatchNo2 = str[5];
                Int64 HSupID = int.Parse(HSupIDs);
                Int64 HGroupID = 0;
                int HPrintQty = 0;
                Int64 HSourceInterID = int.Parse(HSourceInterIDs);
                Int64 HSourceEntryID = int.Parse(HSourceEntryIDs);
                string HSourceBillNo = HSourceBillNos;
                string HSourceBillType = "1102";
                Int64 HBarcodeNo = 0;       //托号
                Int64 HBarcodeQtys = 0;     //总托数
                Int64 HDeptID = 0;
                //Int64 HWhID = 0;
                //Int64 HSPID = 0;
                string HRemark = "条码解析";
                string HMaterName = HMaterNames;
                string HMaterModel = HMaterModels;
                string HPinfan = "";
                string HMTONo = "";
                Int64 HCusID = 0;
                string HCusType = "";
                DateTime HEndDate = DateTime.Now;
                string HWorkLineName = "";
                string HSeOrderBillNo = "";
                string HInnerBillNo = HInnerBillNos;
                bool HGiveAwayFlag = false;
                Int64 HEntryID = 1;
                Int64 HInterIDs = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
                int HOrgID = HOrgIDs;
                oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                            ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                            ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                            ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                            ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                            ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                            ",HGiveAwayFlag " +
                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                            ",HProduceDate,HExpiryDate " +
                            ") values ("
                            + "'" + sBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                            + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'admin',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
                            + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
                            + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + ",0,0,'" + HRemark + "'"
                            + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                            + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterIDs.ToString() + "," + HEntryID.ToString() + ""
                            + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
                            + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "','','')");
                return true;
            }
            catch (Exception e)
            {
                sErrMsg = e.Message + ";" + e.StackTrace;
                return false;
            }
        }
        #endregion
        #endregion