//根据传入的参数处理事情 public void ProcessRequest(HttpContext context) { //清空之前数据 context.Response.Clear(); //检测是否含有session if (context.Session.Count < 5) { //跳转 context.Response.Redirect("/Account/Login", true); //停止加载后续内容 context.Response.End(); //直接返回 return; } //执行基类的方法 if (!base.CheckIsLogin(context)) { return; } //用户传入的生产编号 string procNum = context.Request["pnum"]; //检测生产编号 if (procNum == null || procNum.Length == 0) { context.Response.Write("未提供生产编号参数!"); return; } //用户传入的送货单编号 string billNum = context.Request["bnum"]; //检测送货单编号 if (billNum == null || billNum.Length == 0) { billNum = string.Empty; } //用户传入的已经存在的批量卡和数量 string lotCardList = context.Request["lotlist"]; //检测批量卡和数量 if (lotCardList == null || lotCardList.Length == 0) { lotCardList = string.Empty; } //转换字符串 lotCardList = lotCardList.Replace("|l|", "<").Replace("|g|", ">"); //将查询到的结果保存到字典变量中 var dic = new Dictionary<string, LiItem>(); //数据适配器 using (var da = new t_complete_lot_card_waitTableAdapter()) { //获取数据 var tab = da.GetDataByProductNum(procNum); //获取当前送货单中的批量卡清单 var tabDeliveryLotCard = new DataSetDeliveryBillMgr.t_delivery_bill_lot_cardDataTable(); //传入的送货单号大于0才获取之前该送货单的交货批量卡清单 if (billNum.Length > 0) { //数据适配器获取之前的清单 using (var daDeliveryLotCard = new t_delivery_bill_lot_cardTableAdapter()) { daDeliveryLotCard.FillByBillNum(tabDeliveryLotCard, billNum); } } //获取单据数据 AddLotListWaitItem(tab, ref dic, lotCardList, tabDeliveryLotCard); } //待输出到浏览器的数据 //表格的行 string strResult = string.Empty; //将数据遍历写入页面 if (dic.Count <= 0) { //显示未找到数据 strResult = "在待入仓清单中未找到该生产编号的批量卡数据!"; } else { //实例化stringbuild类 var sb = new StringBuilder(); //加入全选按钮 sb.Append("<input class='yd-btn-select-all-lot-card yd-lot-card-cmd-btn' type='button' value='全选/全不选' />"); //加入自动识别扣数按钮 sb.Append("<input class='yd-btn-auto-lot-card yd-lot-card-cmd-btn' type='button' value='智能识别' title='根据该生产编号输入的总数量自动填写' />"); //加入筛选按钮 sb.Append("<input class='yd-tb-filter-lot-id' type='text' />"); sb.Append("<input class='yd-btn-filter-lot-card yd-lot-card-cmd-btn' type='button' value='着色筛选' />"); //加入确认按钮 sb.Append("<input class='yd-accept-lot-card-btn yd-lot-card-cmd-btn' type='button' value='确认(A)' accesskey='A' title='也可按Alt+A执行' />"); sb.Append("<hr />\n"); //加入外层div开头 sb.Append("<div class='yd-div-lot-card-list'>\n"); //循环设置取得的批量卡清单 foreach (var itm in dic) { //将实例加入项目 sb.Append(itm.Value.ToString()); } //加入外层div尾 sb.Append("</div>\n"); //取得最终结果 strResult = sb.ToString(); } //写入数据 context.Response.Write(strResult); }
//根据传入的参数处理事情 public void ProcessRequest(HttpContext context) { //清空之前数据 context.Response.Clear(); //检测是否含有session if (context.Session.Count < 5) { //跳转 context.Response.Redirect("/Account/Login", true); //停止加载后续内容 context.Response.End(); //直接返回 return; } //执行基类的方法 if (!base.CheckIsLogin(context)) { return; } //用户传入的生产编号 string proNum = context.Request["pnum"]; //检测生产编号 if (proNum == null || proNum.Length == 0) { context.Response.Write("未提供生产编号参数!"); return; } //用户传入的送货单编号 string billNum = context.Request["bnum"]; //检测送货单编号 if (billNum == null || billNum.Length == 0) { billNum = string.Empty; } //用户传入的已经存在的lot卡和数量 string lotCardList = context.Request["lotlist"]; //检测lot卡和数量 if (lotCardList == null || lotCardList.Length == 0) { lotCardList = string.Empty; } //转换字符串 lotCardList = lotCardList.Replace("|l|", "<").Replace("|g|", ">"); //将查询到的结果保存到字典变量中 var dic = new Dictionary<string, LiItem>(); //数据适配器 using (var da = new t_complete_lot_card_waitTableAdapter()) { //获取数据 var tab = da.GetDataByProductNum(proNum); //获取当前送货单中的lot卡清单 var tabDeliveryLotCard = new DataSetDeliveryBillMgr.t_delivery_bill_lot_cardDataTable(); //传入的送货单号大于0才获取之前该送货单的交货lot卡清单 if (billNum.Length > 0) { //数据适配器获取之前的清单 using (var daDeliveryLotCard = new t_delivery_bill_lot_cardTableAdapter()) { daDeliveryLotCard.FillByBillNum(tabDeliveryLotCard, billNum); } } //获取单据数据 AddLotListWaitItem(tab, ref dic, lotCardList, tabDeliveryLotCard); } //待输出到浏览器的数据 //表格的行 string strResult = string.Empty; //将数据遍历写入页面 if (dic.Count <= 0) { //显示未找到数据 strResult = "在待入仓清单中未找到该生产编号的lot卡数据!"; } else { //实例化stringbuild类 var sb = new StringBuilder(); //加入全选按钮 sb.Append("<input class='selectalllotcardbtn lotcardcmdbtn' type='button' value='全选/全不选' />"); //加入自动识别扣数按钮 sb.Append("<input class='autolotcardbtn lotcardcmdbtn' type='button' value='智能识别' title='根据该生产编号输入的总数量自动填写' />"); //加入筛选按钮 sb.Append("<input class='filterlotcardtb' type='text' />"); sb.Append("<input class='filterlotcardbtn lotcardcmdbtn' type='button' value='着色筛选' />"); //加入确认按钮 sb.Append("<input class='acceptlotcardbtn lotcardcmdbtn' type='button' value='确认(A)' accesskey='A' title='也可按Alt+A执行' />"); sb.Append("<hr />\n"); //加入表格table头 sb.Append("<table class='lotcardlisttab'>\n"); sb.Append("<tbody>\n"); //当前行第几张lot卡 int iCountLot = 0; //循环设置取得的lot卡清单 foreach (var itm in dic) { //记录当前行第几张lot卡 iCountLot++; //第一张lot卡则加入表格tr头 if (iCountLot == 1) { sb.Append("<tr>\n"); } //将实例加入项目 sb.Append(itm.Value.ToString()); //如果是第3张lot卡则换行 if (iCountLot == 4) { sb.Append("</tr>\n"); //初始为第一张lot卡 iCountLot = 0; } } //如果不是第3张lot卡则加入tr结尾符 if (!sb.ToString().EndsWith("</tr>\n")) { sb.Append("</tr>\n"); } //加入表格table尾 sb.Append("</tbody>\n"); sb.Append("</table>\n"); //取得最终结果 strResult = sb.ToString(); } //写入数据 context.Response.Write(strResult); }