Esempio n. 1
0
        public string Process(string scanResult)
        {
            DbProcess dbProcess = new DbProcess(_configs.Value.oldcon, _configs.Value.newCon);
            var       dic       = dbProcess.Process(scanResult);
            var       res       = "";

            if (dic.Count > 0 && !String.IsNullOrEmpty(dic["Name"]))
            {
                res = JFPrintTemplate.GetDisplayString(dic["Barcode"], dic["chandi"], Convert.ToInt32(dic["CheckCount"]), dic["Name"], dic["Code"]);
            }
            else
            {
                res = "尊敬的用户,您好! 该产品不属于晚安生产的产品,请谨防假冒.(注:防伪验证支持湖南床垫2015年9月1日(佛山床垫10月1日丶晚安软床10月1日)/晚安家纺(2016年8月15日)之后生产贴标的产品!)";
            }


            return(res);
        }
        public static string Process(string scanResult)
        {
            string  res = "";
            string  sql = "select Barcode,v1,CheckCount from [BarCodeFangWei] where v2='" + scanResult + "'";
            DataSet ds  = DbHelperSQL.Query(sql);

            if (ds != null && ds.Tables.Count >= 1 && ds.Tables[0].Rows.Count >= 1)
            {
                res = "尊敬的用户,您好! 您扫描的条码【" + ds.Tables[0].Rows[0]["Barcode"].ToString() + "】属于晚安生产的产品,产地【" + ds.Tables[0].Rows[0]["v1"].ToString() + "】,扫描次数【" + (int.Parse(ds.Tables[0].Rows[0]["CheckCount"].ToString()) + 1) + "】次,请谨防假冒.";
                sql = "update [BarCodeFangWei] set [CheckCount]=[CheckCount]+1 where v2='" + scanResult + "'";
                DbHelperSQL.ExecuteSql(sql);
            }
            else
            {
                if (scanResult.Substring(0, 4) == "2016" || scanResult.Substring(0, 4) == "2015")
                {
                    sql = "select Barcode,Org,CheckCount from [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] where Barcode='" + scanResult + "'";
                }
                else
                {
                    sql = "select Barcode,Org,CheckCount from [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] where Md5Code='" + scanResult + "'";
                }

                //sql = "select Barcode,Org,CheckCount from [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] where Md5Code='" + scanResult + "'";
                ds = DbHelperSQL.Query(sql);
                if (ds != null && ds.Tables.Count >= 1 && ds.Tables[0].Rows.Count >= 1)
                {
                    string         chandi = string.Empty;
                    string         org    = ds.Tables[0].Rows[0]["Org"].ToString();
                    IPrintTemplate prints;
                    if (org == "1001503171250003")
                    {
                        chandi = "湖南床垫";
                        prints = new CommonPrintTemplate();
                    }
                    else if (org == "1001507180117910")
                    {
                        chandi = "华南床垫";
                        prints = new CommonPrintTemplate();
                    }
                    else if (org == "1001511030115873")
                    {
                        chandi = "晚安软体";
                        prints = new CommonPrintTemplate();
                    }
                    else if (org == "1001902270236689")
                    {
                        chandi = "晚安家纺";
                        prints = new JF80PrintTemplate();
                    }
                    else if (org == "1001806270128563")
                    {
                        chandi = "成都晚安";
                        prints = new CommonPrintTemplate();
                    }
                    else
                    {
                        prints = null;
                    }

                    string message = prints != null?prints.GetDisplayString(ds.Tables[0].Rows[0]["Barcode"].ToString(), chandi, int.Parse(ds.Tables[0].Rows[0]["CheckCount"].ToString())) : "";

                    res = message;
                    sql = "update [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] set [CheckCount]=isnull([CheckCount],0)+1 where Md5Code='" + scanResult + "'";
                    DbHelperSQL.ExecuteSql(sql);
                }
                else
                {
                    if (scanResult.Substring(0, 4) == "2016" || scanResult.Substring(0, 4) == "2015")
                    {
                        sql = "select Barcode,Org,CheckCount from [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] where Barcode='" + scanResult + "'";
                    }
                    else
                    {
                        sql = "select Barcode,Org,CheckCount from [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] where Md5Code='" + scanResult + "'";
                    }
                    ds = DbHelperSQLNew.Query(sql);
                    if (ds != null && ds.Tables.Count >= 1 && ds.Tables[0].Rows.Count >= 1)
                    {
                        IPrintTemplate prints;
                        string         chandi = string.Empty;
                        string         org    = ds.Tables[0].Rows[0]["Org"].ToString();
                        if (org == "1001503171250003")
                        {
                            chandi = "湖南床垫";
                            prints = new CommonPrintTemplate();
                        }
                        else if (org == "1001803142054991")
                        {
                            chandi = "华南床垫";
                            prints = new CommonPrintTemplate();
                        }
                        else if (org == "1001511030115873")
                        {
                            chandi = "晚安软体";
                            prints = new CommonPrintTemplate();
                        }
                        else if (org == "1001503170150373")
                        {
                            chandi = "晚安家纺";
                            prints = new JFPrintTemplate();
                        }
                        else if (org == "1001803080148041")
                        {
                            chandi = "华北基地";
                            prints = new CommonPrintTemplate();
                        }
                        else
                        {
                            prints = null;
                        }

                        string message = prints != null?prints.GetDisplayString(ds.Tables[0].Rows[0]["Barcode"].ToString(), chandi, int.Parse(ds.Tables[0].Rows[0]["CheckCount"].ToString())) : "";

                        res = message;
                        sql = "update [GOODNIGHT].[dbo].[WanAn_MO_BarcodeDetail] set [CheckCount]=isnull([CheckCount],0)+1 where Md5Code='" + scanResult + "'";
                        DbHelperSQLNew.ExecuteSql(sql);
                    }
                    else
                    {
                        res = "尊敬的用户,您好! 该产品不属于晚安生产的产品,请谨防假冒.(注:防伪验证支持湖南床垫2015年9月1日(佛山床垫10月1日丶晚安软床10月1日)/晚安家纺(2016年8月15日)之后生产贴标的产品!)";
                    }
                }
            }

            return(res);
        }