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.
306 lines
10 KiB
C#
306 lines
10 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using Estsh.Web.Util;
|
|
using Estsh.Web.Service;
|
|
using System.Collections;
|
|
|
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
{
|
|
public class WorkOrderDefineController : Controller
|
|
{
|
|
private WorkOrderDefineService service = new WorkOrderDefineService();
|
|
|
|
//
|
|
// GET: /Workorder/
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载功能树
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult getWorkorderTree()
|
|
{
|
|
string path = Request.ApplicationPath; if (path.EndsWith("/")) { path = path.Substring(0, path.Length - 1); }
|
|
List<TreeNode> treeNodes = new List<TreeNode>();
|
|
treeNodes = service.getWorkorderList("isIndex = '是'", " RUID ASC ", path);
|
|
Hashtable result = new Hashtable();
|
|
result.Add("treeNodes", treeNodes);
|
|
String json = Estsh.Web.Util.JSON.Encode(result);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取菜单管理列表数据
|
|
/// </summary>
|
|
/// <param name="workorder_no"></param>
|
|
/// <param name="pager"></param>
|
|
/// <param name="direction"></param>
|
|
/// <param name="sort"></param>
|
|
/// <returns></returns>
|
|
public ActionResult getWorkOrderListByPage(String workorder_no, Pager pager, String direction, String sort)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
result.Add("pager.pageNo",pager.pageNo);
|
|
ArrayList menuList = this.service.getWorkOrderListByPage(workorder_no,pager,direction,sort);
|
|
result.Add("rows", menuList);
|
|
int total = this.service.getWorkorderCount(workorder_no);
|
|
result.Add("pager.totalRows",total);
|
|
result.Add("sort",sort);
|
|
result.Add("direction", direction);
|
|
return Json(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 工单状态
|
|
/// </summary>
|
|
/// <rehuoturns></returns>
|
|
public ActionResult getSelectWorkorder()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getSelectWO_status();
|
|
result.Add("list", menuList);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 零件号
|
|
/// </summary>
|
|
/// <rehuoturns></returns>
|
|
public ActionResult getSelectPart_no()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getSelectPart_no();
|
|
result.Add("list", menuList);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 产线信息
|
|
/// </summary>
|
|
/// <rehuoturns></returns>
|
|
public ActionResult getSelectPackSpec()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getSelectPackSpec();
|
|
result.Add("list", menuList);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 流程信息
|
|
/// </summary>
|
|
/// <rehuoturns></returns>
|
|
public ActionResult getSelectRoute()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getSelectRoute();
|
|
result.Add("list", menuList);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取 流程信息
|
|
/// </summary>
|
|
/// <rehuoturns></returns>
|
|
public ActionResult getSelectModel()
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getSelectModel();
|
|
result.Add("list", menuList);
|
|
return Json(result, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存菜单数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult saveWorkorder()
|
|
{
|
|
String editType = Request["editType"].ToString();
|
|
|
|
String ruid = Request["ruid"].ToString();
|
|
String workorder_no = Request["workorder_no"].ToString();
|
|
//String part_no = Request["part_no"].ToString();
|
|
String part_id = Request["part_id"].ToString();
|
|
String wo_status = Request["wo_status"].ToString();
|
|
//String timestamp = Request["timestamp"].ToString();
|
|
String target_qty = Request["target_qty"].ToString();
|
|
//String spec_name = Request["spec_name"].ToString();
|
|
String pdline_id = Request["pdline_id"].ToString();
|
|
//String model_name = Request["model_name"].ToString();
|
|
String model_id = Request["model_id"].ToString();
|
|
//String route_name = Request["route_name"].ToString();
|
|
String route_id = Request["route_id"].ToString();
|
|
String remark = Request["remark"].ToString();
|
|
String enabled = Request["enabled"].ToString();
|
|
|
|
//传递要更新的数据库字段 2013 0417 14:05 by NOAH
|
|
Hashtable htParams = new Hashtable();
|
|
htParams.Add("@workorder_no", workorder_no);
|
|
htParams.Add("@part_id", part_id);
|
|
htParams.Add("@wo_status", wo_status);
|
|
htParams.Add("@target_qty", target_qty);
|
|
htParams.Add("@pdline_id", pdline_id);
|
|
htParams.Add("@model_id", model_id);
|
|
htParams.Add("@route_id", route_id);
|
|
htParams.Add("@remark", remark);
|
|
htParams.Add("@enabled", enabled);
|
|
String message = "";
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
{
|
|
try
|
|
{
|
|
htParams.Add("@ruid",ruid);
|
|
this.service.updateWorkorder(htParams);
|
|
message = "修改成功";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
message = "修改失败!";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
//先判断是否有重复的工单
|
|
if (this.service.ExistsWorkOrder(workorder_no))
|
|
{
|
|
message = "已经存在同名单号";
|
|
}
|
|
else
|
|
{
|
|
this.service.saveWorkorder(htParams);
|
|
message = "添加成功";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
message = "添加失败!";
|
|
}
|
|
}
|
|
|
|
Hashtable result = new Hashtable();
|
|
result.Add("message", message);
|
|
return Json(result) ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看菜单详情
|
|
/// </summary>
|
|
/// <param name="ruid"></param>
|
|
/// <returns></returns>
|
|
public ActionResult getWorkorderDetail(String ruid)
|
|
{
|
|
Hashtable ht = this.service.getWorkorderDetail(ruid);
|
|
ViewData.Add("ruid",ht["ruid"]);
|
|
|
|
ViewData.Add("workorder_no", ht["workorder_no"]);
|
|
ViewData.Add("part_no", ht["part_no"]);
|
|
ViewData.Add("part_id", ht["part_id"]);
|
|
ViewData.Add("wo_status", ht["wo_status"]);
|
|
ViewData.Add("timestamp", ht["timestamp"]);
|
|
ViewData.Add("target_qty", ht["target_qty"]);
|
|
ViewData.Add("spec_name", ht["spec_name"]);
|
|
ViewData.Add("ruid", ht["ruid"]);
|
|
ViewData.Add("model_id", ht["model_id"]);
|
|
ViewData.Add("route_id", ht["route_id"]);
|
|
ViewData.Add("model_name", ht["model_name"]);
|
|
ViewData.Add("route_name", ht["route_name"]);
|
|
ViewData.Add("remark", ht["remark"]);
|
|
ViewData.Add("enabled", ht["enabled"]);
|
|
|
|
return View("~/Views/WorkOrderDefine/ViewWorkOrderDefine.aspx");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑菜单
|
|
/// </summary>
|
|
/// <param name="ruid"></param>
|
|
/// <returns></returns>
|
|
public ActionResult editWorkorder(String ruid)
|
|
{
|
|
Hashtable ht = this.service.getWorkorderDetail(ruid);
|
|
ViewData.Add("editType", "edit");
|
|
|
|
ViewData.Add("ruid", ht["ruid"]);
|
|
ViewData.Add("workorder_no", ht["workorder_no"]);
|
|
ViewData.Add("part_no", ht["part_no"]);
|
|
ViewData.Add("part_id", ht["part_id"]);
|
|
ViewData.Add("wo_status", ht["wo_status"]);
|
|
ViewData.Add("timestamp", ht["timestamp"]);
|
|
ViewData.Add("target_qty", ht["target_qty"]);
|
|
ViewData.Add("spec_name", ht["spec_name"]);
|
|
ViewData.Add("ruid", ht["ruid"]);
|
|
ViewData.Add("route_id", ht["route_id"]);
|
|
ViewData.Add("model_id", ht["model_id"]);
|
|
ViewData.Add("model_name", ht["model_name"]);
|
|
ViewData.Add("route_name", ht["route_name"]);
|
|
ViewData.Add("remark", ht["remark"]);
|
|
ViewData.Add("enabled", ht["enabled"]);
|
|
|
|
return View("~/Views/WorkOrderDefine/EditWorkOrderDefine.aspx");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除菜单
|
|
/// </summary>
|
|
/// <param name="ids"></param>
|
|
/// <returns></returns>
|
|
public ActionResult deleteWorkorder(String ids)
|
|
{
|
|
int delCount = 0;
|
|
try
|
|
{
|
|
delCount = this.service.deleteWorkorder(ids);
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
delCount = -1;
|
|
}
|
|
Hashtable result = new Hashtable();
|
|
result.Add("status", delCount);
|
|
return Json(result);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取工单条码相信信息 用于‘修改’弹出框的‘条码信息’ 中的数据显示
|
|
/// BY NOAH
|
|
/// </summary>
|
|
/// <param name="workorder_no"></param>
|
|
/// <returns></returns>
|
|
public ActionResult getWorkOrder_sn_meaage(String workorder_no)
|
|
{
|
|
Hashtable result = new Hashtable();
|
|
ArrayList menuList = this.service.getWorkOrder_sn_meaage(workorder_no);
|
|
result.Add("rows", menuList);
|
|
return Json(result);
|
|
}
|
|
}
|
|
}
|