using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMAPP.Common.Web.Controllers;
using QMFrameWork.WebUI.Attribute;
using QMAPP.FJC.Web.Models.Basic;
using QMAPP.FJC.Entity.Basic;
using QMFrameWork.WebUI.DataSource;
using QMFrameWork.Common.Serialization;
namespace QMAPP.FJC.Web.Controllers
{
public class CapacityController : QController
{
#region 获取列表
///
/// 加载列表
///
/// 结果
[HandleException]
public ActionResult CapacityList(bool? callBack)
{
CapacityModel seachModel = new CapacityModel();
seachModel.pagination = false;
seachModel.rownumbers = false;
seachModel.Editable = true;
if (callBack == false)
TryGetSelectBuffer(out seachModel);
seachModel.rownumbers = false;
string workcenterid = Request.Params["workcenterid"];
seachModel.WORKCENTER_PID = workcenterid;
seachModel.ComboBoxList = new Dictionary>();
seachModel.ComboBoxList.Add("SHIFT_PID", GetShiftComboBoxList());
seachModel.url = string.Format("/Capacity/GetList?workcenterid={0}", workcenterid);
return View("CapacityList", seachModel);
}
///
/// 获取列表
///
/// 是否回调
/// 列表
[HandleException]
public ActionResult GetList(bool? callBack)
{
string workcenterid = Request.Params["workcenterid"];
List list = null;
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
list = agent.InvokeServiceFunction>("CapacityBLL_GetList", new Capacity { WORKCENTER_PID = workcenterid });
DataGridResult result = new DataGridResult();
result.Total = 0;
result.Rows = list;
return Content(result.GetJsonSource());
}
#endregion
#region 保存
///
/// 保存
///
///
/// 处理结果
[HttpPost]
[HandleException]
public ActionResult CapacitySave()
{
string workcenterid = Request.Form["workcenterid"];
string dgRows = Request.Form["DgData"];
List data = JsonConvertHelper.DeserializeObject>(dgRows);
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
agent.InvokeServiceFunction("CapacityBLL_Save", new Capacity { WORKCENTER_PID = workcenterid }, data);
return Json(AppResource.SaveMessge);
}
#endregion
#region 获取班次下拉列表
private Dictionary GetShiftComboBoxList()
{
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
//获取零件类型下拉列表
Dictionary listShift = new Dictionary();
List list = agent.InvokeServiceFunction>("ProduceShiftBLL_GetAllList", new ProduceShift());
listShift.Add("", null);
foreach (var item in list)
{
listShift.Add(item.PID, item.PRODUCESHIFTTCODE + "/" + item.PRODUCESHIFTNAME);
}
return listShift;
}
#endregion
}
}