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(); } /// /// 获取列表数据 /// /// 查询条件 /// /// 排序方式 /// 排序字段 /// 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); } /// /// 获取车型名称 /// /// public ActionResult GetModelType() { Hashtable resault = new Hashtable(); ArrayList list = service.GetModelType(); resault.Add("list", list); return Json(resault, JsonRequestBehavior.AllowGet); } /// /// 获取配置名称 /// /// 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); } /// /// 获取工位名称 /// /// 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); } /// /// 获取所有产线名称 /// /// 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); } } }