コード例 #1
0
        private ActionResult GetPages2(SelScale condition, string where)
        {
            PageJsonModel <SelScale> page = new PageJsonModel <SelScale>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = " SelScale";
            page.strSelect = " province,city,Address,warning,count(ID) cnt";
            page.strWhere  = where + " and warning='窜货' group by province,city,Address,warning";
            if (string.IsNullOrWhiteSpace(condition.orderby) == false)
            {
                page.strOrder = Common.FilteSQLStr(condition.orderby);
            }
            else
            {
                page.strOrder = "count(ID) desc";
            }

            page.LoadList();

            if (page.pageResponse != null && page.pageResponse.RtnList != null && page.pageResponse.RtnList.Count > 0)
            {
                return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        private ActionResult GetPages(SelScale condition, string where)
        {
            PageJsonModel <View_AntiQuery> page = new PageJsonModel <View_AntiQuery>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = "View_AntiQuery";
            page.strSelect = " ID, AntiCode, IP, province, city, warning, Address, UserName, CreateTime, BigCode, MiddleCode, SmallCode,SalesAddress ";
            page.strWhere  = where;
            if (string.IsNullOrWhiteSpace(condition.orderby) == false)
            {
                page.strOrder = Common.FilteSQLStr(condition.orderby);
            }
            else
            {
                page.strOrder = "CreateTime desc";
            }

            page.LoadList();

            if (page.pageResponse != null && page.pageResponse.RtnList != null && page.pageResponse.RtnList.Count > 0)
            {
                return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult ExportExcel(SelScale condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append("select SelScale.*,Scale.BigCode,Scale.SmallCode,Scale.SelectDate from SelScale left join Scale on SelScale.AntiCode=Scale.AntiCode where 1=1");
            //where.Append("and state='已审核'  and Chief=0  ");
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where.Append(string.Format(" and (BigCode like '%{0}%' or SmallCode like '%{0}%' or SelScale.AntiCode like '%{0}%' or Address like '%{0}%')", condition.keyword));
            }
            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "ID", "防伪码", "IP", "消费者查询省份", "消费者查询城市", "查询状态", "销售地区", "经销商编号", "外箱条码", "产品条码", "查询时间" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "防伪查询明细信息" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
コード例 #4
0
        public ActionResult GetCodePage2(SelScale condition)
        {
            string where = string.Empty;

            if (!string.IsNullOrWhiteSpace(condition.province))
            {
                where += string.Format(" and province+city like '%{0}%'", condition.province);
            }
            if (!string.IsNullOrWhiteSpace(condition.Address))
            {
                where += string.Format(" and Address like '%{0}%'", condition.Address);
            }

            return(GetPages2(condition, where));
        }
コード例 #5
0
        public ActionResult GetCodePage(SelScale condition)
        {
            string where = string.Empty;
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where += " and (isnull(BigCode,'')+isnull(MiddleCode,'')+isnull(SmallCode,'')+AntiCode like '%" + Common.FilteSQLStr(condition.keyword) + "%' )";
            }
            if (!string.IsNullOrWhiteSpace(condition.province))
            {
                where += " and (province+citye like '%" + Common.FilteSQLStr(condition.keyword) + "%' )";
            }
            if (!string.IsNullOrWhiteSpace(condition.Address))
            {
                where += " and (Address like '%" + Common.FilteSQLStr(condition.Address) + "%' )";
            }

            return(GetPages(condition, where));
        }
コード例 #6
0
        public JsonResult GetPage()
        {
            string        fileStr = "";
            List <string> json    = new List <string>();

            try
            {
                string filePath = AppDomain.CurrentDomain.BaseDirectory;
                if (!System.IO.Directory.Exists(filePath + "BaseFile\\"))
                {
                    System.IO.Directory.CreateDirectory(filePath + "BaseFile\\");
                }
                filePath = filePath + "BaseFile\\";
                //读取文件
                StreamReader sr = new StreamReader(filePath + "provincedata.json", Encoding.UTF8);
                String       line;
                while ((line = sr.ReadLine()) != null)
                {
                    fileStr += (line.ToString());
                }
                sr.Close();

                json = JsonConvert.DeserializeObject <List <string> >(fileStr);
            }
            catch (Exception ex) { }


            List <SelScale> fbs = SelScale.GetSelScale();

            for (int i = 0; i < fbs.Count; i++)
            {
                var newname = json.FirstOrDefault(m => fbs[i].name.Contains(m));
                if (string.IsNullOrWhiteSpace(newname) == false)
                {
                    fbs[i].name = newname;
                }
            }

            return(Json(fbs, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        public ActionResult AntiFakeSel(string ID)
        {
            string          ip      = System.Web.HttpContext.Current.Request.ServerVariables.Get("Remote_Addr").ToString();
            ModelQueryParam queryip = new ModelQueryParam();

            queryip = GetAddress(ip);
            string province = queryip.Province;
            string city     = queryip.City;

            string msg   = "此防伪码不存在,请您检查标签,确认防伪码是否输入正确,然后再请您试一次。";
            Scale  scake = Scale.GetCAntiFake(ID);

            SelScale.GetSelScale();

            int countto = 0;

            //string img = "";
            if (scake != null)
            {
                int count = 0;  // scake.SelCount + 1;
                if (count == 1)
                {
                    DateTime time = DateTime.Now;
                    msg = "此防伪码有效,您购买的是深圳市通程防伪科技有限公司所生产的正牌产品,请放心使用!";
                    //scake.SelectDate = time;

                    SelScale selscale = new SelScale();
                    //查到当前标签的出货记录
                    ScaleOutStoke Stoke = ScaleOutStoke.GetSmallScaleListcode(ID);

                    if (Stoke != null)
                    {
                        C_User user = new C_User();
                        if (Stoke.Consignee == "m2000")
                        {
                            //查到出货人信息
                            user = C_User.GetC_UserByUserName(Stoke.Shipper);
                            if (user.Province != province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }

                            selscale.Address = user.Province + user.City;
                        }
                        else
                        {
                            user = C_User.GetC_UserByUserName(Stoke.Consignee);
                            if (user.Province != province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }

                            selscale.Address = user.Province + user.City;
                        }
                    }

                    selscale.province = province;
                    selscale.city     = city;
                    selscale.IP       = ip;
                    selscale.AntiCode = ID;
                    selscale.InsertAndReturnIdentity();
                }
                else
                {
                    msg = "注意!此防伪码有效,但已被查询" + count + "次";
                }

                scake.UpdateByID();
                countto = count;
                return(Content(countto + "|" + msg + "|" + scake.CreateTime));
            }
            return(Content(countto + "|" + msg));
        }
コード例 #8
0
        public RequestResult InsertQuery(int FID, string AntiCode, string IP, string Province, string City, string Address, string Country = "")
        {
            DAL.Log.Instance.Write("FID:" + FID.ToString() + ",AntiCode:" + AntiCode + ",IP:" + IP + ",Country:" + Country + ",Province:" + Province + ",City:" + City + ",Address:" + Address, "防伪查询回调参数");

            RequestResult result = new RequestResult();

            try
            {
                SelScale selscale = new SelScale();

                ScaleOutStoke Stoke = ScaleOutStoke.GetSmallScaleListcode(AntiCode);

                if (Stoke == null)
                {
                    Scale scale = Scale.GetEntityByAntiCode(AntiCode);
                    if (scale == null)
                    {
                        selscale.warning = "错误";
                        result.message   = "错误";
                        result.success   = true;
                    }
                    else if (!scale.IsOut)
                    {
                        selscale.warning = "未出货";
                        result.message   = "未出货";
                        result.success   = true;
                    }
                    else
                    {
                        selscale.warning = "异常";
                        result.message   = "异常";
                        result.success   = true;
                    }
                }
                else if (Province == "未知" || City == "未知")
                {
                    selscale.warning = "异常";
                    result.message   = "异常";
                    result.success   = true;
                }
                else
                {
                    C_User user = new C_User();
                    if (Stoke.Consignee == "m2000")
                    {
                        //查到出货人信息
                        user = C_User.GetC_UserByUserName(Stoke.Shipper);
                        if (user != null)
                        {
                            if (user.Province != Province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }
                        }
                        else
                        {
                            selscale.warning = "异常";
                        }
                    }
                    else
                    {
                        user = C_User.GetC_UserByUserName(Stoke.Consignee);
                        if (user != null)
                        {
                            if (user.Province != Province)
                            {
                                selscale.warning = "窜货";
                            }
                            else
                            {
                                selscale.warning = "正常";
                            }
                        }
                        else
                        {
                            selscale.warning = "异常";
                        }
                    }

                    result.message = "成功";
                    result.success = true;
                }

                selscale.warning    = string.IsNullOrWhiteSpace(selscale.warning) ? "未知" : selscale.warning;
                selscale.Country    = Country;
                selscale.province   = Province;
                selscale.city       = City;
                selscale.IP         = IP;
                selscale.FID        = FID;
                selscale.AntiCode   = AntiCode;
                selscale.Address    = Address;
                selscale.CreateTime = CommonFunc.GetNowTimestamp();
                selscale.InsertAndReturnIdentity();
            }
            catch (Exception ex)
            {
                DAL.Log.Instance.Write(ex.Message, "防伪查询回调出错");
                result.message = "失败,error:" + ex.Message;
                result.success = false;
            }

            return(result);
        }