ajax加载多次很卡,Ajax 请求次数过多,请求就卡死了【状态变成pending】,怎么解决,...

#region 入库扫描

///

///入库扫描///

/// 产品序列号

///

[HttpPost]public JsonResult GetInstock(string productSN, string lotSN, int planQty,stringradomTime)

{//1.先判断SN是否重复

if (!string.IsNullOrEmpty(productSN))

{bool resultSN =bll.IsExistsSN(productSN);int scanQty = 0;if(resultSN)

{//验证计划入库数量和已扫描的数量

DataTable dt =bll.OverInStockQty(lotSN);if (dt != null && dt.Rows.Count > 0)

{int planCount = Convert.ToInt32(dt.Rows[0]["F_Qty"]); /*计划入库数量*/scanQty= Convert.ToInt32(dt.Rows[0]["F_SNIndex"]);/*已扫描数量*/

if (scanQty >=planCount)

{//已扫描的数量,大于计划入库数量

return Json("OverStockQty", JsonRequestBehavior.AllowGet);

}else{

Dictionary lstStrSN = new Dictionary();

InStockModel insertModel= newInStockModel()

{

F_UserID= CookieHelper.GetCookieValue("hcUserName"), //Session["UserName"].ToString(),

F_LotSN =lotSN,

F_SN=productSN,

F_PCName=Environment.MachineName,

F_Qty=planQty

};int result =bll.InsertInstock(insertModel);if (result > 0)

{//更新已入库数据

bll.UpdateScanQty(result);

scanQty+= 1;

lstStrSN.Add(productSN, scanQty);return Json(newJavaScriptSerializer().Serialize(lstStrSN), JsonRequestBehavior.AllowGet);

}

}

}if (dt!=null&& dt.Rows.Count == 0)

{

Dictionary lstStrSN = new Dictionary();

InStockModel insertModel= newInStockModel()

{

F_UserID= CookieHelper.GetCookieValue("hcUserName"), //Session["UserName"].ToString(),

F_LotSN =lotSN,

F_SN=productSN,

F_PCName=Environment.MachineName,

F_Qty=planQty

};int result =bll.InsertInstock(insertModel);if (result > 0)

{//更新已入库数据

bll.UpdateScanQty(result);

scanQty= 1;

lstStrSN.Add(productSN, scanQty);return Json(newJavaScriptSerializer().Serialize(lstStrSN), JsonRequestBehavior.AllowGet);

}

}

}else{//重复序列号

return Json("RepeatSN", JsonRequestBehavior.AllowGet);

}

}else{//请输入序列号

return Json("EmptySN", JsonRequestBehavior.AllowGet);

}//出现错误

return Json("Error", JsonRequestBehavior.AllowGet);

}#endregion

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值