protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { BasBase bb = new BasBase(); bb.CODE = dt.Rows[i][0].ToString(); bb.NAME = dt.Rows[i][1].ToString(); bb.SubCode = dt.Rows[i][2].ToString(); bb.SubName = dt.Rows[i][3].ToString(); bb.MEMO = dt.Rows[i][4].ToString(); wbi.SaveBaseInfo(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected void Page_Load(object sender, EventArgs e) { string TemplateType = Request.QueryString["TemplateType"]; WsSystem ws = new WsSystem(); PrintSet obj = ws.QueryPrintSetPath(TemplateType); if (obj != null) { string name = string.Empty; if (obj.MEMO == "箱号模板") { name = "csn.lab"; } if (obj.MEMO == "条码模板") { name = "psn.lab"; } else { name = "msn.lab"; } downloadfile(obj.TemplatePath, name); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { FailItems bb = new FailItems(); bb.FailCode = dt.Rows[i][0].ToString(); bb.FailType = dt.Rows[i][1].ToString(); bb.FailMemo = dt.Rows[i][2].ToString(); bb.MEMO1 = dt.Rows[i][3].ToString(); wbi.SaveFailItems(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected void BindTemplateType() { WsSystem ws = new WsSystem(); TextValueInfo[] vts = ws.ListBindTemplateType(); for (var i = 0; i < vts.Length; i++) { DropDownList1.Items.Add(new ListItem(vts[i].Text, vts[i].Value)); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { WorkOrderDetails bb = new WorkOrderDetails(); bb.WO = wbi.GetWorkOrderCode();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString(); bb.OrderNumber = dt.Rows[i][0].ToString(); bb.PartsdrawingCode = dt.Rows[i][1].ToString(); bb.MachineType = dt.Rows[i][2].ToString(); bb.MachineName = dt.Rows[i][3].ToString(); bb.ProductName = dt.Rows[i][4].ToString(); bb.StartTime = Convert.ToDateTime(dt.Rows[i][5].ToString()); bb.EndTime = Convert.ToDateTime(dt.Rows[i][6].ToString()); bb.BatchNumber = dt.Rows[i][7].ToString(); bb.PlanQuantity = Convert.ToDecimal(dt.Rows[i][8].ToString()); bb.CheckTime = Convert.ToDateTime(dt.Rows[i][9].ToString()); bb.InstockTime = Convert.ToDateTime(dt.Rows[i][10].ToString()); string res = wbi.SaveWorkOrderInfo(bb); if (res != "OK") { Label1.Text = res; return(false); } } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); string orderno = wbi.GetOrderNoCode(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { OrderDetail bb = new OrderDetail(); bb.OrderNo = orderno;// dt.Rows[i][0].ToString(); bb.CustName = dt.Rows[i][0].ToString(); bb.CONTRACT = dt.Rows[i][1].ToString(); bb.ProductName = dt.Rows[i][2].ToString(); bb.PartsdrawingCode = dt.Rows[i][3].ToString(); bb.BatchNumber = dt.Rows[i][4].ToString(); bb.OrderQuantity = Convert.ToDecimal(dt.Rows[i][5].ToString()); bb.OutDate = Convert.ToDateTime(dt.Rows[i][6].ToString()); bb.CheckTime = Convert.ToDateTime(dt.Rows[i][7].ToString()); string res = wbi.SaveOrderInfo(bb); if (res != "OK") { Label1.Text = res; return(false); } } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
public string FindUserNameByCode(string userCode) { WsSystem ws = new WsSystem(); SysUser su = ws.FindUserByCode(userCode); //Dictionary<String, Object> map = new Dictionary<String, Object>(); // map.Add("name", su.UserName); //Context.Response.Write(JsonConvert.SerializeObject(map)); if (su != null) { return(su.UserName); } else { return(""); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { PartsdrawingCode bb = new PartsdrawingCode(); bb.ID = PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString(); bb.PartsCode = dt.Rows[i][0].ToString(); bb.CustName = dt.Rows[i][1].ToString(); bb.CustCode = dt.Rows[i][2].ToString(); bb.ProductName = dt.Rows[i][3].ToString(); bb.ProductCode = dt.Rows[i][4].ToString(); bb.PlanQuantity = Convert.ToDecimal(dt.Rows[i][5].ToString()); bb.QualityCode = dt.Rows[i][6].ToString(); bb.AskQuantity = Convert.ToDecimal(dt.Rows[i][7].ToString()); bb.BatchNumber = dt.Rows[i][8].ToString(); bb.AskDate = Convert.ToDateTime(dt.Rows[i][9].ToString()); bb.ACTIVE = "1"; wbi.SavePartsDrawing(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { BasEquipment bb = new BasEquipment(); bb.CODE = dt.Rows[i][0].ToString(); bb.COMPANY = dt.Rows[i][1].ToString(); bb.MachineName = dt.Rows[i][2].ToString(); bb.MachineType = dt.Rows[i][3].ToString(); bb.AxisNumber = dt.Rows[i][4].ToString(); bb.MODEL = dt.Rows[i][5].ToString(); bb.POWER = dt.Rows[i][6].ToString(); bb.LOCATION = dt.Rows[i][7].ToString(); bb.STATUS = dt.Rows[i][8].ToString(); bb.OutCode = dt.Rows[i][9].ToString(); bb.UseDate = Convert.ToDateTime(string.IsNullOrEmpty(dt.Rows[i][10].ToString())?DateTime.Now.ToShortDateString(): dt.Rows[i][10].ToString()); wbi.SaveEquipmentInfo(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { WorkOrderDetails bb = new WorkOrderDetails(); bb.WO = dt.Rows[i][0].ToString();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString(); bb.WorkerName = dt.Rows[i][1].ToString(); bb.WORKER = wbi.FindUserCodeByUserName(bb.WorkerName); bb.StationName = dt.Rows[i][2].ToString(); bb.RouteCode = dt.Rows[i][3].ToString(); string res = wbi.SaveWorkOrderAssign(bb); if (res != "OK") { Label1.Text = res; return(false); } } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string savepath) { try { string templatetype = DropDownList1.SelectedItem.Value; string templatetypename = DropDownList1.SelectedItem.Text; WsSystem ws = new WsSystem(); PrintSet bb = new PrintSet(); bb.ID = ""; bb.TemplatePath = savepath; bb.TemplateType = templatetype; bb.MEMO = templatetypename; bb.ACTIVE = "0"; ws.SavePrintLabelTemplate(bb); return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { TechnologyWip bb = new TechnologyWip(); bb.PARTSDRAWINGNO = dt.Rows[i][0].ToString();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString(); bb.CustName = dt.Rows[i][1].ToString(); bb.ProductName = dt.Rows[i][2].ToString(); bb.ProcessName = dt.Rows[i][3].ToString(); bb.ProcessEngineer = wbi.FindUserCodeByUserName(bb.ProcessName); bb.PlanDate = Convert.ToDateTime(dt.Rows[i][4].ToString()); bb.STATUS = 1; bb.StatusMemo = "分派工艺"; wbi.SaveTechnologyInfoForImport(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { BasMateriel bb = new BasMateriel(); bb.QPARTNO = dt.Rows[i][0].ToString(); bb.CPARTNO = dt.Rows[i][1].ToString(); bb.NAME = dt.Rows[i][2].ToString(); bb.BasQty = Convert.ToInt32(dt.Rows[i][3].ToString()); bb.CUSTOMER = dt.Rows[i][4].ToString(); bb.MEMO = dt.Rows[i][5].ToString(); wbi.SaveMaterielInfo(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }
protected void Page_Load(object sender, EventArgs e) { string workorder = Request.QueryString["workorder"]; string status = Request.QueryString["status"]; string productname = Request.QueryString["productname"]; 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); } WareHouseBO _bal = BLLFactory.GetBal <WareHouseBO>(userInfo); WsSystem ws = new WsSystem(); IList <ProductStock> objstock = null; IList <ProductStockHistory> objhistory = null; if (status == "2") { objstock = _bal.FindProductStockInfo(workorder, productname, batchnumber, starttime, endtime); } else { if (status == "3") { status = ""; } objhistory = _bal.FindProductStockHistory(status, workorder, productname, batchnumber, starttime, endtime); } if (objstock == null && objhistory.Count == 0) { Response.Write("no data"); return; } HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); Row row = null; Cell cell = null; Sheet hssfSheet = hssfWorkbook.CreateSheet("ProductInfo"); 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 (objstock != null) { for (int i = 1; i < objstock.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objstock[i - 1].PSN); cell = row.CreateCell(1); cell.SetCellValue(objstock[i - 1].WorkOrder); cell = row.CreateCell(2); cell.SetCellValue(objstock[i - 1].MANUFACTURE); cell = row.CreateCell(3); cell.SetCellValue(objstock[i - 1].DOCUMENTID); cell = row.CreateCell(4); cell.SetCellValue(objstock[i - 1].StockHouse); cell = row.CreateCell(5); cell.SetCellValue(objstock[i - 1].ProductCode); cell = row.CreateCell(6); cell.SetCellValue(objstock[i - 1].ProductName); cell = row.CreateCell(7); cell.SetCellValue(objstock[i - 1].UNIT); cell = row.CreateCell(8); cell.SetCellValue(objstock[i - 1].QUANTITY.ToString()); cell = row.CreateCell(9); cell.SetCellValue(objstock[i - 1].BatchNumber); cell = row.CreateCell(10); cell.SetCellValue(ws.FindUserNameByCode(objstock[i - 1].UpdatedBy)); cell = row.CreateCell(11); cell.SetCellValue(ws.FindUserNameByCode(objstock[i - 1].FromBy)); cell = row.CreateCell(12); cell.SetCellValue(objstock[i - 1].UpdatedDate == null ? objstock[i - 1].CreatedDate.ToString() : objstock[i - 1].UpdatedDate.ToString()); } } else { for (int i = 1; i < objhistory.Count + 1; i++) { row = hssfSheet.CreateRow(i); cell = row.CreateCell(0); cell.SetCellValue(objhistory[i - 1].PSN); cell = row.CreateCell(1); cell.SetCellValue(objhistory[i - 1].WorkOrder); cell = row.CreateCell(2); cell.SetCellValue(objhistory[i - 1].MANUFACTURE); cell = row.CreateCell(3); cell.SetCellValue(objhistory[i - 1].DOCUMENTID); cell = row.CreateCell(4); cell.SetCellValue(objhistory[i - 1].StockHouse); cell = row.CreateCell(5); cell.SetCellValue(objhistory[i - 1].ProductCode); cell = row.CreateCell(6); cell.SetCellValue(objhistory[i - 1].ProductName); cell = row.CreateCell(7); cell.SetCellValue(objhistory[i - 1].UNIT); cell = row.CreateCell(8); cell.SetCellValue(objhistory[i - 1].QUANTITY.ToString()); cell = row.CreateCell(9); cell.SetCellValue(objhistory[i - 1].BatchNumber); cell = row.CreateCell(10); cell.SetCellValue(ws.FindUserNameByCode(objhistory[i - 1].UpdatedBy)); cell = row.CreateCell(11); cell.SetCellValue(ws.FindUserNameByCode(objhistory[i - 1].FromBy)); cell = row.CreateCell(12); cell.SetCellValue(objhistory[i - 1].UpdatedDate == null ? objhistory[i - 1].CreatedDate.ToString() : objhistory[i - 1].UpdatedDate.ToString()); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "ProductInfo" + 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 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 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 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("", "1^3", sn, materialname, custname, starttime, endtime, batchnumber); 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("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].WorkOrder); cell = row.CreateCell(2); cell.SetCellValue(objods[i - 1].MaterialCode); cell = row.CreateCell(3); cell.SetCellValue(objods[i - 1].MaterialName); cell = row.CreateCell(4); cell.SetCellValue(objods[i - 1].BatchNumber); cell = row.CreateCell(5); cell.SetCellValue(objods[i - 1].QUANTITY.ToString()); cell = row.CreateCell(6); IList <BasBase> ibb = _bal.FindBaseBySubCode(objods[i - 1].StockHouse); cell.SetCellValue(ibb[0].SubName); cell = row.CreateCell(7); cell.SetCellValue(objods[i - 1].DOCUMENTID); cell = row.CreateCell(8); cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy)); cell = row.CreateCell(9); cell.SetCellValue(objods[i - 1].MaterialHandler); cell = row.CreateCell(10); 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 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 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["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 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 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 startTime = Request.QueryString["startTime"]; string endTime = Request.QueryString["endTime"]; string baseCode = Request.QueryString["baseName"]; BasicBO _bal = BLLFactory.GetBal <BasicBO>(userInfo); IList <BasBase> baseInfo = _bal.FindBaseByCode(startTime, endTime, baseCode); WsSystem ws = new WsSystem(); 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("BaseInfo"); 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].CODE); cell = row.CreateCell(1); cell.SetCellValue(baseInfo[i - 2].NAME); cell = row.CreateCell(2); cell.SetCellValue(baseInfo[i - 2].SubCode); cell = row.CreateCell(3); cell.SetCellValue(baseInfo[i - 2].SubName); cell = row.CreateCell(4); cell.SetCellValue(ws.FindUserNameByCode(baseInfo[i - 2].UpdatedBy)); cell = row.CreateCell(5); cell.SetCellValue(baseInfo[i - 2].UpdatedDate == null ? baseInfo[i - 2].CreatedDate.ToString() : baseInfo[i - 2].UpdatedDate.ToString()); } } MemoryStream file = new MemoryStream(); hssfWorkbook.Write(file); String fileName = "BaseInfo" + 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(); }