天津投入产出系统后端
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.
 
 
 
 
 
 

1338 lines
51 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMFrameWork.WebUI.Attribute;
using QMFrameWork.WebUI.DataSource;
using QMAPP.Entity.Sys;
using QMAPP.Common.Web;
using QMAPP.Common.Web.Controllers;
using QMAPP.ServicesAgent;
using QMAPP.Entity;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.Entity.Equipment;
using QMAPP.FJC.Entity.QT;
using QMAPP.MD.Entity;
using QMAPP.MD.Web.Models;
using Corp = QMAPP.MD.Entity.Corp;
using ProcessRoute = QMAPP.MD.Entity.ProcessRoute;
using ProcessRouteWorkCell = QMAPP.MD.Entity.ProcessRouteWorkCell;
namespace QMAPP.MD.Web.Controllers
{
/// <summary>
/// 字典管理
/// </summary>
public class DictController : QController
{
/// <summary>
/// 空数据项显示值
/// </summary>
public string EmptyItemTitle = " ";
#region 获取下拉列表固定数据源
/// <summary>
/// 获取下拉列表固定数据源
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFixedComboxSource()
{
string kind = Request.Params["kind"];
//单雨春 是否带空项 2014年9月26日
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary<string, string> dicts = null;
try
{
ComboboxResult model = new ComboboxResult();
//单雨春 是否带空项 2014年9月26日
if (isWithEmpty)
{
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
}
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary(kind.ToString(), out dicts);
foreach (string key in dicts.Keys)
{
model.Add(new ComboboxItem { ID = key, Text = dicts[key] });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取下拉列表数据源
/// <summary>
/// 获取下拉列表数据源
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetDictList()
{
string kind = Request.Params["kind"];
ComboboxResult model = new ComboboxResult();
AppDataGeter adg = new AppDataGeter();
try
{
model.Items = adg.GetList(kind).Select(t => new ComboboxItem { ID = t.id, Text = t.text }).ToList();
model.Items.Insert(0, new ComboboxItem { ID = "", Text = EmptyItemTitle });
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取公司下拉列表
/// <summary>
/// 获取公司下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetCorpComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Corp>>>
("CorpBLL_GetCorpList", new Corp());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Corp item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.PID, Text = item.CORP_CODE + "/" + item.CORP_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工厂下拉列表
/// <summary>
/// 获取工厂下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetFactoryComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Factory>>>
("FactoryBLL_GetFactoryList", new Factory());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Factory item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.FACTORY_CODE, Text = item.FACTORY_CODE + "/" + item.FACTORY_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工作中心下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkCenterComboxSource()
{
List<ComboboxItem> list = new List<ComboboxItem>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", new WorkCenter());
foreach (WorkCenter item in dataResult.Result)
{
list.Add(new ComboboxItem { ID = item.CENTER_TYPE, Text = item.CENTER_TYPE + "/" + item.WORKCENTER_NAME });
}
list.Insert(0, new ComboboxItem() { ID = "", Text = this.EmptyItemTitle });
return Content(list.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部工作中心下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetAllWorkCenterComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", new WorkCenter());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCenter item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.WORKCENTER_CODE, Text = item.WORKCENTER_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryWorkCenterComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", new WorkCenter {FACTORY_CODE = factoryCode});
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCenter item in dataResult.Result)
{
item.WORKCENTER_NAME = item.WORKCENTER_CODE + "/" + item.WORKCENTER_NAME;
}
//return Content(model.ToString());
var list = dataResult.Result;
list.Insert(0, new WorkCenter() { WORKCENTER_CODE = "", WORKCENTER_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工序下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkCellComboxSource(string workcenterCode)
{
List<WorkCell> list = new List<WorkCell>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(workcenterCode) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCell>>>
("WorkCellBLL_GetWorkCellList", new WorkCell() { WORKCENTER_CODE = workcenterCode });
foreach (WorkCell item in dataResult.Result)
{
item.WORKCELL_NAME = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME;
list.Add(item);
}
}
list.Insert(0, new WorkCell() { PID = "", WORKCELL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部工序下拉列表
/// <summary>
/// 获取全部工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetALLWorkCellComboxSource()
{
string kind = Request.Params["kind"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkCell>>
("WorkCellBLL_GetWorkCellList", new WorkCell());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCell item in dataResult)
{
model.Add(new ComboboxItem { ID = item.WORKCELL_CODE, Text = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryWorkCellComboxSource(string factoryCode,string workCenterCode)
{
string kind = Request.Params["kind"];
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<WorkCell>>
("WorkCellBLL_GetWorkCellList", new WorkCell{FACTORY_CODE = factoryCode,WORKCENTER_CODE = workCenterCode});
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCell item in list)
{
item.WORKCELL_NAME = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME;
}
//return Content(model.ToString());
list.Insert(0, new WorkCell() { WORKCELL_CODE = "", WORKCELL_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工位下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkLocFromWorkCellComboxSource(string routecode)
{
List<WorkLoc> list = new List<WorkLoc>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(routecode) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkLoc>>
("WorkLocBLL_GetWorkLocFromWorkCellList", new WorkLoc(), routecode);
foreach (WorkLoc item in dataResult)
{
item.WORKLOC_NAME = item.WORKLOC_CODE + "/" + item.WORKLOC_NAME;
list.Add(item);
}
}
list.Insert(0, new WorkLoc() { WORKLOC_CODE = "", WORKLOC_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工位下拉列表(编辑页面)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public string GetWorkLocFromWorkCelEditlComboxSource()
{
string kind = Request.Params["kind"];
List<WorkLoc> list = new List<WorkLoc>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(kind) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<List<WorkLoc>>
("WorkLocBLL_GetWorkLocFromWorkCellList", new WorkLoc(), kind);
foreach (WorkLoc item in dataResult)
{
return item.WORKCELL_CODE;
}
}
//list.Insert(0, new WorkLoc() { WORKLOC_CODE = "", WORKLOC_NAME = this.EmptyItemTitle });
//return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
return "";
}
#endregion
#region 获取物料信息下拉列表--树
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in dataResult)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialTree()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var materialResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p=>string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p=>p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children=new List<CombotreeItem>() };
AppendTree(subnode, classresult, materialResult);
if (subnode.children.Count > 0)
{
trees.Add(subnode);
}
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryMaterialTree(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var materialResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material{FACTORY_CODE = factoryCode});
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass { FACTORY_CODE = factoryCode }).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult, materialResult);
if (subnode.children.Count > 0)
{
trees.Add(subnode);
}
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 追加树节点
/// </summary>
/// <param name="node"></param>
/// <param name="mclasslist"></param>
/// <param name="materiallist"></param>
private void AppendTree(CombotreeItem node, List<MaterialClass> mclasslist,List<Material> materiallist)
{
foreach (var mclass in mclasslist.Where(p => string.Equals(node.id, p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = mclass.MATERIAL_TYPE_CODE, text = mclass.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, mclasslist, materiallist);
if (subnode.children.Count > 0)
{
node.children.Add(subnode);
}
}
foreach (var material in materiallist.Where(p => string.Equals(node.id, p.MATERIAL_TYPE_CODE)).OrderBy(p=>p.MATERIAL_CODE))
{
var subnode = new CombotreeItem { id = material.MATERIAL_CODE, text = material.MATERIAL_CODE + "/" + material.MATERIAL_NAME };
node.children.Add(subnode);
}
}
#endregion
#region 获取物料类型下拉列表
/// <summary>
/// 获取物料类型下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialClassComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (MaterialClass item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.MATERIAL_TYPE_CODE, Text = item.MATERIAL_TYPE_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取物料类型树
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetMaterialClassTree()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var classresult = wcfAgent.InvokeServiceFunction<DataResult<List<MaterialClass>>>
("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result;
List<CombotreeItem> trees = new List<CombotreeItem>();
trees.Add(new CombotreeItem { id = "", text = this.EmptyItemTitle });
foreach (MaterialClass item in classresult.Where(p => string.IsNullOrWhiteSpace(p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = item.MATERIAL_TYPE_CODE, text = item.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, classresult);
trees.Add(subnode);
}
return Json(trees);
}
catch (Exception ex)
{
throw ex;
}
}
private void AppendTree(CombotreeItem node, List<MaterialClass> mclasslist)
{
foreach (var mclass in mclasslist.Where(p => string.Equals(node.id, p.UP_MATERIAL_TYPE_CODE)).OrderBy(p => p.SEQ_NUM))
{
var subnode = new CombotreeItem { id = mclass.MATERIAL_TYPE_CODE, text = mclass.MATERIAL_TYPE_NAME, children = new List<CombotreeItem>() };
AppendTree(subnode, mclasslist);
node.children.Add(subnode);
}
}
#endregion
#region 获取颜色信息下拉列表
/// <summary>
/// 获取颜色信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMaterialColorComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<Material>>
("MaterialBLL_GetMaterialList", new Material());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Material item in dataResult)
{
model.Add(new ComboboxItem { ID = item.COLOR, Text = item.COLOR });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部设备下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetAllEquipmentComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Equipment>>>
("EquipmentBLL_GetEquipmentList", new Equipment());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Equipment item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.EQUIPMENT_CODE, Text = item.EQUIPMENT_CODE + "/" + item.EQUIPMENT_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取全部工艺路线下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetAllRouteComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<ProcessRoute>>>
("ProcessRouteBLL_GetProcessRouteList", new Equipment());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (ProcessRoute item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.ROUTE_CODE, Text = item.ROUTE_CODE + "/" + item.ROUTE_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryRouteComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<ProcessRoute>>>
("ProcessRouteBLL_GetProcessRouteList", new ProcessRoute { FACTORY_CODE = factoryCode});
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
//foreach (ProcessRoute item in dataResult.Result)
//{
// model.Add(new ComboboxItem { ID = item.ROUTE_CODE, Text = item.ROUTE_CODE + "/" + item.ROUTE_NAME });
//}
//return Content(model.ToString());
var list = dataResult.Result;
list.Insert(0, new ProcessRoute() { ROUTE_CODE = "", ROUTE_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工艺路线工序下拉列表(联动)
/// <summary>
/// 获取工艺路线工序下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetRouteWorkCellComboxSource(string routeCode)
{
List<ProcessRouteWorkCell> list = new List<ProcessRouteWorkCell>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(routeCode) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<ProcessRouteWorkCell>>>
("ProcessRouteBLL_GeProcessRouteWorkCellList", new ProcessRouteWorkCell() { ROUTE_CODE = routeCode });
foreach (ProcessRouteWorkCell item in dataResult.Result)
{
item.WORKCELL_NAME = item.WORKCELL_CODE + "/" + item.WORKCELL_NAME;
list.Add(item);
}
}
list.Insert(0, new ProcessRouteWorkCell() { PID = "", WORKCELL_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取PBOM下的BOM上级项目序号组成信息(联动)
/// <summary>
/// 获取PBOM下的BOM上级项目序号组成信息(联动)
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetBomItemUpSqNumComboxSource(string pbomRoute)
{
List<PbomItem> list = new List<PbomItem>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(pbomRoute) == false)
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<PbomItem>>>
("PbomBLL_PbomItemList", new PbomItem() { PBOM_CODE = pbomRoute });
foreach (PbomItem item in dataResult.Result)
{
item.MATERIAL_CODE = item.SEQ_NUM + "/" + item.MATERIAL_CODE;
list.Add(item);
}
}
list.Insert(0, new PbomItem() { SEQ_NUM=0, MATERIAL_CODE = "0/要生产的物料" });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取设备设备下拉列表
/// <summary>
/// 获取设备设备下拉列表
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetMachineNameComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetMachineInfoList", new QMAPP.FJC.Entity.Basic.MachineInfo());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
{
model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text =item.MACHINENAME + "/" + item.MACHINECODDE });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryMachineComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetMachineInfoList", new QMAPP.FJC.Entity.Basic.MachineInfo { FACTORY_CODE = factoryCode });
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in list)
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
}
//return Content(model.ToString());
list.Insert(0, new MachineInfo() { MACHINECODDE = "", MACHINENAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取项目号下拉列表
/// <summary>
/// 获取项目号下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetProjectComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Project>>>
("ProjectBLL_GetProjectList", new Project());
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Project item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.PROJECT_CODE, Text = item.PROJECT_CODE + "/" + item.PROJECT_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetFactoryProjectComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<Project>>>
("ProjectBLL_GetProjectList", new Project{FACTORY_CODE = factoryCode});
//ComboboxResult model = new ComboboxResult();
//model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
//foreach (Project item in dataResult.Result)
//{
// item.PROJECTCODE = item.PROJECT_CODE;
//}
//return Content(model.ToString());
var list = dataResult.Result;
list.Insert(0, new Project() { PROJECT_CODE = "", PROJECT_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取设备(MACHINE)下拉列表
/// <summary>
/// 获取设备(MACHINE)下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMachineComboxSource()
{
List<QMAPP.FJC.Entity.Basic.MachineInfo> list = new List<QMAPP.FJC.Entity.Basic.MachineInfo>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetMachineInfoList", new QMAPP.FJC.Entity.Basic.MachineInfo());
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfo() { PID = "", MACHINENAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取用户下拉列表
/// <summary>
/// 获取用户下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetUserComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
User user=new User();
user.ActivateFlg="1";
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<User>>>
("UserWithMachineBLL_GetUserInfoList", user);
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (User item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.UserID, Text = item.UserName });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ActionResult GetUserComboxSourceForEdit()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
User user = new User();
user.ActivateFlg = "1";
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<User>>>
("UserWithMachineBLL_GetUserInfoListForEdit", user);
ComboboxResult model = new ComboboxResult();
foreach (User item in dataResult.Result)
{
model.Add(new ComboboxItem { ID = item.UserID, Text = item.UserName });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取信息下拉列表(订单)
/// <summary>
/// 获取物料信息下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetMachineInfo(string machineids)
{
QMAPP.FJC.Entity.Basic.MachineInfo info = new QMAPP.FJC.Entity.Basic.MachineInfo();
if (string.IsNullOrEmpty(machineids) == false && machineids != "undefined")
{
info.Machineids = "('" + machineids.Replace(";", "','") + "')";
}
List<QMAPP.FJC.Entity.Basic.MachineInfo> list = new List<QMAPP.FJC.Entity.Basic.MachineInfo>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("UserWithMachineBLL_GetMachineList", info);
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
{
item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
list.Add(item);
}
list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfo() { PID = "", MACHINENAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取绑定类型下拉框
[HandleException]
public ActionResult GetBingingTypeComboxSource()
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
model.Add(new ComboboxItem { ID = "MOULD", Text = "模具" });
model.Add(new ComboboxItem { ID = "EQUIP", Text = "设备" });
return Content(model.ToString());
}
#endregion
#region 获取是否物料号下拉框
[HandleException]
public ActionResult GetIsMaterialCodeComboxSource()
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
model.Add(new ComboboxItem { ID = "0", Text = "物料类型" });
model.Add(new ComboboxItem { ID = "1", Text = "物料号" });
return Content(model.ToString());
}
#endregion
#region 获取全部设备下拉列表
/// <summary>
/// 获取设备设备下拉列表
/// </summary>
/// <returns></returns>
[HandleException]
public ActionResult GetAllMachineInfoListComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<QMAPP.FJC.Entity.Basic.MachineInfo>>
("MachineInfoBLL_GetAllMachineInfoList");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in list)
{
model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINENAME + "/" + item.MACHINECODDE });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取模具下拉列表
[HandleException]
public ActionResult GetMouldsComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<Mould>>
("MouldBLL_GetMoulds");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Mould item in list)
{
model.Add(new ComboboxItem { ID = item.MOULD_CODE, Text = item.MOULD_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取默认为空
[HandleException]
public ActionResult GetTestComboxSource()
{
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
return Content(model.ToString());
}
#endregion
#region 获取解析类别
/// <summary>
/// 获取解析类别
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetAnalyzerComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<Analyzer>>
("AnalyzerBLL_GetAnalyzerList");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (Analyzer item in list)
{
model.Add(new ComboboxItem { ID = item.ANALYZER_CODE, Text = item.ANALYZER_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取状态码下拉列表
/// <summary>
/// 获取状态码下拉列表
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetWorkCellStateCodeComboxSource(string workCellCode)
{
//List<Dai> list = new List<Dai>();
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<Dai>>
("DaiBLL_GetWorkCellStateCodeList", workCellCode);
//foreach (QMAPP.FJC.Entity.Basic.MachineInfo item in dataResult)
//{
// item.MACHINENAME = item.MACHINECODDE + "/" + item.MACHINENAME;
// list.Add(item);
//}
list.Insert(0, new Dai() { STATE_CODE = "", STATE_NAME = this.EmptyItemTitle });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取录入退出
/// <summary>
/// 获取录入退出
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetEntryExitActionComboxSource()
{
ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var list = wcfAgent.InvokeServiceFunction<List<WorkCellState>>
("WorkCellStateBLL_GetEntryExitActionList");
ComboboxResult model = new ComboboxResult();
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
foreach (WorkCellState item in list)
{
model.Add(new ComboboxItem { ID = item.ACTION_CODE, Text = item.ACTION_NAME });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取呼叫类型
/// <summary>
/// 获取呼叫类型
/// </summary>
/// <returns>数据源</returns>
[HandleException]
public ActionResult GetConfigDetailComboxSource()
{
string kind = Request.Params["kind"];
bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false;
Dictionary<string, string> dicts = null;
try
{
ComboboxResult model = new ComboboxResult();
if (isWithEmpty)
{
model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle });
}
//执行查询
List<ConfigDetail> list = new List<ConfigDetail>();
ServiceAgent wcfAgent = this.GetServiceAgent();
list = wcfAgent.InvokeServiceFunction<List<ConfigDetail>>("ConfigDetailBLL_GetAllList", kind);
foreach (ConfigDetail item in list)
{
//item.DetailTypeName = item.DetailTypeCode + "/" + item.DetailTypeName;
model.Add(new ComboboxItem { ID = item.DetailTypeCode, Text = item.DetailTypeName });
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取班组下拉列表
/// <summary>
/// 获取班组下拉列表
/// </summary>
/// <returns></returns>
public ContentResult GetTeamComboxSource()
{
ComboboxResult model = new ComboboxResult();
ServiceAgent wcfAgent = this.GetServiceAgent();
Team entity = new Team();
List<Team> list = new List<Team>();
try
{
//获取工序信息
list = wcfAgent.InvokeServiceFunction<List<Team>>("TeamBLL_GetAllTeam", entity);
foreach (var item in list)
{
if (model.Items.Count == 0)
{
model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
model.Add(new ComboboxItem { ID = item.TEAM_CODE, Text = item.TEAM_NAME });
}
else
{
model.Add(new ComboboxItem { ID = item.TEAM_CODE, Text = item.TEAM_NAME });
}
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ContentResult GetFactoryTeamComboxSource(string factoryCode)
{
//List<User> listProcessInfo = new List<User>();
ComboboxResult model = new ComboboxResult();
ServiceAgent wcfAgent = this.GetServiceAgent();
Team entity = new Team { FACTORY_CODE = factoryCode };
List<Team> list = new List<Team>();
try
{
//获取工序信息
list = wcfAgent.InvokeServiceFunction<List<Team>>("TeamBLL_GetAllTeam", entity);
//foreach (var item in result)
//{
// if (model.Items.Count == 0)
// {
// model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
// model.Add(new ComboboxItem { ID = item.TEAM_CODE, Text = item.TEAM_NAME });
// }
// else
// {
// model.Add(new ComboboxItem { ID = item.TEAM_CODE, Text = item.TEAM_NAME });
// }
//}
//return Content(model.ToString());
foreach (var team in list)
{
team.TEAM_NAME = team.TEAM_CODE + "/" + team.TEAM_NAME;
}
list.Insert(0, new Team() { TEAM_CODE = "", TEAM_NAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取班次下拉列表
/// <summary>
/// 获取班次下拉列表
/// </summary>
/// <returns></returns>
public ContentResult GetShiftComboxSource()
{
//List<User> listProcessInfo = new List<User>();
ComboboxResult model = new ComboboxResult();
ServiceAgent wcfAgent = this.GetServiceAgent();
ProduceShift entity = new ProduceShift();
List<ProduceShift> result = new List<ProduceShift>();
try
{
//获取工序信息
result = wcfAgent.InvokeServiceFunction<List<ProduceShift>>("ProduceShiftBLL_GetAllList", entity);
foreach (var item in result)
{
if (model.Items.Count == 0)
{
model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTNAME });
}
else
{
model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTNAME });
}
}
return Content(model.ToString());
}
catch (Exception ex)
{
throw ex;
}
}
public ContentResult GetWorkcenterShiftComboxSource(string workcentercode)
{
//List<User> listProcessInfo = new List<User>();
ComboboxResult model = new ComboboxResult();
ServiceAgent wcfAgent = this.GetServiceAgent();
ProduceShift entity = new ProduceShift { PRODUCELINE = workcentercode };
List<ProduceShift> list = new List<ProduceShift>();
try
{
//获取工序信息
list = wcfAgent.InvokeServiceFunction<List<ProduceShift>>("ProduceShiftBLL_GetAllList", entity);
//foreach (var item in result)
//{
// if (model.Items.Count == 0)
// {
// model.Add(new ComboboxItem { ID = "", Text = new DictController().EmptyItemTitle });
// model.Add(new ComboboxItem { ID = item.SHIFT_CODE, Text = item.SHIFT_NAME });
// }
// else
// {
// model.Add(new ComboboxItem { ID = item.SHIFT_CODE, Text = item.SHIFT_NAME });
// }
//}
//return Content(model.ToString());
foreach (var team in list)
{
team.PRODUCESHIFTNAME = team.PRODUCESHIFTTCODE + "/" + team.PRODUCESHIFTNAME;
}
list.Insert(0, new ProduceShift() { PRODUCESHIFTTCODE = "", PRODUCESHIFTNAME = " " });
return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}