public ActionResult Current_Manpower() { FixtureVM currentVM = new FixtureVM(); int optypeID = 0; int funPlantID = 0; if (CurrentUser.GetUserInfo.OrgInfo != null && CurrentUser.GetUserInfo.OrgInfo.Count > 0 && CurrentUser.GetUserInfo.OrgInfo[0].Plant != null && CurrentUser.GetUserInfo.OrgInfo[0].Plant_OrganizationUID != null) { if (CurrentUser.GetUserInfo.OrgInfo[0].OPType_OrganizationUID != null) { optypeID = CurrentUser.GetUserInfo.OrgInfo[0].OPType_OrganizationUID.Value; } if (CurrentUser.GetUserInfo.OrgInfo[0].Funplant_OrganizationUID != null) { funPlantID = CurrentUser.GetUserInfo.OrgInfo[0].Funplant_OrganizationUID.Value; } currentVM.Plants = new List <PlantVM>() { new PlantVM() { Plant = CurrentUser.GetUserInfo.OrgInfo[0].Plant, Plant_OrganizationUID = CurrentUser.GetUserInfo.OrgInfo[0].Plant_OrganizationUID.Value } }; } else { //获取 var Plants = new List <PlantVM>(); var apiUrl = string.Format("Settings/GetPlantsAPI?PlantOrgUid={0}", 0); HttpResponseMessage responMessage = APIHelper.APIGetAsync(apiUrl); var result = responMessage.Content.ReadAsStringAsync().Result; var systemOrgDTOs = JsonConvert.DeserializeObject <List <SystemOrgDTO> >(result); foreach (var item in systemOrgDTOs) { PlantVM plantvm = new PlantVM() { Plant = item.Organization_Name, Plant_OrganizationUID = item.Organization_UID }; Plants.Add(plantvm); } currentVM.Plants = Plants; } currentVM.OptypeID = optypeID; currentVM.FunPlantID = funPlantID; return(View("Current_Manpower", currentVM)); //Dictionary<int, string> plantDir = new Dictionary<int, string>(); //Dictionary<int, string> opTypeDir = new Dictionary<int, string>(); //var apiUrl = string.Format("ProductionResourcePlan/GetProjectInfoByUserAPI"); //HttpResponseMessage responMessage = APIHelper.APIPostAsync(this.CurrentUser.GetUserInfo, apiUrl); //var result = responMessage.Content.ReadAsStringAsync().Result; //var item = JsonConvert.DeserializeObject<ProductionPlanningReportGetProject>(result); //ViewBag.Plant = item.plantDir; //ViewBag.OPType = item.opTypeDir; //return View(); }
/// <summary> /// ME 初始化資料 /// </summary> /// <returns></returns> public ActionResult ProductionPlanMeList() { ProductionPlanMeVM currentVM = new ProductionPlanMeVM(); int optypeID = 0; int funPlantID = 0; if (CurrentUser.GetUserInfo.OrgInfo != null && CurrentUser.GetUserInfo.OrgInfo.Count > 0 && CurrentUser.GetUserInfo.OrgInfo[0].Plant != null && CurrentUser.GetUserInfo.OrgInfo[0].Plant_OrganizationUID != null) { if (CurrentUser.GetUserInfo.OrgInfo[0].OPType_OrganizationUID != null) { optypeID = CurrentUser.GetUserInfo.OrgInfo[0].OPType_OrganizationUID.Value; } if (CurrentUser.GetUserInfo.OrgInfo[0].Funplant_OrganizationUID != null) { funPlantID = CurrentUser.GetUserInfo.OrgInfo[0].Funplant_OrganizationUID.Value; } currentVM.Plants = new List <PlantVM>() { new PlantVM() { Plant = CurrentUser.GetUserInfo.OrgInfo[0].Plant, Plant_OrganizationUID = CurrentUser.GetUserInfo.OrgInfo[0].Plant_OrganizationUID.Value } }; } else { //获取 var Plants = new List <PlantVM>(); var apiUrl = string.Format("Settings/GetPlantsAPI?PlantOrgUid={0}", 0); var responMessage = APIHelper.APIGetAsync(apiUrl); var result = responMessage.Content.ReadAsStringAsync().Result; var systemOrgDTOs = JsonConvert.DeserializeObject <List <SystemOrgDTO> >(result); foreach (var item in systemOrgDTOs) { PlantVM plantvm = new PlantVM() { Plant = item.Organization_Name, Plant_OrganizationUID = item.Organization_UID }; Plants.Add(plantvm); } currentVM.Plants = Plants; } currentVM.OptypeID = optypeID; currentVM.FunPlantID = funPlantID; ViewBag.PageTitle = "ME数据维护作业"; return(View("ProductionPlanMeList", currentVM)); //return View(); }