public ActionResult Index(string BarcodeStr, string Area) { try { ByCodeModel model = new ByCodeModel(); model.BarCode = BarcodeStr.Trim(); ViewBag.title = CommonHelp.list.Where(p => p.Area.Equals(Area)).FirstOrDefault().DesCribe; model.Area = Area; model.Station = "All"; string keyTorq = BarcodeStr + model.Area + "Torq"; string keyPart = BarcodeStr + model.Area + "Part"; CommonHelp.keyPart = keyPart; CommonHelp.keyTorq = keyTorq; if (CommonBuffer.Exist(keyTorq) && CommonBuffer.Exist(keyPart)) { ViewBag.Torq = CommonBuffer.Get <List <ByCodeDto> >(keyTorq); ViewBag.Part = CommonBuffer.Get <List <ByCodeDto> >(keyPart); } else { ViewBag.Torq = CommonBuffer.FindT(keyTorq, SelectByCodeInfo, model); ViewBag.Part = CommonBuffer.FindT(keyPart, SelectCodePart, model); } } catch (Exception ex) { } return(View()); }
//导出扫描率 public ActionResult ExportScanRate() { List <ResScnRateDto> list = new List <ResScnRateDto>(); if (CommonBuffer.Exist(CommonHelp.key)) { list = CommonBuffer.Get <List <ResScnRateDto> >(CommonHelp.key); if (list.Count != 0) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("Figure_No_up", "上线图号"); dic.Add("sum_up", "上线总数"); dic.Add("upstation", "上线工位"); dic.Add("Figure_No_down", "下线总数"); dic.Add("sum_down", "下线数量"); dic.Add("DOWNSTATION", "下线工位"); dic.Add("DOWNRATE", "下线扫描率"); dic.Add("cartype", "车型"); //dic.Add("Figure_No", "部件图号"); dic.Add("Part_Sum", "部件总数"); dic.Add("PartFigureNo", "部件图号"); dic.Add("Rate", "部件扫描率"); ExExcel(list, dic, CommonHelp.StarMon + CommonHelp.EndMon + "扫描率"); } } return(Content("<script>alert('请稍后再试!');history.go(-1);</script>")); }
public ActionResult TorqPartToExcel() { ResDto res = new ResDto(); res.Successed = true; try { string type = Request.QueryString["type"]; List <ByCodeDto> list = new List <ByCodeDto>(); List <ByCodeDto> list2 = new List <ByCodeDto>(); if (CommonBuffer.Exist(CommonHelp.keyTorq) && CommonBuffer.Exist(CommonHelp.keyPart)) { list = CommonBuffer.Get <List <ByCodeDto> >(CommonHelp.keyTorq); list2 = CommonBuffer.Get <List <ByCodeDto> >(CommonHelp.keyPart); } if (type == "Torq" && list.Count != 0) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ProdDateTime", "开始日期"); dic.Add("BarCode_zc", "总成条码"); dic.Add("Station", "工位"); dic.Add("Cartype", "车型"); dic.Add("Nutname", "扭矩名称"); dic.Add("NutID", "扭矩编号"); dic.Add("Torque", "扭矩"); dic.Add("Angle", "角度"); dic.Add("ScanStatus", "扫描状态");//根据总成条码获得扭矩信息 ExExcel(list, dic, "扭距时间段筛选表"); res.Successed = true; } else if (type == "Part" && list2.Count != 0) { Dictionary <string, string> dic2 = new Dictionary <string, string>(); dic2.Add("BarCode_zc", "总成条码"); dic2.Add("Barcode_part", "部件条码"); dic2.Add("PartName", "部件名称"); dic2.Add("Part_figure_no", "部件图号"); dic2.Add("ProdDateTime", "开始时间"); dic2.Add("ScanStatus", "扫描状态"); dic2.Add("Station", "站点"); dic2.Add("Part_Signs", "精追/批追"); dic2.Add("cartype", "车型"); ExExcel(list2, dic2, "部件时间段筛选表"); } } catch (Exception e) { res.Successed = false; Console.WriteLine(e); } return(Json(data: res, behavior: JsonRequestBehavior.AllowGet)); }
// GET: GetPartByDate public ActionResult Index(PartDataModel model, int?PageIndex, int?PageSize = 30) { try { ViewBag.totalcount = 0; ViewBag.Line = CommonHelp.list; if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Line)) { string key = Guid.NewGuid().ToString() + model.Line; CommonHelp.key = key; if (model.EndTime.Month - model.StartTime.Month > 0) { CommonHelp.StarMon = model.StartTime.ToString("yyyy MMMM dd") + "~" + model.EndTime.ToString("yyyy MMMM dd"); CommonHelp.EndMon = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault() .DesCribe; } else { CommonHelp.StarMon = model.StartTime.Month + "月"; CommonHelp.EndMon = CommonHelp.list.Where(p => p.Area.Equals(model.Line)).FirstOrDefault() .DesCribe; } if (CommonBuffer.Exist(key)) { CommonHelp.list2 = CommonBuffer.Get <List <PartDataDto> >(key); ViewBag.count = CommonHelp.list2.Count; ViewBag.Data = CommonHelp.list2.Take(30).ToList(); } else { CommonHelp.list2 = CommonBuffer.FindT(key, DapperService.SqlHelp.PartDataBase, model); ViewBag.count = CommonHelp.list2.Count; ViewBag.Data = CommonHelp.list2.Take(30).ToList(); } } if (PageIndex != null) { var model1 = new PageInfoModel <PartDataDto>(); model1.List = CommonHelp.list2; model1.PageSize = PageSize; model1.PageIndex = PageIndex; var res = CommonHelp.PageList(model1); return(Json(res, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { } return(View()); }
/// <summary> /// 扭矩信息导出excel /// </summary> /// <returns></returns> //导出零件 public string GetPartByDateToExcel() { var Successed = true; var Message = ""; string s = ""; List <PartDataDto> list = new List <PartDataDto>(); try { if (CommonBuffer.Exist(CommonHelp.key)) { list = CommonBuffer.Get <List <PartDataDto> >(CommonHelp.key); if (list.Count != 0) { Message = "成功!"; JavaScriptSerializer json = new JavaScriptSerializer(); json.MaxJsonLength = Int32.MaxValue; s = json.Serialize(list); //Dictionary<string, string> dic = new Dictionary<string, string>(); //dic.Add("Figure_NO", "总成零件号"); //dic.Add("ZcID", "总成ID"); //dic.Add("Barcode_zc", "总成条码"); //dic.Add("PartID", "分零件ID"); //dic.Add("Partname", "分零件名称"); //dic.Add("Barcode_part", "分零件条形码"); //dic.Add("ProdDateTimes", "装配时间"); //dic.Add("Factory", "所属厂商"); // ExExcel(list, dic, CommonHelp.StarMon+"零件数据"+ CommonHelp.EndMon); } } } catch (Exception e) { Successed = false; Message = "失败!"; } return(s); }
// GET: ScanRate public ActionResult Index(PartDataModel model, int?PageIndex, int?PageSize = 30) { try { List <ResScnRateDto> listend = new List <ResScnRateDto>(); ViewBag.totalcount = 0; ViewBag.Line = CommonHelp.list; if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Line)) { string key = Guid.NewGuid().ToString() + model.Line; CommonHelp.key = key; if (CommonBuffer.Exist(key)) { CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.Get <List <ResScnRateDto> >(key); ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count; ViewBag.Data = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList(); } else { CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.FindT(key, DapperService.SqlHelp.ScanRate, model); ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count; ViewBag.Data = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList(); } } if (PageIndex != null) { var model1 = new PageInfoModel <ResScnRateDto>(); model1.List = CommonHelp.Listone <ResScnRateDto> .List; model1.PageSize = PageSize; model1.PageIndex = PageIndex; var res = CommonHelp.PageList(model1); return(Json(res, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { } return(View()); }