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)); }
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); }