using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using QMAPP.Common.Web.Controllers; using QMFrameWork.WebUI.Attribute; using QMAPP.MD.Entity; using QMAPP.Entity; using QMAPP.FJC.Entity.Basic; using QMAPP.ServicesAgent; using QMFrameWork.WebUI.DataSource; using QMAPP.MESReport.Entity.LineQTY; using QMAPP.MESReport.Entity.Tables; using ProcessRoute = QMAPP.FJC.Entity.Basic.ProcessRoute; using WorkCenter = QMAPP.MD.Entity.WorkCenter; namespace QMAPP.MESReport.Web.Controllers { /// /// 公共类 /// 于子清 /// 2017-10-11 /// public class DictController : QController { public string EmptyItemTitle = " "; #region 获取工艺路线下拉列表 /// /// 获取工艺路线下拉列表 /// /// 数据源 [HandleException] public ActionResult GetProcessRouteComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("ProcessRouteBLL_GetProcessRouteList", new ProcessRoute()); 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_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取工序下拉列表(联动) /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCellBasicWithTypeComboxSource(string routecode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(routecode) == false) { var dataResult = wcfAgent.InvokeServiceFunction> ("WorkCellBLL_GetNewWorkCellList", new WorkCell(), routecode); foreach (WorkCell item in dataResult) { item.WORKCELL_NAME = item.WORKCELL_NAME; list.Add(item); } } list.Insert(0, new WorkCell() { WORKCELL_CODE = "", WORKCELL_NAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #endregion #region 获取工序下拉列表(联动)排序 /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCellSeqComboxSource(string routecode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(routecode) == false) { list = wcfAgent.InvokeServiceFunction> ("WorkCellBLL_GetNewWorkCellListSeq", routecode); //foreach (WorkCell item in dataResult) //{ // //item.WORKCELL_NAME = item.WORKCELL_NAME; // list.Add(item); //} } list.Insert(0, new WorkCell() { WORKCELL_CODE = "", WORKCELL_NAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #endregion #region 工序下拉框 /// /// 获取工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetWorkCellComboxSource() { 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_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取班次下拉框 /// /// 获取班次下拉框 /// /// 数据源 [HandleException] public ActionResult GetShiftList() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("LineShiftQTYCountBLL_GetTQTSHIFTList"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (T_QT_SHIFT item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.SHIFT_CODE, Text = item.SHIFT_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取EQ /// /// 获取工作中心下拉列表 /// /// 数据源 [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 GetWList() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("ShipmentCountBLL_GetWList"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (ShipmentCountConditionModel item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取设备列表 /// /// 获取设备列表 /// /// 数据源 [HandleException] public ActionResult GetSList() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("EqueUseCountBLL_GetSList"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (T_BD_MACHINEINFO item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINENAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取日周月下拉菜单 /// /// 获取日周月下拉菜单 /// /// [HandleException] public ActionResult GetTJList() { try { ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); model.Add(new ComboboxItem { ID = "DAY", Text = "日"}); model.Add(new ComboboxItem { ID = "WEEK", Text = "周" }); model.Add(new ComboboxItem { ID = "MONTH", Text = "月" }); return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取日月年下拉菜单 /// /// 获取日月年下拉菜单 /// /// [HandleException] public ActionResult GetYMDList() { try { ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); model.Add(new ComboboxItem { ID = "DAY", Text = "日" }); model.Add(new ComboboxItem { ID = "MONTH", Text = "月" }); model.Add(new ComboboxItem { ID = "YEAR", Text = "年" }); return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取呼叫类型 /// /// 获取呼叫类型 /// /// [HandleException] public ActionResult GetCALLTYPE() { try { 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 = "质量呼叫" }); model.Add(new ComboboxItem { ID = "2", Text = "物料呼叫" }); model.Add(new ComboboxItem { ID = "3", Text = "工程呼叫" }); return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取工作中心-写死 [HandleException] public ActionResult GetSendPlanWorkCenter() { { try { ComboboxResult model = new ComboboxResult(); //model.Add(new ComboboxItem { ID = "DPLFY/DPRFY", Text = "门板发运" }); model.Add(new ComboboxItem { ID = "IPFY01", Text = "东厂仪表板发运" }); model.Add(new ComboboxItem { ID = "IPFY02", Text = "西厂仪表板发运" }); return Content(model.ToString()); } catch (Exception ex) { throw ex; } } } #endregion #region 获取呼叫原因 /// /// 获取呼叫原因 /// /// [HandleException] public ActionResult GetCALLREA() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("EqueUseCountBLL_GetSList"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (T_BD_MACHINEINFO item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINENAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取全部工作中心下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetAllWorkCenterComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var centerType = "0"; var dataResult = wcfAgent.InvokeServiceFunction>> ("WorkCenterBLL_GetWorkCenterList", new WorkCenter { CENTER_TYPE = centerType }); 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; } } [HandleException] public ActionResult GetWorkcenterComboxSource() { try { ComboboxResult model = new ComboboxResult(); //model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); model.Add(new ComboboxItem { ID = "INJECTION_AREA", Text = "注塑工作中心" }); //model.Add(new ComboboxItem { ID = "1", Text = "宝来门板装配中心" }); //model.Add(new ComboboxItem { ID = "2", Text = "宝来仪表板装配工作中心" }); model.Add(new ComboboxItem { ID = "SLUSH_AREA", Text = "搪塑工作中心" }); model.Add(new ComboboxItem { ID = "VW371_FOAMAREA", Text = "浇注工作中心" }); model.Add(new ComboboxItem { ID = "BC316_ASSLINE", Text = "BC316仪表" }); model.Add(new ComboboxItem { ID = "VW371_IPASSYLINE", Text = "VW371仪表" }); model.Add(new ComboboxItem { ID = "VW371_DPASSYLINE", Text = "VW371门板" }); return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取设备(MACHINE)下拉列表 /// /// 获取设备(MACHINE)下拉列表 /// /// 工作中心 [HandleException] public ActionResult GetMachine(string workcenter) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("EqueUseCountBLL_GetMachine", workcenter); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (T_BD_MACHINEINFO item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINENAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取全部设备下拉列表 /// /// 获取全部工序下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMachineListComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var machineList = wcfAgent.InvokeServiceFunction> ("MachineInfoBLL_GetMachineList"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (MachineInfo item in machineList) { model.Add(new ComboboxItem { ID = item.MACHINECODDE, Text = item.MACHINECODDE + "/" + item.MACHINENAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取项目号 [HandleException] public ActionResult GetProjectList() { ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "VW371 IP", Text = "VW371仪表板" }); model.Add(new ComboboxItem { ID = "VW371 DP", Text = "VW371门板" }); model.Add(new ComboboxItem { ID = "BC316 IP", Text = "BC316仪表板" }); return Content(model.ToString()); } #endregion #region 配置项下拉获取 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 获取零件号 public ActionResult GetMaterialForCount() { string projectCode = Request.Params["PROJECTCODE"]; string hbtype = Request.Params["HBTYPE"]; string color = Request.Params["COLOR"]; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material() { PROJECTCODE = projectCode, HBTYPE = hbtype, COLOR = color, MATERIAL_ATTRIBUTE = "2" }); foreach (Material item in dataResult) { list.Add(item); } list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #endregion #region 获取物料信息下拉列表(所有) /// /// 获取物料信息下拉列表(所有) /// /// 数据源 [HandleException] public ActionResult GetALLMaterialComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var result = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material()); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (Material item in result) { model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取物料信息下拉列表 /// /// 获取物料信息下拉列表 /// /// 数据源 [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 = " " }); 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 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 } }