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 { /// /// 字典管理 /// public class DictController : QController { /// /// 空数据项显示值 /// public string EmptyItemTitle = " "; #region 获取下拉列表固定数据源 /// /// 获取下拉列表固定数据源 /// /// 数据源 [HandleException] public ActionResult GetFixedComboxSource() { string kind = Request.Params["kind"]; //单雨春 是否带空项 2014年9月26日 bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false; Dictionary 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 获取下拉列表数据源 /// /// 获取下拉列表数据源 /// /// [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 获取公司下拉列表 /// /// 获取公司下拉列表 /// /// 数据源 [HandleException] public ActionResult GetCorpComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取工厂下拉列表 /// /// 获取工厂下拉列表 /// /// 数据源 [HandleException] public ActionResult GetFactoryComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取工作中心下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCenterComboxSource() { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取全部工作中心下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetAllWorkCenterComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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>> ("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 获取工序下拉列表(联动) /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCellComboxSource(string workcenterCode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(workcenterCode) == false) { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取全部工序下拉列表 /// /// 获取全部工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetALLWorkCellComboxSource() { string kind = Request.Params["kind"]; ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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> ("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 获取工位下拉列表(联动) /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkLocFromWorkCellComboxSource(string routecode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(routecode) == false) { var dataResult = wcfAgent.InvokeServiceFunction> ("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 获取工位下拉列表(编辑页面) /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public string GetWorkLocFromWorkCelEditlComboxSource() { string kind = Request.Params["kind"]; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(kind) == false) { var dataResult = wcfAgent.InvokeServiceFunction> ("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 获取物料信息下拉列表--树 /// /// 获取物料信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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; } } /// /// 获取物料信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialTree() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var materialResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material()); var classresult = wcfAgent.InvokeServiceFunction>> ("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result; List trees = new List(); 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() }; 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> ("MaterialBLL_GetMaterialList", new Material{FACTORY_CODE = factoryCode}); var classresult = wcfAgent.InvokeServiceFunction>> ("MaterialBLL_GetMaterialClassList", new MaterialClass { FACTORY_CODE = factoryCode }).Result; List trees = new List(); 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() }; AppendTree(subnode, classresult, materialResult); if (subnode.children.Count > 0) { trees.Add(subnode); } } return Json(trees); } catch (Exception ex) { throw ex; } } /// /// 追加树节点 /// /// /// /// private void AppendTree(CombotreeItem node, List mclasslist,List 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() }; 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 获取物料类型下拉列表 /// /// 获取物料类型下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialClassComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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; } } /// /// 获取物料类型树 /// /// [HandleException] public ActionResult GetMaterialClassTree() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var classresult = wcfAgent.InvokeServiceFunction>> ("MaterialBLL_GetMaterialClassList", new MaterialClass()).Result; List trees = new List(); 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() }; AppendTree(subnode, classresult); trees.Add(subnode); } return Json(trees); } catch (Exception ex) { throw ex; } } private void AppendTree(CombotreeItem node, List 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() }; AppendTree(subnode, mclasslist); node.children.Add(subnode); } } #endregion #region 获取颜色信息下拉列表 /// /// 获取颜色信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialColorComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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 获取全部设备下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetAllEquipmentComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取全部工艺路线下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetAllRouteComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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>> ("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 获取工艺路线工序下拉列表(联动) /// /// 获取工艺路线工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetRouteWorkCellComboxSource(string routeCode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(routeCode) == false) { var dataResult = wcfAgent.InvokeServiceFunction>> ("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上级项目序号组成信息(联动) /// /// 获取PBOM下的BOM上级项目序号组成信息(联动) /// /// 数据源 [HandleException] public ActionResult GetBomItemUpSqNumComboxSource(string pbomRoute) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(pbomRoute) == false) { var dataResult = wcfAgent.InvokeServiceFunction>> ("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 获取设备设备下拉列表 /// /// 获取设备设备下拉列表 /// /// [HandleException] public ActionResult GetMachineNameComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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> ("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 获取项目号下拉列表 /// /// 获取项目号下拉列表 /// /// 数据源 [HandleException] public ActionResult GetProjectComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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>> ("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)下拉列表 /// /// 获取设备(MACHINE)下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMachineComboxSource() { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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 获取用户下拉列表 /// /// 获取用户下拉列表 /// /// 数据源 [HandleException] public ActionResult GetUserComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); User user=new User(); user.ActivateFlg="1"; try { var dataResult = wcfAgent.InvokeServiceFunction>> ("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>> ("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 获取信息下拉列表(订单) /// /// 获取物料信息下拉列表 /// /// 数据源 [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 list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("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 获取全部设备下拉列表 /// /// 获取设备设备下拉列表 /// /// [HandleException] public ActionResult GetAllMachineInfoListComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var list = wcfAgent.InvokeServiceFunction> ("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> ("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 获取解析类别 /// /// 获取解析类别 /// /// 数据源 [HandleException] public ActionResult GetAnalyzerComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var list = wcfAgent.InvokeServiceFunction> ("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 获取状态码下拉列表 /// /// 获取状态码下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCellStateCodeComboxSource(string workCellCode) { //List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var list = wcfAgent.InvokeServiceFunction> ("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 获取录入退出 /// /// 获取录入退出 /// /// 数据源 [HandleException] public ActionResult GetEntryExitActionComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var list = wcfAgent.InvokeServiceFunction> ("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 获取呼叫类型 /// /// 获取呼叫类型 /// /// 数据源 [HandleException] public ActionResult GetConfigDetailComboxSource() { string kind = Request.Params["kind"]; bool isWithEmpty = string.IsNullOrEmpty(Request.Params["WithEmpty"]) ? true : false; Dictionary dicts = null; try { ComboboxResult model = new ComboboxResult(); if (isWithEmpty) { model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); } //执行查询 List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); list = wcfAgent.InvokeServiceFunction>("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 获取班组下拉列表 /// /// 获取班组下拉列表 /// /// public ContentResult GetTeamComboxSource() { ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); Team entity = new Team(); List list = new List(); try { //获取工序信息 list = wcfAgent.InvokeServiceFunction>("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 listProcessInfo = new List(); ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); Team entity = new Team { FACTORY_CODE = factoryCode }; List list = new List(); try { //获取工序信息 list = wcfAgent.InvokeServiceFunction>("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 获取班次下拉列表 /// /// 获取班次下拉列表 /// /// public ContentResult GetShiftComboxSource() { //List listProcessInfo = new List(); ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); ProduceShift entity = new ProduceShift(); List result = new List(); try { //获取工序信息 result = wcfAgent.InvokeServiceFunction>("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 listProcessInfo = new List(); ComboboxResult model = new ComboboxResult(); ServiceAgent wcfAgent = this.GetServiceAgent(); ProduceShift entity = new ProduceShift { PRODUCELINE = workcentercode }; List list = new List(); try { //获取工序信息 list = wcfAgent.InvokeServiceFunction>("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 } }