|
|
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
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 看板模块控制类
|
|
|
/// </summary>
|
|
|
public class ShiftDefineController : BaseController
|
|
|
{
|
|
|
private IShiftDefineService service;
|
|
|
public ShiftDefineController(IShiftDefineService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /Menu/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取看板管理列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="shiftName"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetListByPage(String shiftName, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo",pager.pageNo);
|
|
|
Hashtable dataHt = this.service.GetListByPage(shiftName,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>
|
|
|
/// <rehuoturns></returns>
|
|
|
public ActionResult GetSelect()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> list = this.service.GetSelect();
|
|
|
result.Add("list", list);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存看板数据
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult Save()
|
|
|
{
|
|
|
String editType = Request.Form["editType"].ToString();
|
|
|
|
|
|
String shiftId = Request.Form["shiftId"].ToString();
|
|
|
String shiftCode = Request.Form["shiftCode"].ToString();
|
|
|
String shiftName = Request.Form["shiftName"].ToString();
|
|
|
String startTime = Request.Form["startTime"].ToString();
|
|
|
String endTime = Request.Form["endTime"].ToString();
|
|
|
String enabled = Request.Form["enabled"].ToString();
|
|
|
|
|
|
SysShift model = new SysShift();
|
|
|
model.ShiftCode = shiftCode;
|
|
|
model.ShiftName = shiftName;
|
|
|
model.StartTime = startTime;
|
|
|
model.EndTime = endTime;
|
|
|
model.Enabled = enabled;
|
|
|
|
|
|
String message = "";
|
|
|
String flag = "";
|
|
|
|
|
|
if (editType != null && editType.Trim().Equals("edit"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
model.UpdateUserId = CurrentEmp.EmpId;
|
|
|
model.ShiftId =Convert.ToInt32( shiftId);
|
|
|
|
|
|
this.service.Update(model);
|
|
|
message = "修改成功";
|
|
|
flag = "OK";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
message = "修改失败!";
|
|
|
flag = "Fail";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
model.CreateUserId = CurrentEmp.EmpId;
|
|
|
this.service.Insert(model);
|
|
|
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 GetDetail(String shiftId)
|
|
|
{
|
|
|
List<SysShift> Info = this.service.GetDetail(shiftId);
|
|
|
//Hashtable ht = (Hashtable)Info[0];
|
|
|
SysShift ht = Info[0];
|
|
|
ViewData.Add("shiftCode", ht.ShiftCode);
|
|
|
ViewData.Add("shiftName", ht.ShiftName);
|
|
|
ViewData.Add("startTime", ht.StartTime);
|
|
|
ViewData.Add("endTime", ht.EndTime);
|
|
|
ViewData.Add("enabled", ht.Enabled);
|
|
|
return View("viewShiftDefine");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 编辑看板
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult Edit(String shiftId)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(shiftId))
|
|
|
{
|
|
|
List<SysShift> Info = this.service.GetDetail(shiftId);
|
|
|
//Hashtable ht = (Hashtable)Info[0];
|
|
|
SysShift ht = Info[0];
|
|
|
ViewData.Add("editType", "edit");
|
|
|
ViewData.Add("shiftId", shiftId);
|
|
|
ViewData.Add("shiftCode", ht.ShiftCode);
|
|
|
ViewData.Add("shiftName", ht.ShiftName);
|
|
|
ViewData.Add("startTime", ht.StartTime);
|
|
|
ViewData.Add("endTime", ht.EndTime);
|
|
|
ViewData.Add("enabled", ht.Enabled);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("editType", "new");
|
|
|
}
|
|
|
|
|
|
return View("editShiftDefine");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除看板
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult Delete(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.Delete(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);
|
|
|
}
|
|
|
}
|
|
|
}
|