You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
5.2 KiB
C#
137 lines
5.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using Estsh.Web.Service;
|
|
using System.Data;
|
|
using System.Collections;
|
|
using NPOI.HSSF.UserModel;
|
|
using System.IO;
|
|
using Estsh.Web.Util;
|
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
{
|
|
public class AirOvenController : Controller
|
|
{
|
|
AirOvenService completeSetService = new AirOvenService();
|
|
//
|
|
// GET: /Menu/
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 客户产线集合
|
|
/// </summary>
|
|
/// <returns>数据集</returns>
|
|
//public ActionResult GetCustPDLineName()
|
|
//{
|
|
// Hashtable resault = new Hashtable();
|
|
// ArrayList list = service.GetCustPDLineName();
|
|
// resault.Add("list", list);
|
|
// return Json(resault, JsonRequestBehavior.AllowGet);
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 获取列表数据
|
|
/// </summary>
|
|
/// <param name="PartMasterName">菜单名称</param>
|
|
/// <param name="pager">分页</param>
|
|
/// <param name="direction">排序方式</param>
|
|
/// <param name="sort">排序列</param>
|
|
/// <returns></returns>
|
|
public ActionResult getShippingListByPage(String txtStartTime, String txtEndTime, String shipping_sn, Pager pager)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
// result.Add("pager.pageNo", pager.pageNo);
|
|
Hashtable dataHt = this.completeSetService.getShippingListByPage(txtStartTime, txtEndTime, shipping_sn, pager);
|
|
result.Add("rows", dataHt["dataList"]);
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
// result.Add("sort", sort);
|
|
//result.Add("direction", direction);
|
|
//string startTime = Convert.ToDateTime(Request["txtStartTime"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
//string endTime = Convert.ToDateTime(Request["txtEndTime"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
return Json(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出数据到Excel
|
|
/// </summary>
|
|
/// <param name="pager"></param>
|
|
/// <param name="txtOrderNo"></param>
|
|
/// <param name="sort"></param>
|
|
/// <param name="direction"></param>
|
|
/// <param name="isPage"></param>
|
|
/// <returns></returns>
|
|
public ActionResult exportData(String txtStartTime, String txtEndTime, String shipping_sn, Pager pager, String sort, String direction, String isPage)
|
|
{
|
|
|
|
Boolean paging = false;
|
|
if (isPage == null || "".Equals(isPage))
|
|
{
|
|
paging = false;
|
|
}
|
|
else
|
|
{
|
|
if ("1".Equals(isPage.Trim()))
|
|
{
|
|
paging = true;
|
|
}
|
|
else
|
|
{
|
|
paging = false;
|
|
}
|
|
}
|
|
DataTable dataHt = this.completeSetService.getShippingExport(txtStartTime, txtEndTime, shipping_sn, pager);
|
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
|
Stream outputStream = Response.OutputStream;
|
|
HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("烘箱信息查询");
|
|
try
|
|
{
|
|
if (workbook != null)
|
|
{
|
|
HSSFRow headRow = (HSSFRow)sheet.CreateRow(0);
|
|
headRow.CreateCell(1).SetCellValue("条码");
|
|
headRow.CreateCell(2).SetCellValue("靠背温度");
|
|
headRow.CreateCell(3).SetCellValue("坐垫温度");
|
|
headRow.CreateCell(4).SetCellValue("加热时间");
|
|
headRow.CreateCell(7).SetCellValue("测试日期");
|
|
headRow.CreateCell(10).SetCellValue("测试时间");
|
|
}
|
|
|
|
for (int i = 0; i < dataHt.Rows.Count; i++)
|
|
{
|
|
int row = i + 1;
|
|
HSSFRow dataRow = (HSSFRow)sheet.CreateRow(row);
|
|
|
|
dataRow.CreateCell(1).SetCellValue(dataHt.Rows[i]["条码"].ToString());
|
|
dataRow.CreateCell(2).SetCellValue(dataHt.Rows[i]["靠背温度"].ToString());
|
|
dataRow.CreateCell(3).SetCellValue(dataHt.Rows[i]["坐垫温度"].ToString());
|
|
dataRow.CreateCell(4).SetCellValue(dataHt.Rows[i]["加热时间"].ToString());
|
|
dataRow.CreateCell(7).SetCellValue(dataHt.Rows[i]["测试日期"].ToString());
|
|
dataRow.CreateCell(10).SetCellValue(dataHt.Rows[i]["测试时间"].ToString());
|
|
}
|
|
|
|
Response.Clear();
|
|
workbook.Write(outputStream);
|
|
|
|
Response.Buffer = true;
|
|
Response.AppendHeader("Content-Disposition", "attachment;filename=烘箱信息查询.xls");
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
Response.ContentType = "application/vnd.ms-excel";
|
|
Response.Flush();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
}
|
|
finally
|
|
{
|
|
workbook = null;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |