public IList <TextValueInfo> GetLabelParams(string labelType, string pid) { SystemBO _bal = BLLFactory.GetBal <SystemBO>(WebHelper.GetUserInfo()); //RouteBO _bal = BLLFactory.GetBal<RouteBO>(WebHelper.GetUserInfo()); return(_bal.ListLabelParams(labelType, pid)); }
public SPMessage GetLabelParameters(string data, string labelId) { SystemBO _bal = BLLFactory.GetBal <SystemBO>(WebHelper.GetUserInfo()); return(_bal.GetLabelParameters(data, labelId)); //SPMessage ret = new SPMessage(); //ret.Result = "OK"; //ret.Message = "VarPsn =lt12312"; //return ret; }
public string GetTplDownloadUrl() { UserInfo userInfo = WebHelper.GetUserInfo(); SystemBO _bal = BLLFactory.GetBal <SystemBO>(WebHelper.GetUserInfo()); IList <SysMidsvcConfig> svcList = _bal.GetMidsvcList(); if (svcList.Count() > 0) { return(svcList[0].MidSvcUrl + "/DownloadPrintTpl.ashx"); } return(ConstantsHelper.GetHelper(userInfo.SiteCode, userInfo.BUCode).GetSystemConfig("LABEL_TPL_DL_URL")); }
protected void Page_Load(object sender, EventArgs e) { string materialname = Request.QueryString["materialname"]; string custname = Request.QueryString["custname"]; string batchnumber = Request.QueryString["batchnumber"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-7); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <MaterialStock> objods = _bal.FindStockInfo("0^2", materialname, custname, starttime, endtime, batchnumber); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("MaterialInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "来料条码,物料代码,物料名称,批号,数量,单据编号,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].MSN); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].MaterialCode); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].MaterialName); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].BatchNumber); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].BasQty.ToString()); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].DOCUMENTID); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "MaterialInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string month = Request.QueryString["month"]; int iYear = DateTime.Now.Year; if (string.IsNullOrEmpty(month) || month == "0") { month = DateTime.Now.Month.ToString(); if (month.Length == 1) { month = "0" + month; } } month = iYear + "-" + month; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <BasCustom> cus = _bal.FindCustName(); if (cus == null || cus.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("CustPassRate"); row = hssfSheet.CreateRow(0); //填充头 string objhead = "委托单位,产品数量,一类品数量,二类品数量,返工数量,让步数量,废品数量,一类品率,二类品率,返工率,让步率,废品率"; for (int i = 0; i < objhead.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objhead.Split(',')[i]); } for (int i = 1; i < cus.Count + 1; i++) { int[] allRate = _bal.FindCustQty(month, cus[i - 1].NAME); int QUANTITY = (allRate[0] + allRate[1]); int PassCount = allRate[0]; int FailCount = allRate[1]; int ReturnCount = allRate[2]; int SecondPass = allRate[3]; int DiscardCount = allRate[4]; double PassRate = QUANTITY == 0 ? 0 : (Math.Round((double)(PassCount * 100 / QUANTITY), 2)); double FailRate = QUANTITY == 0 ? 0 : (Math.Round(100 - (double)(PassCount * 100 / QUANTITY), 2)); double ReturnRate = QUANTITY == 0 ? 0 : (Math.Round((double)(ReturnCount * 100 / QUANTITY), 2)); double SecPassRate = QUANTITY == 0 ? 0 : (Math.Round((double)(SecondPass * 100 / QUANTITY), 2)); double DiscardRate = QUANTITY == 0 ? 0 : (Math.Round((double)(DiscardCount * 100 / QUANTITY), 2)); row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(cus[i - 1].NAME); cell = row.CreateCell(1); cell.SetCellValue(QUANTITY); cell = row.CreateCell(2); cell.SetCellValue(PassCount); cell = row.CreateCell(3); cell.SetCellValue(FailCount); cell = row.CreateCell(4); cell.SetCellValue(ReturnCount); cell = row.CreateCell(5); cell.SetCellValue(SecondPass); cell = row.CreateCell(6); cell.SetCellValue(DiscardCount); cell = row.CreateCell(7); cell.SetCellValue(PassRate + "%"); cell = row.CreateCell(8); cell.SetCellValue(FailRate + "%"); cell = row.CreateCell(9); cell.SetCellValue(ReturnRate + "%"); cell = row.CreateCell(10); cell.SetCellValue(SecPassRate + "%"); cell = row.CreateCell(11); cell.SetCellValue(DiscardRate + "%"); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "CustPassRate" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string workorder = Request.QueryString["workorder"]; string station = Request.QueryString["station"]; string partsdrawingno = Request.QueryString["partsdrawingno"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-100); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <TrackingWip> woobjs = _bal.FindSNTrackingWIP(workorder, partsdrawingno, station, dtstart, dtend); WsSystem ws = new WsSystem(); if (woobjs == null || woobjs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("SNTrackingWIPInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "产品条码,物料条码,工单单号,零件图号,批次号,工站,状态,工时,下一站,创建时间,操作人"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } if (woobjs != null) { for (int i = 2; i <= woobjs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(woobjs[i - 2].PSN); cell = row.CreateCell(1); cell.SetCellValue(woobjs[i - 2].MSN); cell = row.CreateCell(2); cell.SetCellValue(woobjs[i - 2].WorkOrder); cell = row.CreateCell(3); cell.SetCellValue(woobjs[i - 2].PartsdrawingCode); cell = row.CreateCell(4); cell.SetCellValue(woobjs[i - 2].BatchNumber); cell = row.CreateCell(5); cell.SetCellValue(woobjs[i - 2].StationName); cell = row.CreateCell(6); cell.SetCellValue(woobjs[i - 2].STATUS); cell = row.CreateCell(7); cell.SetCellValue(woobjs[i - 2].TaskTime); cell = row.CreateCell(8); cell.SetCellValue(woobjs[i - 2].NextStation); cell = row.CreateCell(9); cell.SetCellValue(woobjs[i - 2].CreatedDate.ToString()); cell = row.CreateCell(10); cell.SetCellValue(woobjs[i - 2].UpdatedBy); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "SNTrackingWIPInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string equipcode = Request.QueryString["equipcode"]; string equipname = Request.QueryString["equipname"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WsSystem ws = new WsSystem(); IList <BasEquipment> objods = _bal.FindBasEquipment(equipcode, equipname);//.FindFailItems(failcode,failtype); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("EquipmentQuery"); row = hssfSheet.CreateRow(0); //填充头 string objs = "设备编号,国别厂家,设备名称,机床类型,轴数,型号,功率,车间位置,状态,出厂编号,启用日期,更新人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].CODE); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].COMPANY); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].MachineName); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].MachineType); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].AxisNumber); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].MODEL); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 1].POWER); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 1].LOCATION); cell = row.CreateCell(8); cell.SetCellValue(objods[i - 1].STATUS); cell = row.CreateCell(9); cell.SetCellValue(objods[i - 1].OutCode); cell = row.CreateCell(10); cell.SetCellValue(objods[i - 1].UseDate.ToString()); cell = row.CreateCell(11); cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy)); cell = row.CreateCell(12); cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "EquipmentQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string month = Request.QueryString["month"]; int iYear = DateTime.Now.Year; if (string.IsNullOrEmpty(month) || month == "0") { month = DateTime.Now.Month.ToString(); if (month.Length == 1) { month = "0" + month; } } month = iYear + "-" + month; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <RealtimeStatistics> machines = _bal.findMachineCode(); List <YieldInfo> bs = new List <YieldInfo>(); for (int i = 0; i < machines.Count; i++) { YieldInfo bbtemp = new YieldInfo(); bbtemp.WO = machines[i].MachineName; int[] fails = _bal.FindMachineYield(machines[i].MachineName, month); bbtemp.QUANTITY = (fails[0] + fails[1]); bbtemp.PassCount = fails[0]; bbtemp.FailCount = fails[1]; bbtemp.ReturnCount = fails[2]; bbtemp.SecondPass = fails[3]; bbtemp.DiscardCount = fails[4]; bbtemp.PassRate = (Math.Round((double)(bbtemp.PassCount * 100 / bbtemp.QUANTITY), 2)).ToString() + "%"; bbtemp.FailRate = (Math.Round(100 - (double)(bbtemp.PassCount * 100 / bbtemp.QUANTITY), 2)).ToString() + "%"; bbtemp.ReturnRate = (Math.Round((double)(bbtemp.ReturnCount * 100 / bbtemp.QUANTITY), 2)).ToString() + "%"; bbtemp.SecPassRate = (Math.Round((double)(bbtemp.SecondPass * 100 / bbtemp.QUANTITY), 2)).ToString() + "%"; bbtemp.DiscardRate = (Math.Round((double)(bbtemp.DiscardCount * 100 / bbtemp.QUANTITY), 2)).ToString() + "%"; bs.Add(bbtemp); } if (bs == null || bs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("PassRateQuery"); row = hssfSheet.CreateRow(0); //填充头 string objhead = "机床名称,产品数量,一类品数量,二类品数量,返工数量,让步数量,废品数量,一类品率,二类品率,返工率,让步率,废品率"; for (int i = 0; i < objhead.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objhead.Split(',')[i]); } for (int j = 0; j < bs.Count; j++) { row = hssfSheet.CreateRow(j + 1); cell = row.CreateCell(0); cell.SetCellValue(bs[j].WO); cell = row.CreateCell(1); cell.SetCellValue(bs[j].QUANTITY); cell = row.CreateCell(2); cell.SetCellValue(bs[j].PassCount); cell = row.CreateCell(3); cell.SetCellValue(bs[j].FailCount); cell = row.CreateCell(4); cell.SetCellValue(bs[j].ReturnCount); cell = row.CreateCell(5); cell.SetCellValue(bs[j].SecondPass); cell = row.CreateCell(6); cell.SetCellValue(bs[j].DiscardCount); cell = row.CreateCell(7); cell.SetCellValue(bs[j].PassRate); cell = row.CreateCell(8); cell.SetCellValue(bs[j].FailRate); cell = row.CreateCell(9); cell.SetCellValue(bs[j].ReturnRate); cell = row.CreateCell(10); cell.SetCellValue(bs[j].SecPassRate); cell = row.CreateCell(11); cell.SetCellValue(bs[j].DiscardRate); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "PassRateQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string sn = Request.QueryString["sn"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <TrackingHistory> objods = _bal.FindSNTrackingInfo(sn); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("OrderInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "产品条码,来料条码,工单单号,零件图号,工序,机床名称,负责人,产品名称,时间,批次,数量,操作人"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 2; i <= objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 2].PSN); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 2].MSN); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 2].WorkOrder); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 2].PartsdrawingCode); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 2].StationName); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 2].MachineName); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 2].UpdatedBy); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 2].PartsName); cell = row.CreateCell(8); cell.SetCellValue(objods[i - 2].CreatedDate.ToString()); cell = row.CreateCell(9); cell.SetCellValue(objods[i - 2].BatchNumber); cell = row.CreateCell(10); cell.SetCellValue(objods[i - 2].QUANTITY.ToString()); cell = row.CreateCell(11); cell.SetCellValue(objods[i - 2].UpdatedBy); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "SNTrackingInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string codename = Request.QueryString["codename"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WsSystem ws = new WsSystem(); IList <BasCode> objods = _bal.FindBasCode("", codename);//.FindFailItems(failcode,failtype); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("CodeQuery"); row = hssfSheet.CreateRow(0); //填充头 string objs = "编码名称,编码类型,前缀字符,日期格式,绑定序列,编码长度,操作人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].NAME); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].TYPE); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].PREFIX); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].DateFormat); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].BindSequence); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].CodeLen.ToString()); cell = row.CreateCell(6); cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy)); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "CodeQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string sn = Request.QueryString["sn"]; string materialname = Request.QueryString["materialname"]; string custname = Request.QueryString["custname"]; string batchnumber = Request.QueryString["batchnumber"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-7); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <MaterialStockHistory> objods = _bal.FindMaterialHistory("", "0", sn, materialname, custname, starttime, endtime, batchnumber); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("MaterialInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "来料条码,购货单位,入库日期,收料仓库,单据编号,物料长代码,物料名称,批号,单位,数量,保管员,备注"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].MSN); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].CustName); cell = row.CreateCell(2); if (objods[i - 1].CreatedDate != null) { cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } else { cell.SetCellValue(""); } cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].StockHouse); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].DOCUMENTID); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].MaterialCode); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 1].MaterialName); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 1].BatchNumber); cell = row.CreateCell(8); IList <BasBase> ibb = _bal.FindBaseBySubCode(objods[i - 1].UNIT); if (ibb != null && ibb.Count > 0) { cell.SetCellValue(ibb[0].SubName); } else { cell.SetCellValue(objods[i - 1].UNIT); } cell = row.CreateCell(9); if (objods[i - 1].QUANTITY != null) { cell.SetCellValue(objods[i - 1].QUANTITY.ToString()); } else { cell.SetCellValue(""); } cell = row.CreateCell(10); SysUser user = _bal.FindUserByCode(objods[i - 1].UpdatedBy); if (user != null && !string.IsNullOrEmpty(user.UserCode)) { cell.SetCellValue(user.UserName); } else { cell.SetCellValue(objods[i - 1].UpdatedBy); } cell = row.CreateCell(11); cell.SetCellValue(objods[i - 1].MEMO); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "MaterialInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string psn = Request.QueryString["psn"]; string partsdrawing = Request.QueryString["partsdrawing"]; string wo = Request.QueryString["wo"]; string status = Request.QueryString["status"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WsSystem ws = new WsSystem(); UnsurenessHistory uh = new UnsurenessHistory(); uh.PSN = psn; uh.WorkOrder = wo; uh.STATUS = status; uh.PartsdrawingCode = partsdrawing; if (!string.IsNullOrEmpty(starttime)) { uh.CreatedDate = Convert.ToDateTime(starttime); } if (!string.IsNullOrEmpty(endtime)) { uh.UpdatedDate = Convert.ToDateTime(endtime); } IList <UnsurenessHistory> objs = _bal.FindUnsurenessHistory(uh); if (objs == null || objs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("UnsurenessQuery"); row = hssfSheet.CreateRow(0); //填充头 string objhead = "产品条码,工单号码,不良项,状态,加工工序,数量,来料条码,工件图号,工件名称,生产批号,操作人,时间"; for (int i = 0; i < objhead.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objhead.Split(',')[i]); } for (int i = 1; i < objs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objs[i - 1].PSN); cell = row.CreateCell(1); cell.SetCellValue(objs[i - 1].WorkOrder); cell = row.CreateCell(2); cell.SetCellValue(objs[i - 1].FailMemo); cell = row.CreateCell(3); cell.SetCellValue(objs[i - 1].MEMO); cell = row.CreateCell(4); cell.SetCellValue(objs[i - 1].StationName); cell = row.CreateCell(5); cell.SetCellValue(objs[i - 1].QUANTITY.ToString()); cell = row.CreateCell(6); cell.SetCellValue(objs[i - 1].MSN); cell = row.CreateCell(7); cell.SetCellValue(objs[i - 1].PartsdrawingCode); cell = row.CreateCell(8); cell.SetCellValue(objs[i - 1].ProductName); cell = row.CreateCell(9); cell.SetCellValue(objs[i - 1].BatchNumber); cell = row.CreateCell(10); cell.SetCellValue(ws.FindUserNameByCode(objs[i - 1].UpdatedBy)); cell = row.CreateCell(11); cell.SetCellValue(objs[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "UnsurenessQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string partsdrawingno = Request.QueryString["partcode"]; //string custcode = Request.QueryString["custcode"]; //string starttime = Request.QueryString["starttime"]; //string endtime = Request.QueryString["endtime"]; //DateTime dtstart = DateTime.Today.AddDays(-100); //DateTime dtend = DateTime.Now; //if (custcode == "-1") //{ // custcode = ""; //} //if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) //{ // dtstart = Convert.ToDateTime(starttime); // dtend = Convert.ToDateTime(endtime); //} SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WsSystem ws = new WsSystem(); //IList<PartsdrawingCode> woobjs = _bal.FindPartsdrawingInfo(partsdrawingno, custcode, starttime, endtime); IList <TechnologyWip> baseInfo = _bal.FindTechnologyTask(partsdrawingno); if (baseInfo == null || baseInfo.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("TechnologyTaskInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "零件图号,客户名称,产品名称,状态"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } if (baseInfo != null) { for (int i = 2; i <= baseInfo.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(baseInfo[i - 2].PARTSDRAWINGNO); cell = row.CreateCell(1); cell.SetCellValue(baseInfo[i - 2].CustName); cell = row.CreateCell(2); cell.SetCellValue(baseInfo[i - 2].ProductName); cell = row.CreateCell(3); cell.SetCellValue(baseInfo[i - 2].StatusMemo); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "TechnologyTaskInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string startTime = Request.QueryString["startTime"]; string endTime = Request.QueryString["endTime"]; string custCode = Request.QueryString["custCode"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WsSystem ws = new WsSystem(); IList <BasCustom> objods = _bal.FindBasCustom(custCode, "");//.FindBasCode("", codename);//.FindFailItems(failcode,failtype); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("CustQuery"); row = hssfSheet.CreateRow(0); //填充头 string objs = "客户代码,客户名称,地址,运输方式,收货地点,联系人,电话,传真,开票名称,操作人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].CODE); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].NAME); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].ADDRESS); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].TransType); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].ReceiveArea); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].CONTACT); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 1].MOBILE); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 1].FAX); cell = row.CreateCell(8); cell.SetCellValue(objods[i - 1].InvoiceName); cell = row.CreateCell(9); cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy)); cell = row.CreateCell(10); cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "CustQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string custname = Request.QueryString["custname"]; string partsdrawing = Request.QueryString["partsdrawing"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WorkOrder wo = new WorkOrder(); wo.CustName = custname; wo.PartsdrawingCode = partsdrawing; if (!string.IsNullOrEmpty(starttime)) { wo.StartTime = Convert.ToDateTime(starttime); } if (!string.IsNullOrEmpty(endtime)) { wo.EndTime = Convert.ToDateTime(endtime); } IList <WorkOrder> objs = _bal.FindWorkOrderInfo(wo); if (objs == null || objs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("YieldQuery"); row = hssfSheet.CreateRow(0); //填充头 string objhead = "客户名称,工件图号,工件名称,批次,产出数量,合格数量,不良数量,返工数量,让步数量,废品数量,合格率,不良率,返工率,让步率,废品率"; for (int i = 0; i < objhead.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objhead.Split(',')[i]); } for (int i = 1; i < objs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objs[i - 1].CustName); cell = row.CreateCell(1); cell.SetCellValue(objs[i - 1].PartsdrawingCode); cell = row.CreateCell(2); cell.SetCellValue(objs[i - 1].ProductName); cell = row.CreateCell(3); cell.SetCellValue(objs[i - 1].BatchNumber); cell = row.CreateCell(4); cell.SetCellValue((objs[i - 1].QUANTITY == null ? 0 : objs[i - 1].QUANTITY).ToString()); int[] fails = _bal.FindYieldCountInfo("", objs[i - 1].PartsdrawingCode); int passcount = (int)(objs[i - 1].QUANTITY == null ? 0 : objs[i - 1].QUANTITY) - fails[0]; string passrate = (Math.Round((double)(passcount * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; string failrate = (Math.Round((double)(fails[0] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; string returnrate = (Math.Round((double)(fails[1] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; string secpassrate = (Math.Round((double)(fails[2] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; string dicardrate = (Math.Round((double)(fails[3] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; cell = row.CreateCell(5); cell.SetCellValue(passcount.ToString()); cell = row.CreateCell(6); cell.SetCellValue(fails[0].ToString()); cell = row.CreateCell(7); cell.SetCellValue(fails[1].ToString()); cell = row.CreateCell(8); cell.SetCellValue(fails[2].ToString()); cell = row.CreateCell(9); cell.SetCellValue(fails[3].ToString()); cell = row.CreateCell(10); cell.SetCellValue(passrate); cell = row.CreateCell(11); cell.SetCellValue(failrate); cell = row.CreateCell(12); cell.SetCellValue(returnrate); cell = row.CreateCell(13); cell.SetCellValue(secpassrate); cell = row.CreateCell(14); cell.SetCellValue(dicardrate); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "YieldQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string sn = Request.QueryString["sn"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-7); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <CartonInfo> objods = _bal.FindCartonInfo(sn, "", "", dtstart, dtend); WsSystem ws = new WsSystem(); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("CartonInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "箱号,订单号码,零件图号,质量编号,数量,操作人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } for (int i = 1; i < objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 1].CSN); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 1].OrderNumber); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].PartsdrawingCode); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].QualityCode); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].QUANTITY.ToString()); cell = row.CreateCell(5); cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy)); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 1].CreatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "CartonInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string partsdrawingno = Request.QueryString["partsdrawingno"]; string custcode = Request.QueryString["custcode"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-100); DateTime dtend = DateTime.Now; if (custcode == "-1") { custcode = ""; } if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <PartsdrawingCode> woobjs = _bal.FindPartsdrawingInfo(partsdrawingno, custcode, starttime, endtime); WsSystem ws = new WsSystem(); if (woobjs == null || woobjs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("PartsdrawingInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "零件图号,客户名称,客户代码,产品名称,投产总数,质量编号,交付数量,炉批号,交付时间,创建人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } if (woobjs != null) { for (int i = 2; i <= woobjs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(woobjs[i - 2].PartsCode); cell = row.CreateCell(1); cell.SetCellValue(woobjs[i - 2].CustName); cell = row.CreateCell(2); cell.SetCellValue(woobjs[i - 2].CustCode); cell = row.CreateCell(3); cell.SetCellValue(woobjs[i - 2].ProductName); cell = row.CreateCell(4); cell.SetCellValue(woobjs[i - 2].PlanQuantity.ToString()); cell = row.CreateCell(5); cell.SetCellValue(woobjs[i - 2].QualityCode); cell = row.CreateCell(6); cell.SetCellValue(woobjs[i - 2].AskQuantity.ToString()); cell = row.CreateCell(7); cell.SetCellValue(woobjs[i - 2].BatchNumber); cell = row.CreateCell(8); cell.SetCellValue(woobjs[i - 2].AskDate.ToString()); cell = row.CreateCell(9); cell.SetCellValue(ws.FindUserNameByCode(woobjs[i - 2].UpdatedBy)); cell = row.CreateCell(10); cell.SetCellValue(woobjs[i - 2].UpdatedDate == null ? woobjs[i - 2].CreatedDate.ToString() : woobjs[i - 2].UpdatedDate.ToString()); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "PartsdrawingInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //string workorder = Request.QueryString["workorder"]; //string status = Request.QueryString["status"]; string partsdrawingno = Request.QueryString["partcode"]; string order = Request.QueryString["orderno"]; //string starttime = Request.QueryString["starttime"]; //string endtime = Request.QueryString["endtime"]; //DateTime dtstart = DateTime.Today.AddDays(-100); //DateTime dtend = DateTime.Now; //if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) //{ // dtstart = Convert.ToDateTime(starttime); // dtend = Convert.ToDateTime(endtime); //} //WorkOrder wo = new WorkOrder(); //wo.WO = workorder; //wo.STATUS = status=="4"?"":status; //wo.PartsdrawingCode = partsdrawingno; //wo.OrderNumber = order; //wo.StartTime = dtstart; //wo.EndTime = dtend; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <OrderDetail> objs = _bal.FindOrderInfo(order, partsdrawingno, "1"); //IList<WorkOrder> woobjs = _bal.FindWorkOrderInfo(wo); WsSystem ws = new WsSystem(); if (objs == null || objs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("OrderInfo"); row = hssfSheet.CreateRow(0); //填充头 string strobjs = "订单单号,零件图号,状态,客户名称,投产总数,产品名称,交付时间"; for (int i = 0; i < strobjs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(strobjs.Split(',')[i]); } if (objs != null) { for (int i = 2; i <= objs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objs[i - 2].OrderNo); cell = row.CreateCell(1); cell.SetCellValue(objs[i - 2].PartsdrawingCode); cell = row.CreateCell(2); cell.SetCellValue(objs[i - 2].MEMO); cell = row.CreateCell(3); cell.SetCellValue(objs[i - 2].CustName); cell = row.CreateCell(4); cell.SetCellValue(objs[i - 2].OrderQuantity.ToString()); cell = row.CreateCell(5); cell.SetCellValue(objs[i - 2].ProductName); cell = row.CreateCell(6); cell.SetCellValue(objs[i - 2].OutDate.ToString()); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "OrderInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string workorder = Request.QueryString["workorder"]; string status = Request.QueryString["status"]; string partsdrawingno = Request.QueryString["partsdrawingno"]; string order = Request.QueryString["order"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; DateTime dtstart = DateTime.Today.AddDays(-100); DateTime dtend = DateTime.Now; if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime)) { dtstart = Convert.ToDateTime(starttime); dtend = Convert.ToDateTime(endtime); } WorkOrderDetails wo = new WorkOrderDetails(); wo.WO = workorder; wo.STATUS = status == "4"?"":status; wo.PartsdrawingCode = partsdrawingno; wo.OrderNumber = order; wo.StartTime = dtstart; wo.EndTime = dtend; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <WorkOrderDetails> woobjs = _bal.FindWorkOrderDetailsInfo(wo); WsSystem ws = new WsSystem(); if (woobjs == null || woobjs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("WorkOrderInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "工单单号,订单单号,零件图号,工单状态,机床类型,机床名称,负责人员,产品名称,计划开始,计划结束,批次,计划数量,产出数量,计划检验,计划入库,操作人,时间,工序,工序号"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } if (woobjs != null) { for (int i = 2; i <= woobjs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(woobjs[i - 2].WO); cell = row.CreateCell(1); cell.SetCellValue(woobjs[i - 2].OrderNumber); cell = row.CreateCell(2); cell.SetCellValue(woobjs[i - 2].PartsdrawingCode); cell = row.CreateCell(3); cell.SetCellValue(woobjs[i - 2].StatusMemo); cell = row.CreateCell(4); cell.SetCellValue(woobjs[i - 2].MachineType); cell = row.CreateCell(5); cell.SetCellValue(woobjs[i - 2].MachineName); cell = row.CreateCell(6); cell.SetCellValue(woobjs[i - 2].WorkerName); cell = row.CreateCell(7); cell.SetCellValue(woobjs[i - 2].ProductName); cell = row.CreateCell(8); cell.SetCellValue(woobjs[i - 2].StartTime.ToString()); cell = row.CreateCell(9); cell.SetCellValue(woobjs[i - 2].EndTime.ToString()); cell = row.CreateCell(10); cell.SetCellValue(woobjs[i - 2].BatchNumber); cell = row.CreateCell(11); cell.SetCellValue(woobjs[i - 2].PlanQuantity.ToString()); cell = row.CreateCell(12); cell.SetCellValue(woobjs[i - 2].QUANTITY.ToString()); cell = row.CreateCell(13); cell.SetCellValue(woobjs[i - 2].CheckTime.ToString()); cell = row.CreateCell(14); cell.SetCellValue(woobjs[i - 2].InstockTime.ToString()); cell = row.CreateCell(15); cell.SetCellValue(ws.FindUserNameByCode(woobjs[i - 2].UpdatedBy)); cell = row.CreateCell(16); cell.SetCellValue(woobjs[i - 2].UpdatedDate == null ? woobjs[i - 2].CreatedDate.ToString() : woobjs[i - 2].UpdatedDate.ToString()); cell = row.CreateCell(17); cell.SetCellValue(woobjs[i - 2].StationName.ToString()); cell = row.CreateCell(18); cell.SetCellValue(woobjs[i - 2].RouteCode.ToString()); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "WorkOrderInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string orderno = Request.QueryString["orderno"]; string partdrawingno = Request.QueryString["partdrawingno"]; SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); IList <OrderDetail> objods = _bal.FindOrderInfo(orderno, partdrawingno); if (objods == null || objods.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("OrderStatusInfo"); row = hssfSheet.CreateRow(0); //填充头 string objs = "订单单号,零件图号,订单状态,客户名称,产品名称,订单数量,备注,交付时间,创建人,时间"; for (int i = 0; i < objs.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objs.Split(',')[i]); } string strstatus = string.Empty; for (int i = 2; i <= objods.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objods[i - 2].OrderNo); cell = row.CreateCell(1); cell.SetCellValue(objods[i - 2].PartsdrawingCode); cell = row.CreateCell(2); switch (objods[i - 2].STATUS) { case "0": strstatus = "创建"; break; case "1": strstatus = "发布"; break; case "2": strstatus = "发货通知"; break; case "3": strstatus = "关闭"; break; default: strstatus = "状态异常"; break; } cell.SetCellValue(strstatus); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 2].CustName); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 2].ProductName); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 2].OrderQuantity.ToString()); cell = row.CreateCell(6); cell.SetCellValue(objods[i - 2].BatchNumber); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 2].OutDate.ToString()); cell = row.CreateCell(8); cell.SetCellValue(objods[i - 2].UpdatedBy); cell = row.CreateCell(9); cell.SetCellValue(objods[i - 2].UpdatedDate.ToString()); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "OrderStatusInfo" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }
public SPMessage GetLabelParameters(string data, string labelId) { SystemBO _bal = BLLFactory.GetBal <SystemBO>(WebHelper.GetUserInfo()); return(_bal.GetLabelParameters(data, labelId)); }
protected void Page_Load(object sender, EventArgs e) { string workorder = Request.QueryString["workorder"]; string partsdrawing = Request.QueryString["partsdrawing"]; string starttime = Request.QueryString["starttime"]; string endtime = Request.QueryString["endtime"]; if (workorder == "undefined") { workorder = ""; } if (partsdrawing == "undefined") { partsdrawing = ""; } if (starttime == "undefined") { starttime = ""; } if (endtime == "undefined") { endtime = ""; } SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo); WorkOrder wo = new WorkOrder(); wo.WO = workorder; wo.PartsdrawingCode = partsdrawing; if (!string.IsNullOrEmpty(starttime) && starttime != "undefined") { wo.StartTime = Convert.ToDateTime(starttime); } if (!string.IsNullOrEmpty(endtime) && starttime != "undefined") { wo.EndTime = Convert.ToDateTime(endtime); } IList <WorkOrder> objs = _bal.FindWorkOrderInfo(wo); if (objs == null || objs.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("ProductMarQuery"); row = hssfSheet.CreateRow(0); //填充头 string objhead = @"订单号码,工单号码,零件图号,产品名称,生产人员,机床名称 , 计划数量, 产出数量,合格数量,废品数量,额定工时,额定总工时,实际总工时"; for (int i = 0; i < objhead.Split(',').Length; i++) { cell = row.CreateCell(i); cell.SetCellValue(objhead.Split(',')[i]); } for (int i = 1; i < objs.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objs[i - 1].OrderNumber); cell = row.CreateCell(1); cell.SetCellValue(objs[i - 1].WO); cell = row.CreateCell(2); cell.SetCellValue(objs[i - 1].PartsdrawingCode); cell = row.CreateCell(3); cell.SetCellValue(objs[i - 1].ProductName); cell = row.CreateCell(4); cell.SetCellValue(objs[i - 1].WorkerName); cell = row.CreateCell(5); cell.SetCellValue(objs[i - 1].MachineName); cell = row.CreateCell(6); cell.SetCellValue(objs[i - 1].PlanQuantity.ToString()); cell = row.CreateCell(7); cell.SetCellValue(objs[i - 1].QUANTITY.ToString()); cell = row.CreateCell(8); int[] fails = _bal.FindYieldCountInfo("", objs[i - 1].PartsdrawingCode); int passcount = (int)(objs[i - 1].QUANTITY == null ? 0 : objs[i - 1].QUANTITY) - fails[0]; //string passrate = (Math.Round((double)(passcount * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; //string failrate = (Math.Round((double)(fails[0] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; //string returnrate = (Math.Round((double)(fails[1] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; //string secpassrate = (Math.Round((double)(fails[2] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; //string dicardrate = (Math.Round((double)(fails[3] * 100 / (objs[i - 1].QUANTITY == null ? 1 : objs[i - 1].QUANTITY)), 2)).ToString() + "%"; cell.SetCellValue(passcount.ToString()); cell = row.CreateCell(9); cell.SetCellValue(fails[3].ToString()); cell = row.CreateCell(10); cell.SetCellValue(objs[i - 1].UnitTime.ToString()); cell = row.CreateCell(11); cell.SetCellValue((objs[i - 1].QUANTITY * objs[i - 1].UnitTime).ToString()); cell = row.CreateCell(12); cell.SetCellValue(_bal.FindActualTotalUnitTime(objs[i - 1].WO, objs[i - 1].PartsdrawingCode)); } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "ProductMarQuery" + DateTime.Now.ToString("yyyyMMddHHmmss"); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.BinaryWrite(file.GetBuffer()); Response.Flush(); Response.End(); }