|
|
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 RouteDefineController : BaseController
|
|
|
{
|
|
|
private IRouteDefineService service;
|
|
|
private ICommonService CommonService;
|
|
|
public RouteDefineController(IRouteDefineService _service, ICommonService _CommonService)
|
|
|
{
|
|
|
service = _service;
|
|
|
CommonService = _CommonService;
|
|
|
}
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取工厂信息
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getFactory()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> modelTypeList = CommonService.getFactoryInfo();
|
|
|
result.Add("list", modelTypeList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取流程信息
|
|
|
/// </summary>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult getRoute(string factoryId)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> modelTypeList = service.getRoute(factoryId);
|
|
|
result.Add("list", modelTypeList);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取基础制程数据
|
|
|
/// </summary>
|
|
|
/// <param name="factoryId"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getProcessTree(string factoryId)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
ArrayList treeNodes = new ArrayList();
|
|
|
treeNodes = this.service.getProcessTree(factoryId);
|
|
|
result.Add("treeNodes", treeNodes);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取流程明细数据
|
|
|
/// </summary>
|
|
|
/// <param name="factoryId"></param>
|
|
|
/// <param name="routeId"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getRouteTree(string factoryId, string routeId)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
ArrayList treeNodes = new ArrayList();
|
|
|
treeNodes = this.service.getRouteTree(factoryId,routeId);
|
|
|
result.Add("treeNodes", treeNodes);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存流程明细
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult saveRouteDetail(String routeTree)
|
|
|
{
|
|
|
|
|
|
ArrayList routeList = (ArrayList) JSON.Decode(routeTree);
|
|
|
bool saveResult = this.service.saveRouteDetail(routeList, CurrentEmp.EmpId);
|
|
|
|
|
|
Hashtable result = new Hashtable();
|
|
|
if (saveResult)
|
|
|
{
|
|
|
result.Add("message", "保存成功!");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Add("message", "保存失败!");
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult saveRouteDefine()
|
|
|
{
|
|
|
String editType = Convert.ToString(Request.Form["editType"]);
|
|
|
String routeId = Convert.ToString(Request.Form["routeId"]);
|
|
|
String routeName = Convert.ToString(Request.Form["routeName"]);
|
|
|
String routeDesc = Convert.ToString(Request.Form["routeDesc"]);
|
|
|
String factory = Convert.ToString(Request.Form["factory"]);
|
|
|
|
|
|
SysRoute model = new SysRoute();
|
|
|
model.RouteName = routeName;
|
|
|
model.RouteDesc = routeDesc;
|
|
|
model.FactoryId =Convert.ToInt32( factory);
|
|
|
|
|
|
|
|
|
|
|
|
String message = "";
|
|
|
String flag = "";
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
model.UpdateUserId = CurrentEmp.EmpId;
|
|
|
model.RouteId = Convert.ToInt32( routeId);
|
|
|
int i = this.service.updateRouteDefine(model);
|
|
|
if (i == 0)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
message = "修改成功!";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
model.CreateUserId = CurrentEmp.EmpId;
|
|
|
int i = this.service.saveRouteDefine(model);
|
|
|
if (i == 0)
|
|
|
{
|
|
|
message = "添加失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
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 editRouteDefine(string editType, string routeId, string routeName, string routeDesc, string factory)
|
|
|
{
|
|
|
|
|
|
ViewData.Add("editType", editType);
|
|
|
List<SysRoute> delCount = this.service.getRouteById(routeId);
|
|
|
|
|
|
if (editType.Equals("edit"))
|
|
|
{
|
|
|
ViewData.Add("routeId", delCount[0].RouteId);
|
|
|
ViewData.Add("routeName", delCount[0].RouteName);
|
|
|
ViewData.Add("routeDesc", delCount[0].RouteDesc);
|
|
|
ViewData.Add("factory", delCount[0].FactoryId);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("factory", factory);
|
|
|
}
|
|
|
return View("editRouteDefine");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除流程信息
|
|
|
/// </summary>
|
|
|
/// <param name="routeId"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult deleteRouteDefine(string routeId)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.deleteRouteDefine(routeId);
|
|
|
}
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
} |