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.ServicesAgent; using QMAPP.FJC.Web.Models.FeedInManage; using QMAPP.Common.Web.Controllers; using QMAPP.FJC.Entity.Injection; using QMAPP.Entity; using System.Data; using QMAPP.FJC.Entity.ProduceManage; using QMAPP.MD.Entity; using Corp = QMAPP.FJC.Entity.Basic.Corp; using ProcessRoute = QMAPP.FJC.Entity.Basic.ProcessRoute; using WorkCell = QMAPP.MD.Entity.WorkCell; using WorkLoc = QMAPP.MD.Entity.WorkLoc; using QMAPP.FJC.Entity.FIS; using QMAPP.FJC.Entity.FileCopy.FIS; using QMAPP.MD.BLL.Dict; using QMAPP.FJC.Entity.Basic; namespace QMAPP.FJC.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 表皮查询获得物料号下拉列表(张敬贺 2015.05.28) /// /// 获得所属仓库中存储区域对应的零件号下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterielDropDownList(string id) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(id) == false) { var dataResult = wcfAgent.InvokeServiceFunction>>(QMAPP.ServicesAgent.FeedInManage.EpidermisBLL_GetProductInfectionList.ToString(), id); foreach (InjectionRecorder ps in dataResult.Result) { //将数据添加到model中 if (ps.PROCESSTYPE == ((int)QMAPP.FJC.Entity.EnumGeter.ProductType.biaopi).ToString()) { ps.MATERIALCODE = ps.MATERIALCODE + "/" + ps.MATERIALTYPE + "/" + ps.INJECTIONTERMINAL; } else { ps.MATERIALCODE = ps.MATERIALCODE + "/" + ps.MATERIALTYPE; } list.Add(CopyToModel(ps)); } list.Insert(0, new EpidermisModel { PID = "", MATERIALCODE = "" }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } else { return Content(AppResource.DeleteMessage); } } catch (Exception ex) { throw ex; } } #endregion #region 获取缺陷类型 [HandleException] public ActionResult GetDefectDropDownList() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction("DefectTypeBLL_GetDefectType"); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); //闫永刚2018-8-8修改 foreach (DataRow dr in dataResult.Rows) { string keyvalue = dr["DEFECTKEY"].ToString(); //int keyvalue = Convert.ToInt32(dr["DEFECTKEY"]); string defectValue = dr["DEFECTVALUE"].ToString(); defectValue = defectValue.Replace("\r", ""); defectValue = defectValue.Replace("\n", ""); model.Add(new ComboboxItem { ID = keyvalue.ToString(), Text = defectValue }); } 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; } } /// /// 获取工厂下拉列表 /// /// 数据源 [HandleException] public ActionResult GetNewFactoryComboxSource() { 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 GetALLWorkCellBasicComboxSource(string routecode) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("ProcessInfoBLL_GetProcessInfoBasicList", new QMAPP.FJC.Entity.Basic.ProcessInfo() { PROCESSTYPE = routecode }); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (QMAPP.FJC.Entity.Basic.ProcessInfo item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.PID, Text = item.PROCESSNAME }); } 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 QMAPP.FJC.Entity.Basic.ProcessInfo()); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (QMAPP.MD.Entity.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 获取新物料信息下拉列表 /// /// 获取物料信息下拉列表GetMaterialClassList /// /// 数据源 [HandleException] public ActionResult GetNewMaterialComboxSource(string materialtype) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var result = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material() { MATERIAL_TYPE_CODE = materialtype }); 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 GetMaterialWithTypeComboxSource(string materialtype) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(materialtype) == false) { var dataResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material() { MATERIAL_TYPE_CODE = materialtype }); foreach (Material item in dataResult) { item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME; 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 获取物料信息下拉列表(FIS用) /// /// 获取物料信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetFisMaterialComboxSource() { WorkCell info = new WorkCell(); info.WORKCENTER_CODE = Request.Params["WORKCENTER_CODE"]; ServiceAgent wcfAgent = this.GetServiceAgent(); try { var result = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetNewMaterialList", new Material(), info); 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_CODE + "/" + item.MATERIAL_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取物料信息下拉列表(订单) /// /// 获取物料信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialSource(string ordertype) { //WorkCell info = new WorkCell(); //info.WORKCELL_CODE = ordertype; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialForInjectOrder", ordertype); foreach (Material item in dataResult) { item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME; 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 GetMaterialDoorPlan(string ordertype, string color, string hbtype, string mattypes) { Material info = new Material(); #region 前台传入后台文字乱码 //if (color !="undefined") //{ // DictManageBLL dictCOLORBll = new DictManageBLL(DictKind.COLOR); // //颜色 // color = dictCOLORBll.GetDictValue(color).GetHashCode().ToString(); // } //if (hbtype != "undefined") //{ // DictManageBLL dictHBtypeBll = new DictManageBLL(DictKind.HBTYPE); // //高低配 // hbtype = dictHBtypeBll.GetDictValue(hbtype).GetHashCode().ToString(); //} #endregion info.ORDER_TYPE = ordertype; info.COLOR = color; info.HBTYPE = hbtype; if (string.IsNullOrEmpty(mattypes) == false && mattypes != "undefined") { info.MaterialCodes = "('" + mattypes.Replace(";", "','") + "')"; } List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialDoorPlan", info); foreach (Material item in dataResult) { item.MATERIAL_NAME = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME; 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 GetFisDoorPlanForCD() { FISAssembly info = new FISAssembly(); List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>("DoorPlankPlanBLL_GetMaterialDoorPlanForCD", info); foreach (FISAssembly item in dataResult) { item.Name =item.Name; list.Add(item); } list.Insert(0, new FISAssembly() { Id="",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_CODE + "/" + item.MATERIAL_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #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 + "/" + item.MATERIAL_TYPE_CODE }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取物料类型(关联物料attribute)下拉列表 /// /// 获取物料类型下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMaterialClassByAttributeComboxSource(string attribute) { ServiceAgent wcfAgent = this.GetServiceAgent(); MaterialClass info = new MaterialClass(); info.MATERIAL_ATTRIBUTE = attribute; List list = new List(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetAllMaterialClassList", info); foreach (MaterialClass item in dataResult) { item.MATERIAL_TYPE_NAME = item.MATERIAL_TYPE_CODE + "/" + item.MATERIAL_TYPE_NAME; list.Add(item); } list.Insert(0,new MaterialClass() { MATERIAL_TYPE_CODE = "", MATERIAL_TYPE_NAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #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; } } public ActionResult GetFactoryMaterialComboxSource(string factoryCode) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var list = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", new Material{FACTORY_CODE = factoryCode}); //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()); list.Insert(0, new Material() { MATERIAL_CODE = "", MATERIAL_NAME = " " }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } /// /// FIS /// /// [HandleException] public ActionResult GetFisMaterialTree(string ordertype) { ServiceAgent wcfAgent = this.GetServiceAgent(); Material material = new Material(); if (!string.IsNullOrEmpty(ordertype)) { int i=0; if (int.TryParse(ordertype, out i) == false) { material.ORDER_TYPE = ordertype; } else { material.MATERIAL_ATTRIBUTE = ordertype; } } try { var materialResult = wcfAgent.InvokeServiceFunction> ("MaterialBLL_GetMaterialList", 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; } } /// /// 获取物料信息下拉列表 /// /// 数据源 [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; } } /// /// 追加树节点 /// /// /// /// 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 GetALLWorkCellComboxSource() { 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 }); 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 GetWorkCellBasicComboxSource(string routecode) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("WorkCellBLL_GetWorkCellList", new WorkCell() ,routecode); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (WorkCell item in dataResult.Result) { 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 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_CODE + "/" + 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 GetWorkLocFromWorkCellComboxSource(string workCellCode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(workCellCode) == false) { var dataResult = wcfAgent.InvokeServiceFunction> ("WorkLocBLL_GetWorkLocFromWorkCellList", new WorkLoc(), workCellCode); 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 ActionResult GetWorkLocComboxSource(string workCenterCode) { List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (string.IsNullOrEmpty(workCenterCode) == false) { list = wcfAgent.InvokeServiceFunction> ("WorkLocBLL_GetWorkLocFromWorkCenterCodeList", workCenterCode); //foreach (WorkLoc item in dataResult) //{ // item.WORKLOC_NAME = 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 ActionResult GetProduceShiftComboxSource(string workcentercode) { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction> ("ProduceShiftBLL_GetWorkcenterShifts", workcentercode); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (ProduceShift item in dataResult) { model.Add(new ComboboxItem { ID = item.PRODUCESHIFTTCODE, Text = item.PRODUCESHIFTTCODE + "/" + item.PRODUCESHIFTNAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #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_CODE + "/" + item.ROUTE_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取全部工作中心下拉列表 /// /// 获取工作中心下拉列表 /// /// 数据源 [HandleException] public ActionResult GetAllWorkCenterComboxSource() { string kind = Request.Params["kind"]; var workCenter = new WorkCenter(); if (!string.IsNullOrEmpty(kind)) { workCenter.CENTER_TYPE = "0"; } ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("WorkCenterBLL_GetWorkCenterList", 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 }); var list = dataResult.Result; list.Insert(0, new WorkCenter() { WORKCENTER_CODE = "", WORKCENTER_NAME = " " }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #endregion #region 获取计划状态 /// /// 获取计划状态 /// /// 数据源 [HandleException] public ActionResult GetPlanStateComboxSource() { ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); model.Add(new ComboboxItem { ID = "初始", Text = "初始" }); model.Add(new ComboboxItem { ID = "处理中", Text = "处理中" }); model.Add(new ComboboxItem { ID = "完成", Text = "完成" }); return Content(model.ToString()); } #endregion #region 获取PBOM头物料信息下拉列表 /// /// 获取BOM头物料信息下拉列表 /// /// 数据源 [HandleException] public ActionResult GetPbomMaterialComboxSource() { ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction>> ("MaterialBLL_GetPbomMaterialList", new Material()); ComboboxResult model = new ComboboxResult(); model.Add(new ComboboxItem { ID = "", Text = this.EmptyItemTitle }); foreach (Material item in dataResult.Result) { model.Add(new ComboboxItem { ID = item.MATERIAL_CODE, Text = item.MATERIAL_CODE + "/" + item.MATERIAL_NAME }); } return Content(model.ToString()); } catch (Exception ex) { throw ex; } } #endregion #region 获取设备(MACHINE)下拉列表 /// /// 获取设备(MACHINE)下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMachineForOrder(string ordertype) { WorkCell info = new WorkCell(); info.WORKCELL_CODE = ordertype; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { //if (string.IsNullOrEmpty(ordertype) == false) //{ var dataResult = wcfAgent.InvokeServiceFunction> ("MachineInfoBLL_GetMachineForOrderList", new QMAPP.FJC.Entity.Basic.MachineInfo(), 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() { MACHINECODDE = "", MACHINENAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } /// /// 获取设备(MACHINE)下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMachineList(string workcentercode) { QMAPP.FJC.Entity.Basic.MachineInfo info = new Entity.Basic.MachineInfo(); info.WORKCENTER_CODE = workcentercode; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { //if (string.IsNullOrEmpty(ordertype) == false) //{ var dataResult = wcfAgent.InvokeServiceFunction> ("MachineInfoBLL_GetMachineInfoList", 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() { MACHINECODDE = "", MACHINENAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } /// /// 获取设备模架下拉列表 /// /// 数据源 [HandleException] public ActionResult GetMouldList(string machinecode) { QMAPP.FJC.Entity.Basic.MachineInfoModels info = new Entity.Basic.MachineInfoModels(); info.MachineCode = machinecode; List list = new List(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if (!string.IsNullOrEmpty(machinecode)) { var machine = wcfAgent.InvokeServiceFunction ("MachineInfoBLL_GetMachineInfo", new QMAPP.FJC.Entity.Basic.MachineInfo { MACHINECODDE = machinecode }); if (machine != null) { info.MID = machine.PID; } } var dataResult = wcfAgent.InvokeServiceFunction> ("MachineInfoModelBLL_GetAllList", info); foreach (QMAPP.FJC.Entity.Basic.MachineInfoModels item in dataResult) { item.MODELNAME = item.MODELCODE + "/" + item.MODELNAME; list.Add(item); } //} list.Insert(0, new QMAPP.FJC.Entity.Basic.MachineInfoModels() { MODELCODE = "", MODELNAME = this.EmptyItemTitle }); return Content(QMFrameWork.Common.Serialization.JsonConvertHelper.GetSerializes(list)); } catch (Exception ex) { throw ex; } } #endregion #region 获取计划流水号 /// /// 获取计划流水号 /// /// 数据源 [HandleException] public ActionResult GetOrderPlanSeq(string datestr,string prefix) { FISPlan fisplan = new FISPlan(); fisplan.DATASTR = datestr; fisplan.PREFIX = prefix; ServiceAgent wcfAgent = this.GetServiceAgent(); try { var dataResult = wcfAgent.InvokeServiceFunction ("OrderPlanBLL_GetOrderPlanSeq", fisplan); return Json(dataResult, JsonRequestBehavior.AllowGet); } catch (Exception ex) { throw ex; } } #endregion /// /// 获取物料类型树 /// /// [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; } } /// /// 获取物料类型树(有过滤) /// /// [HandleException] public ActionResult GetMaterialClassTreeDea(string type) { MaterialClass materialclass = new MaterialClass(); ServiceAgent wcfAgent = this.GetServiceAgent(); try { if(!string.IsNullOrEmpty(type)) { materialclass.MATERIAL_ATTRIBUTE = type; } var classresult = wcfAgent.InvokeServiceFunction>> ("MaterialBLL_GetMaterialClassList", 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); } } #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 } }