|
|
using Dapper;
|
|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
using System.Collections;
|
|
|
using System.Data;
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:安灯信息查询
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class AndonInfoQueryController : BaseController
|
|
|
{
|
|
|
private IAndonInfoQueryService service;
|
|
|
private IWebHostEnvironment hostingEnvironment;
|
|
|
public AndonInfoQueryController(IAndonInfoQueryService _service,IWebHostEnvironment _hostingEnvironment)
|
|
|
{
|
|
|
service = _service;
|
|
|
hostingEnvironment = _hostingEnvironment;
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /Menu/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取安灯信息查询列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="partNo_search"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getListByPage(String txtStartTime, String txtEndTime,string type, Pager pager, String direction, String sort, String enabled = "Y")
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getListByPage(txtStartTime, txtEndTime,type, pager, direction, sort, enabled);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取 类型 信息
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getTypeData()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getTypeData();
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出数据到Excel
|
|
|
/// BY NOAH
|
|
|
/// </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 type, 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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Hashtable dataHt = this.service.getTableListByPage(txtStartTime, txtEndTime,type, pager, direction, sort, paging);//txtOrderNo, pager, direction, sort, paging
|
|
|
List<AndonInfoQuery> listHt = (List<AndonInfoQuery>)dataHt["dataList"];
|
|
|
var memoryStream = ExcelHelper.ToExcel(listHt);
|
|
|
return File(memoryStream.ToArray(), "application/ms-excel", "安灯信息查询.xls");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public ActionResult getAndonCount(String txtStartTime, String txtEndTime, string type)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
String strWhere = " AND 1=1 ";
|
|
|
|
|
|
if (!String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
|
|
|
{
|
|
|
strWhere += " AND ( g.startTime > '" + txtStartTime + "' AND g.endTime < '" + txtEndTime + "') ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(type))
|
|
|
{
|
|
|
strWhere += " AND g.andon_type = '" + type.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
DataTable dtList = new DataTable();
|
|
|
List<GAndonLog> AndonCount = service.getAndonCount(strWhere);
|
|
|
|
|
|
dtList.Columns.Add("item");
|
|
|
dtList.Columns.Add("lyl");
|
|
|
DataRow dr = null;
|
|
|
for (int i = 0; i < AndonCount.Count; i++)
|
|
|
{
|
|
|
string item = AndonCount[i].StationName.ToString();
|
|
|
string value = AndonCount[i].Qty.ToString();
|
|
|
dr = dtList.NewRow();
|
|
|
dr["item"] = item;
|
|
|
dr["lyl"] = value;
|
|
|
dtList.Rows.Add(dr);
|
|
|
}
|
|
|
|
|
|
DataTable dataHt = dtList;
|
|
|
result.Add("rows", DataTypeConvert.NewObject.DataTableToArrayList(dataHt));
|
|
|
result.Add("pager.totalRows", dtList.Rows.Count);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
public ActionResult getAndonTime(String txtStartTime, String txtEndTime, string type)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
String strWhere = " AND 1=1 ";
|
|
|
|
|
|
if (!String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
|
|
|
{
|
|
|
strWhere += " AND ( g.startTime > '" + txtStartTime + "' AND g.endTime < '" + txtEndTime + "') ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(type))
|
|
|
{
|
|
|
strWhere += " AND g.andon_type = '" + type.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
DataTable dtList = new DataTable();
|
|
|
List<GAndonLog> AndonCount = service.getAndonTime(strWhere);
|
|
|
|
|
|
dtList.Columns.Add("item");
|
|
|
dtList.Columns.Add("lyl");
|
|
|
DataRow dr = null;
|
|
|
for (int i = 0; i < AndonCount.Count; i++)
|
|
|
{
|
|
|
string item = AndonCount[i].StationName.ToString();
|
|
|
string value = AndonCount[i].Sj.ToString();
|
|
|
dr = dtList.NewRow();
|
|
|
dr["item"] = item;
|
|
|
dr["lyl"] = value;
|
|
|
dtList.Rows.Add(dr);
|
|
|
}
|
|
|
|
|
|
DataTable dataHt = dtList;
|
|
|
result.Add("rows", DataTypeConvert.NewObject.DataTableToArrayList(dataHt));
|
|
|
result.Add("pager.totalRows", dtList.Rows.Count);
|
|
|
return Json(result);
|
|
|
}
|
|
|
}
|
|
|
}
|