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.
380 lines
13 KiB
380 lines
13 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Mvc;
|
|
using QMAPP.Common.Web.Controllers;
|
|
using QMAPP.Entity;
|
|
using QMAPP.FJC.Entity.ProduceManage;
|
|
using QMAPP.FJC.Web.Models.ProduceManage;
|
|
using QMAPP.ServicesAgent;
|
|
using QMFrameWork.Common.Serialization;
|
|
using QMFrameWork.Data;
|
|
using QMFrameWork.WebUI.Attribute;
|
|
using QMFrameWork.WebUI.DataSource;
|
|
using QMAPP.FJC.Entity.Basic;
|
|
|
|
namespace QMAPP.FJC.Web.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 模块编号:M4-1
|
|
/// 作 用:生产记录维护控制层
|
|
/// 作 者:张敬贺
|
|
/// 编写日期:2015年06月04日
|
|
///</summary>
|
|
public class ProducePlanController : QController
|
|
{
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 加载列表
|
|
/// </summary>
|
|
/// <returns>结果</returns>
|
|
[HandleException]
|
|
public ActionResult List(bool? callBack)
|
|
{
|
|
ProducePlanModel seachModel = new ProducePlanModel();
|
|
seachModel.STARTCREATEDATE = DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd");
|
|
seachModel.ENDCREATEDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
seachModel.ImmediateSearch = false;
|
|
if (callBack == true)
|
|
TryGetSelectBuffer<ProducePlanModel>(out seachModel);
|
|
seachModel.rownumbers = false;
|
|
seachModel.url = "/ProducePlan/GetList";
|
|
return View("List", seachModel);
|
|
}
|
|
/// <summary>
|
|
/// 获取列表
|
|
/// </summary>
|
|
/// <param name="callBack">是否回调</param>
|
|
/// <returns>列表</returns>
|
|
[HandleException]
|
|
public ActionResult GetList(bool? callBack)
|
|
{
|
|
ProducePlanModel seachModel = null;
|
|
DataPage page = null;
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
ProducePlan condition = null;
|
|
try
|
|
{
|
|
//获取查询对象
|
|
seachModel = GetModel<ProducePlanModel>();
|
|
#region 获取缓存值
|
|
if (callBack != null)
|
|
{
|
|
TryGetSelectBuffer<ProducePlanModel>(out seachModel);
|
|
}
|
|
else
|
|
{
|
|
//保存搜索条件
|
|
SetSelectBuffer<ProducePlanModel>(seachModel);
|
|
}
|
|
#endregion
|
|
//获取前台分页设置信息
|
|
page = this.GetDataPage(seachModel);
|
|
condition = CopyToModel<ProducePlan, ProducePlanModel>(seachModel);
|
|
#region wcf服务统一接口
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_GetList.ToString(), condition, page);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (dataResult.IsSuccess)
|
|
{
|
|
page = dataResult.Result;
|
|
}
|
|
|
|
DateGridResult<ProducePlan> result = new DateGridResult<ProducePlan>();
|
|
result.Total = page.RecordCount;
|
|
result.Rows = JsonConvertHelper.GetDeserialize<List<ProducePlan>>(page.Result.ToString());
|
|
#endregion
|
|
return Content(result.GetJsonSource());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 加载列表
|
|
/// </summary>
|
|
/// <returns>结果</returns>
|
|
[HandleException]
|
|
public ActionResult Total(bool? callBack)
|
|
{
|
|
ProducePlanModel seachModel = new ProducePlanModel();
|
|
seachModel.STARTCREATEDATE = DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd");
|
|
seachModel.ENDCREATEDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
seachModel.ImmediateSearch = false;
|
|
if (callBack == true)
|
|
TryGetSelectBuffer<ProducePlanModel>(out seachModel);
|
|
seachModel.rownumbers = false;
|
|
seachModel.url = "/ProducePlan/GetTotal";
|
|
return View("Total", seachModel);
|
|
}
|
|
/// <summary>
|
|
/// 获取列表
|
|
/// </summary>
|
|
/// <param name="callBack">是否回调</param>
|
|
/// <returns>列表</returns>
|
|
[HandleException]
|
|
public ActionResult GetTotal(bool? callBack)
|
|
{
|
|
ProducePlanModel seachModel = null;
|
|
DataPage page = null;
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
ProducePlan condition = null;
|
|
try
|
|
{
|
|
//获取查询对象
|
|
seachModel = GetModel<ProducePlanModel>();
|
|
#region 获取缓存值
|
|
if (callBack != null)
|
|
{
|
|
TryGetSelectBuffer<ProducePlanModel>(out seachModel);
|
|
}
|
|
else
|
|
{
|
|
//保存搜索条件
|
|
SetSelectBuffer<ProducePlanModel>(seachModel);
|
|
}
|
|
#endregion
|
|
//获取前台分页设置信息
|
|
page = this.GetDataPage(seachModel);
|
|
condition = CopyToModel<ProducePlan, ProducePlanModel>(seachModel);
|
|
#region wcf服务统一接口
|
|
var list = wcfAgent.InvokeServiceFunction<List<ProducePlan>>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_GetTotal.ToString(), condition);
|
|
|
|
|
|
DateGridResult<ProducePlan> result = new DateGridResult<ProducePlan>();
|
|
result.Total = page.RecordCount;
|
|
result.Rows = list;
|
|
#endregion
|
|
return Content(result.GetJsonSource());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑载入
|
|
/// </summary>
|
|
/// <returns>处理结果</returns>
|
|
[HandleException]
|
|
public ActionResult Edit()
|
|
{
|
|
ProducePlanModel model = new ProducePlanModel();
|
|
string ID = Request.Params["PID"];
|
|
ProducePlan Entity = new ProducePlan();
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
try
|
|
{
|
|
model.PLANDATE = DateTime.Now;
|
|
if (string.IsNullOrEmpty(ID) == false)
|
|
{
|
|
//修改获取原数据
|
|
Entity.PID = ID;
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<ProducePlan>>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_Get.ToString(), Entity);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (dataResult.IsSuccess)
|
|
{
|
|
Entity = dataResult.Result;
|
|
}
|
|
else
|
|
{
|
|
SetMessage(dataResult.Msg);
|
|
return View("Edit", Entity);
|
|
}
|
|
|
|
model = CopyToModel<ProducePlanModel, ProducePlan>(Entity);
|
|
}
|
|
return View("Edit", model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns>处理结果</returns>
|
|
[HttpPost]
|
|
[HandleException]
|
|
[ValidateInput(false)]
|
|
public ActionResult Save(ProducePlanModel saveModel)
|
|
{
|
|
ProducePlan Entity = null;
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
|
|
try
|
|
{
|
|
Entity = CopyToModel<ProducePlan, ProducePlanModel>(saveModel);
|
|
if (string.IsNullOrEmpty(Entity.PID) == true)
|
|
{
|
|
//新增
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_Insert.ToString(), Entity);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (!dataResult.IsSuccess)
|
|
{
|
|
SetMessage(dataResult.Msg);
|
|
return View("Edit", saveModel);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//修改
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_Update.ToString(), Entity);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (!dataResult.IsSuccess)
|
|
{
|
|
SetMessage(dataResult.Msg);
|
|
return View("Edit", saveModel);
|
|
}
|
|
}
|
|
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();", AppResource.SaveMessge));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <returns>结果</returns>
|
|
[HttpPost]
|
|
[HandleException]
|
|
public ActionResult Delete(ProducePlanModel saveMode)
|
|
{
|
|
string selectKey = Request.Form["selectKey"];
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
|
|
try
|
|
{
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_Delete.ToString(), selectKey);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (!dataResult.IsSuccess)
|
|
{
|
|
SetMessage(dataResult.Msg);
|
|
}
|
|
else
|
|
{
|
|
SetMessage(AppResource.DeleteMessage);
|
|
}
|
|
|
|
return List(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 完成计划
|
|
/// <summary>
|
|
/// 完成计划
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns>处理结果</returns>
|
|
[HttpPost]
|
|
[HandleException]
|
|
[ValidateInput(false)]
|
|
public ActionResult ProductOver(ProducePlanModel saveModel)
|
|
{
|
|
string selectKey = Request.Form["selectKey"];
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
|
|
try
|
|
{
|
|
//新增
|
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult>(QMAPP.ServicesAgent.ProduceManage.ProducePlanBLL_ProductOver.ToString(), selectKey);
|
|
|
|
//通过返回dataResult判断
|
|
if (dataResult.Ex != null)
|
|
{
|
|
throw dataResult.Ex;
|
|
}
|
|
else if (!dataResult.IsSuccess)
|
|
{
|
|
SetMessage(dataResult.Msg);
|
|
}
|
|
else
|
|
{
|
|
SetMessage(AppResource.ProductOverSeccess);
|
|
}
|
|
|
|
return List(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
|
|
public ActionResult GetMachineNo()
|
|
{
|
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
|
MachineInfo condition=new MachineInfo();
|
|
try
|
|
{
|
|
ComboboxResult model = new ComboboxResult();
|
|
//查询仓库信息表
|
|
condition.PROCESSTYPE=Request.Params["PROCESSTYPE"];
|
|
var listWareHouse = wcfAgent.InvokeServiceFunction<List<MachineInfo>>(QMAPP.ServicesAgent.DictService.DictManageBLL_GetMachineListByProcessType.ToString(), condition);
|
|
|
|
List<object> list = new List<object>();
|
|
foreach (var w in listWareHouse)
|
|
{
|
|
list.Add(new { id = w.MACHINECODDE, text = w.MACHINECODDE + "/" + w.MACHINENAME, code = "" });
|
|
}
|
|
|
|
return Json(JsonConvertHelper.GetSerializes(list), JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|