天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 lines
3.6 KiB

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 获取列表
/// <summary>
/// 加载列表
/// </summary>
/// <returns>结果</returns>
[HandleException]
public ActionResult CapacityList(bool? callBack)
{
CapacityModel seachModel = new CapacityModel();
seachModel.pagination = false;
seachModel.rownumbers = false;
seachModel.Editable = true;
if (callBack == false)
TryGetSelectBuffer<CapacityModel>(out seachModel);
seachModel.rownumbers = false;
string workcenterid = Request.Params["workcenterid"];
seachModel.WORKCENTER_PID = workcenterid;
seachModel.ComboBoxList = new Dictionary<string, Dictionary<string, string>>();
seachModel.ComboBoxList.Add("SHIFT_PID", GetShiftComboBoxList());
seachModel.url = string.Format("/Capacity/GetList?workcenterid={0}", workcenterid);
return View("CapacityList", seachModel);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="callBack">是否回调</param>
/// <returns>列表</returns>
[HandleException]
public ActionResult GetList(bool? callBack)
{
string workcenterid = Request.Params["workcenterid"];
List<Capacity> list = null;
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
list = agent.InvokeServiceFunction<List<Capacity>>("CapacityBLL_GetList", new Capacity { WORKCENTER_PID = workcenterid });
DataGridResult<Capacity> result = new DataGridResult<Capacity>();
result.Total = 0;
result.Rows = list;
return Content(result.GetJsonSource());
}
#endregion
#region 保存
/// <summary>
/// 保存
/// </summary>
/// <param name="model"></param>
/// <returns>处理结果</returns>
[HttpPost]
[HandleException]
public ActionResult CapacitySave()
{
string workcenterid = Request.Form["workcenterid"];
string dgRows = Request.Form["DgData"];
List<Capacity> data = JsonConvertHelper.DeserializeObject<List<Capacity>>(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<string, string> GetShiftComboBoxList()
{
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
//获取零件类型下拉列表
Dictionary<string, string> listShift = new Dictionary<string, string>();
List<ProduceShift> list = agent.InvokeServiceFunction<List<ProduceShift>>("ProduceShiftBLL_GetAllList", new ProduceShift());
listShift.Add("", null);
foreach (var item in list)
{
listShift.Add(item.PID, item.PRODUCESHIFTTCODE + "/" + item.PRODUCESHIFTNAME);
}
return listShift;
}
#endregion
}
}