示例#1
0
        public string GetDisplayString(string barCode, string ProductAddress, int checkCount)
        {
            StringBuilder stb = new StringBuilder();

            stb.Append("经验证,本产品为晚安家纺正品,扫描次数【" + (checkCount + 1) + "】次,请谨防假冒.");
            string  sql = @"select  t.Name,t.Code from [GOODNIGHT].[dbo].WanAn_MO_BarcodeDetail x
            inner join 
            [GOODNIGHT].[dbo].CBO_ItemMaster t 
            on t.org=x.org and x.ItemCode=t.Code
           where x.Barcode='" + barCode + "'";
            DataSet ds  = DbHelperSQLNew.Query(sql);

            if (ds != null && ds.Tables.Count >= 1 && ds.Tables[0].Rows.Count >= 1)
            {
                stb.AppendFormat(" 商品名称:{0}", ds.Tables[0].Rows[0]["Name"].ToString());
                stb.AppendFormat(" 产品编码:{0}", ds.Tables[0].Rows[0]["Code"].ToString());
                stb.AppendFormat(" 制造产商:湖南省晚安家纺股份有限公司");
                stb.Append(" 公司热线:400-068-4988");
                stb.Append(" 请保留相应票据或产品二维码作为售后凭证");
            }
            return(stb.ToString());
        }
        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);
        }