|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Collections;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:制程管控制类
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class ProcessDefineController : BaseController
|
|
|
{
|
|
|
private IProcessDefineService service;
|
|
|
private ICommonService commonService;
|
|
|
public ProcessDefineController(IProcessDefineService _service, ICommonService _commonService)
|
|
|
{
|
|
|
service = _service;
|
|
|
commonService = _commonService;
|
|
|
}
|
|
|
// GET: /Menu/
|
|
|
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 getProcessListByPage(String menuName, Pager pager, String direction, String sort, String enabled = "Y")
|
|
|
{
|
|
|
String factoryId = CurrentEmp.FactoryId.ToString();
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo",pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getProcessListByPage(menuName,pager,direction,sort, factoryId, enabled);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取工厂下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getFactoryInfo()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = commonService.getFactoryInfo();
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取区段下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getStageInfo()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getStageInfo();
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取作业类型下拉列表数据
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getOperateType()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> menuList = this.service.getOperateType();
|
|
|
result.Add("list", menuList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存制程数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveProcess()
|
|
|
{
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
String processId = Request.Form["processId"].ToString();
|
|
|
String processName = Request.Form["processName"].ToString();
|
|
|
String processDesc = Request.Form["processDesc"].ToString();
|
|
|
String processCode = Request.Form["processCode"].ToString();
|
|
|
String factoryId = Request.Form["factoryId"].ToString();
|
|
|
String stageId = Request.Form["stageId"].ToString();
|
|
|
String typeId = Request.Form["typeId"].ToString();
|
|
|
String enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
SysProcess sysProcess = new SysProcess();
|
|
|
sysProcess.ProcessName = processName;
|
|
|
sysProcess.ProcessCode = processCode;
|
|
|
sysProcess.ProcessDesc = processDesc;
|
|
|
sysProcess.FactoryId = Convert.ToInt32(factoryId);
|
|
|
sysProcess.StageId = Convert.ToInt32(stageId);
|
|
|
sysProcess.TypeId =Convert.ToInt32( typeId);
|
|
|
sysProcess.Enabled = enabled;
|
|
|
|
|
|
String message = "";
|
|
|
string flag = "";
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
sysProcess.UpdateUserId = CurrentEmp.EmpId;
|
|
|
sysProcess.ProcessId =Convert.ToInt32( processId);
|
|
|
this.service.updatePdline(sysProcess);
|
|
|
message = "修改成功";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
sysProcess.CreateUserId = CurrentEmp.EmpId;
|
|
|
this.service.savePdline(sysProcess);
|
|
|
message = "添加成功";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("message", message);
|
|
|
result.Add("flag", flag);
|
|
|
return Json(result) ;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看菜单详情
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getProcessDetail(String processId)
|
|
|
{
|
|
|
Hashtable ht = this.service.getProcessDetail(processId);
|
|
|
//厂区信息
|
|
|
ViewData.Add("factoryId", ht["factoryId"]);
|
|
|
ViewData.Add("factoryName", ht["factoryName"]);
|
|
|
ViewData.Add("factoryCode", ht["factoryCode"]);
|
|
|
//制程信息
|
|
|
ViewData.Add("processName", ht["processName"]);
|
|
|
ViewData.Add("processId", ht["processId"]);
|
|
|
ViewData.Add("processDesc", ht["processDesc"]);
|
|
|
ViewData.Add("processCode", ht["processCode"]);
|
|
|
//区段信息
|
|
|
ViewData.Add("stageName", ht["stageName"]);
|
|
|
ViewData.Add("stageId", ht["stageId"]);
|
|
|
//作业类型
|
|
|
ViewData.Add("typeName", ht["typeName"]);
|
|
|
ViewData.Add("typeId", ht["typeId"]);
|
|
|
|
|
|
ViewData.Add("enabled", ht["enabled"]);
|
|
|
return View("ViewProcessDefine");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑菜单
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult editProcess(String processId)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(processId))
|
|
|
{
|
|
|
Hashtable ht = this.service.getProcessDetail(processId);
|
|
|
//控制编辑状态
|
|
|
ViewData.Add("editType", "edit");
|
|
|
//厂区信息
|
|
|
ViewData.Add("factoryId", ht["factoryId"]);
|
|
|
ViewData.Add("factoryName", ht["factoryName"]);
|
|
|
ViewData.Add("factoryCode", ht["factoryCode"]);
|
|
|
//制程信息
|
|
|
ViewData.Add("processName", ht["processName"]);
|
|
|
ViewData.Add("processId", ht["processId"]);
|
|
|
ViewData.Add("processDesc", ht["processDesc"]);
|
|
|
ViewData.Add("processCode", ht["processCode"]);
|
|
|
//区段信息
|
|
|
ViewData.Add("stageName", ht["stageName"]);
|
|
|
ViewData.Add("stageId", ht["stageId"]);
|
|
|
//作业类型
|
|
|
ViewData.Add("typeName", ht["typeName"]);
|
|
|
ViewData.Add("typeId", ht["typeId"]);
|
|
|
|
|
|
ViewData.Add("enabled", ht["enabled"]);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("editType", "new");
|
|
|
}
|
|
|
return View("EditProcessDefine");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除菜单
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteProcess(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteProcess(ids);
|
|
|
}
|
|
|
catch(Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.EnableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onDisable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.DisableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
}
|
|
|
}
|