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.

181 lines
6.6 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Collections;
using Estsh.Web.Service;
using Estsh.Web.Util;
using System.Data;
namespace Estsh.Core.Web.Controllers
{
public class ViewPhotosDefineController : Controller
{
/***************************************************************************************************
*
* 作者:张茂忠
* 创建时间2013.04.18
* 描述盘点单打印模块Controller层
* 修改日志:
*
*
* *************************************************************************************************/
private ViewPhotosDefineService service = new ViewPhotosDefineService();
public ActionResult Index()
{
return View();
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="menuName">查询条件</param>
/// <param name="pager"></param>
/// <param name="direction">排序方式</param>
/// <param name="sort">排序字段</param>
/// <returns></returns>
public ActionResult getListByPage(String BaseName, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String _where = " 0=0 ";
if (!string.IsNullOrEmpty(Request["model_type"]))
{
_where += " and a.type_name = '" + Request["model_type"].ToString() + "'";
}
if (!string.IsNullOrEmpty(Request["model_name"]))
{
_where += " and b.model_name ='" + Request["model_name"].ToString() + "'";
}
if (!string.IsNullOrEmpty(Request["terminal_name"]))
{
_where += " and e.view_board_name ='" + Request["terminal_name"].ToString() + "'";
}
if (!string.IsNullOrEmpty(Request["StartTime"]) && !string.IsNullOrEmpty(Request["EndTime"]))
{
_where += " and c.create_ymd between convert(datetime, '" + Request["StartTime"].ToString() + "') and convert(datetime, '" + Request["EndTime"].ToString() + "') ";
}
result.Add("pager.pageNo", pager.pageNo);
if (_where != " 0=0 ")
{
Hashtable dataHt = this.service.getListByPage(_where, pager, direction, sort);
result.Add("rows", dataHt["dataList"]);
result.Add("pager.totalRows", dataHt["totalCount"]);
result.Add("sort", sort);
result.Add("direction", direction);
}
return Json(result);
}
/// <summary>
/// 获取车型名称
/// </summary>
/// <returns></returns>
public ActionResult GetModelType()
{
Hashtable resault = new Hashtable();
ArrayList list = service.GetModelType();
resault.Add("list", list);
return Json(resault, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 获取配置名称
/// </summary>
/// <returns></returns>
public ActionResult GetModel()
{
Hashtable resault = new Hashtable();
if (!string.IsNullOrEmpty(Request["model_type_id"]))
{
ArrayList list = service.GetModel(" and model_type_id=(SELECT type_id FROM sys_model_type WHERE type_name='" + Request["model_type_id"].ToString() + "')");
resault.Add("list", list);
}
return Json(resault, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 获取工位名称
/// </summary>
/// <returns></returns>
public ActionResult Getview_board()
{
Hashtable resault = new Hashtable();
ArrayList list = service.Getview_board("1044,1046,1047,1052");
resault.Add("list", list);
return Json(resault, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 获取所有产线名称
/// </summary>
/// <returns></returns>
public ActionResult GetPDLineName()
{
Hashtable resault = new Hashtable();
ArrayList list = service.GetPDLineName();
resault.Add("list", list);
return Json(resault, JsonRequestBehavior.AllowGet);
}
public ActionResult show(string ids)
{
Hashtable resault = new Hashtable();
string str = "http://10.178.156.224/";
DataTable dt = service.GetRow(ids);
if (dt != null && dt.Rows.Count > 0)
{
if (dt.Rows[0]["terminal_id"].ToString() == "100045")
{
if (dt.Rows[0]["file_path"].ToString().Substring(0, 1) != "F")
{
str += "F" + dt.Rows[0]["file_path"].ToString();
}
else
{
str += dt.Rows[0]["file_path"].ToString();
}
}
else if (dt.Rows[0]["terminal_id"].ToString() == "100046")
{
if (dt.Rows[0]["file_path"].ToString().Substring(0, 1) != "F")
{
str += "F" + dt.Rows[0]["file_path"].ToString();
}
else
{
str += dt.Rows[0]["file_path"].ToString();
}
}
else if (dt.Rows[0]["terminal_id"].ToString() == "100043")
{
if (dt.Rows[0]["file_path"].ToString().Substring(0, 1) != "B")
{
str += "B" + dt.Rows[0]["file_path"].ToString();
}
else
{
str += dt.Rows[0]["file_path"].ToString();
}
}
else if (dt.Rows[0]["terminal_id"].ToString() == "100051")
{
if (dt.Rows[0]["file_path"].ToString().Substring(0, 1) != "B")
{
str += "B" + dt.Rows[0]["file_path"].ToString();
}
else
{
str += dt.Rows[0]["file_path"].ToString();
}
}
else
{
str += dt.Rows[0]["file_path"].ToString();
}
}
System.Diagnostics.Process.Start(str);
resault.Add("status", str);
return Json(resault);
}
}
}