Пример #1
0
        public ActionResult ExportDemissionRateInfo(DemissionRateAndWorkScheduleDTO search)
        {
            //get Export datas
            var apiUrl        = "ProductionResourcePlan/ExportDemissionRateInfoAPI";
            var responMessage = APIHelper.APIPostAsync(search, apiUrl);
            var result        = responMessage.Content.ReadAsStringAsync().Result;
            var list          = JsonConvert.DeserializeObject <List <DemissionRateAndWorkScheduleDTO> >(result);

            var stream      = new MemoryStream();
            var fileName    = PathHelper.SetGridExportExcelName("DemissionRateAndWorkSchedule");
            var filePath    = Path.Combine(PathHelper.GetGridExportExcelDirectory, fileName);
            var stringHeads = new string[] {
                "序号",
                "厂区",
                "OP类型",
                "生产日期",
                "生产阶段",
                "NPI离职率",
                "NPI预计招募人力",
                "MP离职率",
                "MP预计招募人力",
                "排班机制",
            };

            using (var excelPackage = new ExcelPackage(stream))
            {
                //set sheet name
                var worksheet = excelPackage.Workbook.Worksheets.Add("DemissionRateAndWorkSchedule");

                //set Title
                for (int colIndex = 0; colIndex < stringHeads.Length; colIndex++)
                {
                    worksheet.Cells[1, colIndex + 1].Value = stringHeads[colIndex];
                }

                //set cell value
                for (int index = 0; index < list.Count; index++)
                {
                    var currentRecord = list[index];
                    //seq
                    worksheet.Cells[index + 2, 1].Value  = index + 1;
                    worksheet.Cells[index + 2, 2].Value  = currentRecord.Organization_Name;
                    worksheet.Cells[index + 2, 3].Value  = currentRecord.OPType;
                    worksheet.Cells[index + 2, 4].Value  = currentRecord.Product_Phase;
                    worksheet.Cells[index + 2, 5].Value  = currentRecord.Product_Date.ToString("yyyy-MM-dd hh:ss");
                    worksheet.Cells[index + 2, 6].Value  = (currentRecord.DemissionRate_NPI / 100).ToString("p");
                    worksheet.Cells[index + 2, 7].Value  = currentRecord.NPI_RecruitStaff_Qty;
                    worksheet.Cells[index + 2, 8].Value  = (currentRecord.DemissionRate_MP / 100).ToString("p");;
                    worksheet.Cells[index + 2, 9].Value  = currentRecord.MP_RecruitStaff_Qty;
                    worksheet.Cells[index + 2, 10].Value = currentRecord.WorkSchedule;
                }
                worksheet.Cells.AutoFitColumns();
                excelPackage.Save();
            }

            return(new FileContentResult(stream.ToArray(), "application/octet-stream")
            {
                FileDownloadName = Server.UrlEncode(fileName)
            });
        }
Пример #2
0
        public ActionResult SaveDemissionInfo(DemissionRateAndWorkScheduleDTO dto)
        {
            //新加
            if (dto.DemissionRateAndWorkSchedule_UID == 0)
            {
                dto.Created_Date  = DateTime.Now;
                dto.Created_UID   = this.CurrentUser.AccountUId;
                dto.Modified_Date = DateTime.Now;
                dto.Modified_UID  = this.CurrentUser.AccountUId;
            }
            else
            {
                dto.Modified_Date = DateTime.Now;
                dto.Modified_UID  = this.CurrentUser.AccountUId;
            }

            dto.DemissionRate_NPI = dto.DemissionRate_NPI / 100;
            dto.DemissionRate_MP  = dto.DemissionRate_MP / 100;

            ////判断是否是重复的值
            //var repeatList = demissionList.Where(p => p.Plant_Organization_UID == item.Plant_Organization_UID && p.BG_Organization_UID == item.BG_Organization_UID && p.Product_Date == item.Product_Date && p.Product_Phase == item.Product_Phase);
            //if (repeatList.Count() > 0)
            //{
            //    var model = repeatList.FirstOrDefault();
            //    errorInfo = string.Format("导入的Excel中厂区={0},OP={1},生产阶段={2},生产时间={3}", Plant_Organization, BG_Organization, model.Product_Phase, model.Product_Date);
            //    return errorInfo;
            //}

            var apiUrl = string.Format("ProductionResourcePlan/SaveDemissionInfoAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(dto, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
        public ActionResult QueryPlanAndActualReportInfo(ProductionPlanningReportVM vm, Page page)
        {
            var apiUrl = string.Format("ProductionPlanning/QueryPlanAndActualReportInfoAPI");

            HttpResponseMessage responMessage = APIHelper.APIPostAsync(vm, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;
            var dt     = JsonConvert.DeserializeObject <DataTable>(result) as DataTable;
            //获取动态列名
            List <string> columnList = new List <string>();

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                var columnName = dt.Columns[i].ColumnName;
                if (columnName != "Process_Seq" && columnName != "Process" && columnName != "Equipment_Name")
                {
                    columnList.Add(columnName);
                }
            }

            var jsonName = JsonConvert.SerializeObject(columnList);


            var test = "{\"columnList\":" + jsonName + "," + "\"data\":" + result + "}";

            return(Content(test, "application/json"));
        }
Пример #4
0
        /// <summary>
        /// 匯入 ME & 明細檔 & 設備明細檔
        /// </summary>
        /// <returns></returns>
        public string ImportExcel(HttpPostedFileBase uploadName, string FlowChart_Version_Comment, int FlowChart_Master_UID)
        {
            string                   errorInfo          = string.Empty;
            bool                     isEdit             = false;
            List <RP_VM>             rP_VM              = new List <RP_VM>();
            List <RP_ME_D_Equipment> equipmentList      = new List <RP_ME_D_Equipment>();
            List <RP_ME_D_Equipment> autoEquipmentList  = new List <RP_ME_D_Equipment>();
            List <RP_ME_D_Equipment> auxiliaryEquipList = new List <RP_ME_D_Equipment>();

            if (FlowChart_Master_UID > 0)
            {
                isEdit    = true;
                errorInfo = new ProductiongPlanningImport().RP_ImportCheck(uploadName, FlowChart_Master_UID, FlowChart_Version_Comment, isEdit, rP_VM, equipmentList, autoEquipmentList, auxiliaryEquipList);
            }
            else
            {
                errorInfo = new ProductiongPlanningImport().RP_ImportCheck(uploadName, 0, FlowChart_Version_Comment, isEdit, rP_VM, equipmentList, autoEquipmentList, auxiliaryEquipList);
            }
            if (string.IsNullOrEmpty(errorInfo))
            {
                RP_All_VM all_VM = new RP_All_VM();
                all_VM.RP_VM = rP_VM;
                all_VM.ProcessingEquipList = equipmentList;
                all_VM.AutoEquipList       = autoEquipmentList;
                all_VM.AuxiliaryEquipList  = auxiliaryEquipList;
                all_VM.IsEdit    = isEdit;
                all_VM.AccountID = this.CurrentUser.AccountUId;
                string api = "ProductionResourcePlan/ProductionPlanningAPI";
                HttpResponseMessage responMessage = APIHelper.APIPostAsync(all_VM, api);
            }
            return(errorInfo);
        }
Пример #5
0
        public ActionResult AddOrEditProcessInfo(ProcessIDTransformConfigDTO editModel)
        {
            if (int.Parse(editModel.VM_IsEnabled) == 1)
            {
                editModel.IsEnabled = true;
            }
            else
            {
                editModel.IsEnabled = false;
            }
            if (int.Parse(editModel.VM_IsSyncNG) == 1)
            {
                editModel.IsSyncNG = true;
            }
            else
            {
                editModel.IsSyncNG = false;
            }

            var apiUrl = string.Format("ProcessIDTRSConfig/AddOrEditProcessInfoAPI");

            editModel.Modified_UID  = CurrentUser.AccountUId;
            editModel.Modified_Date = DateTime.Now;
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(editModel, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
        public ActionResult DLSummary()
        {
            Dictionary <int, string> plantDir  = new Dictionary <int, string>();
            Dictionary <int, string> opTypeDir = new Dictionary <int, string>();


            var apiUrl = string.Format("ProductionPlanning/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;

            //List<OrganiztionVM> Orgnizations = CurrentUser.GetUserInfo.OrgInfo;
            //if (Orgnizations != null && Orgnizations.Count > 0)
            //{
            //    ViewBag.OP = Orgnizations[0].Plant;
            //}
            //else
            //{
            //    ViewBag.OP = 0;
            //}
            return(View());
        }
Пример #7
0
        public ActionResult AddNotice(string jsonAddNotice)
        {
            var apiUrl = "Chart/AddNoticeAPI";
            var entity = JsonConvert.DeserializeObject <NoticeDTO>(jsonAddNotice);

            if (DateTime.Compare(entity.Creat_Time, entity.Start_Time) < 0)
            {
                entity.State = "未开始";
            }

            else if (DateTime.Compare(entity.Creat_Time, entity.Start_Time) >= 0 && DateTime.Compare(entity.Creat_Time, entity.End_Time) <= 0)
            {
                entity.State = "进行中";
            }
            else if (DateTime.Compare(entity.Creat_Time, entity.End_Time) > 0)
            {
                entity.State = "已过时";
            }
            entity.Color       = "通知";
            entity.Creator_UID = CurrentUser.AccountUId;
            entity.Creat_Time  = DateTime.Now;
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(entity, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #8
0
        public ActionResult GetME_D_Equipments(ME_EquipmentSearchVM search, Page page)
        {
            var apiUrl = string.Format("ProductionResourcePlan/GetME_D_EquipmentsAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #9
0
        public ActionResult QueryOQCReworkDetails(QAReportSearchVM search, Page page)
        {
            var apiUrl = "OQCQuality/QueryOQCReworkDetailsAPI";
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #10
0
        /// <summary>
        /// 离职率/排版计划维护
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDRAWScheduleList(DRAWS_QueryParam searchParams, Page page)
        {
            var apiUrl = string.Format("ProductionResourcePlan/GetDSPlanListAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(searchParams, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #11
0
        public ActionResult MESSyncReportData(MES_StationDataRecordDTO searchParm, Page page)
        {
            var apiUrl = string.Format("MESStationDataRecord/GetMESSyncReportAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(searchParm, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #12
0
        public ActionResult SaveStaffInfo(CurrentStaffDTO dto)
        {
            var apiUrl = string.Format("ProductionResourcePlan/SaveStaffInfoAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(dto, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(RedirectToAction("CurrentStaffList"));
        }
Пример #13
0
        public ActionResult EditModelLineHR(ModelLineHRDTO dto)
        {
            dto.Modified_Date = DateTime.Now;
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(dto, "ElectricalBoard/EditModelLineHRAPI");
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
        public ActionResult QueryEquipRPTBySingleProject(ReportByProject item, Page page)
        {
            var apiUrl = string.Format("ProductionPlanning/QueryEquipRPTBySingleProjectAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(item, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #15
0
        public ActionResult getShowContent(EboardSearchModel search, Page page)
        {
            var apiUrl = "Chart/getShowContentAPI";
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #16
0
        public ActionResult GetEQPBoard(EQPRepairInfoDTO search, Page page)
        {
            var apiUrl = string.Format("Chart/GetEQPBoardAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #17
0
        public ActionResult QueryNotice(NoticeSearch search, Page page)
        {
            var apiUrl = "Chart/QueryNoticeAPI";
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #18
0
        public ActionResult QuerySumProductData(ChartSearch search, Page page)
        {
            var apiUrl = string.Format("Chart/QuerySumProductDataAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #19
0
        /// <summary>
        /// 全功能厂汇总良率
        /// </summary>
        /// <param name="search"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult QueryProductSaleReportSummery(QAReportSearchVM search, Page page)
        {
            var apiUrl = string.Format("QAProductSaleReport/QueryProductSaleReportSummery");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
        public ActionResult QueryEquipRPTByOPType(ProductionPlanningReportVM vm, Page page)
        {
            string apiUrl = string.Format("ProductionPlanning/QueryEquipRPTByOPTypeAPI");

            DateTime now  = DateTime.Now.Date;
            DateTime date = Convert.ToDateTime(vm.DateFrom);

            if (vm.QueryMode == 1)
            {
                List <string> monthList = new List <string>();
                for (int i = 1; i <= 3; i++)
                {
                    monthList.Add(date.AddMonths(i).ToString(FormatConstants.DateTimeFormatStringByDate));
                }
                var selectDate = monthList.Where(m => m.Contains(vm.hidTab)).First();
                //获取选择的月份的第一天
                var firstDate = selectDate.Substring(0, 8);
                firstDate = firstDate + "01";
                //获取选择的月份的最后一天
                var lastDate = Convert.ToDateTime(firstDate).AddMonths(1).AddDays(-1);
                vm.StartDate = firstDate;
                vm.EndDate   = lastDate.ToString(FormatConstants.DateTimeFormatStringByDate);
            }
            else
            {
                //本月第一天
                var      firstDay = date.AddDays(1 - date.Day);
                DateTime endDay   = firstDay;
                switch (vm.hidTab)
                {
                case "第1周":
                    endDay = firstDay.AddDays(6);
                    break;

                case "第2周":
                    firstDay = firstDay.AddDays(7);
                    endDay   = firstDay.AddDays(6);
                    break;

                case "第3周":
                    firstDay = firstDay.AddDays(14);
                    endDay   = firstDay.AddDays(6);
                    break;

                case "第4周":
                    firstDay = firstDay.AddDays(21);
                    endDay   = firstDay.AddDays(6);
                    break;
                }
                vm.StartDate = firstDay.ToString(FormatConstants.DateTimeFormatStringByDate);
                vm.EndDate   = endDay.ToString(FormatConstants.DateTimeFormatStringByDate);
            }
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(vm, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;
            var test   = "{\"data\":" + result + "}";

            return(Content(test, "application/json"));
        }
Пример #21
0
        public string ImportMovie(HttpPostedFileBase uploadName, DateTime Start_Time, DateTime End_Time, string Scope, int?RepeatTime)
        {
            string errorInfo = string.Empty;
            string name      = uploadName.FileName;
            string extName   = name.Split('.')[1].ToLower();

            if (extName != "mp4")
            {
                return("必须是mp4格式文件,请返回后重传!");
            }
            if (uploadName == null)
            {
                return("没有文件!");
            }

            var severURL = "~/Movie/" + Path.GetFileName(uploadName.FileName);//severURL
            var fileName = Path.Combine(Request.MapPath("~/Movie"), Path.GetFileName(uploadName.FileName));

            try
            {
                uploadName.SaveAs(fileName);
            }
            catch (Exception ex)
            {
                return("上传异常 ! " + "   " + ex);
            }

            //上传成功后将数据写入数据表
            var apiUrl = "Chart/AddNoticeAPI";
            var entity = new NoticeDTO();

            entity.Start_Time  = Start_Time;
            entity.End_Time    = End_Time;
            entity.Creator_UID = CurrentUser.AccountUId;
            entity.Creat_Time  = DateTime.Now;
            if (DateTime.Compare(entity.Creat_Time, entity.Start_Time) < 0)
            {
                entity.State = "未开始";
            }

            else if (DateTime.Compare(entity.Creat_Time, entity.Start_Time) >= 0 && DateTime.Compare(entity.Creat_Time, entity.End_Time) <= 0)
            {
                entity.State = "进行中";
            }
            else if (DateTime.Compare(entity.Creat_Time, entity.End_Time) > 0)
            {
                entity.State = "已过时";
            }
            entity.Color          = "视频";
            entity.Notice_Content = "../Movie/" + Path.GetFileName(uploadName.FileName) + "$" + fileName;
            entity.Scope          = Scope;

            entity.RepeatTime = RepeatTime;
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(entity, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return("上传成功");
        }
Пример #22
0
        public ActionResult SaveME_D_Equipment(SaveME_EquipmentVM vm)
        {
            vm.Account_UID = this.CurrentUser.AccountUId;
            var apiUrl = string.Format("ProductionResourcePlan/SaveME_D_EquipmentAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(vm, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #23
0
        /// <summary>
        /// 制程明细
        /// </summary>
        /// <param name="search"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult QueryDistributeRateReportProcessDetail(QAReportSearchVM search, Page page)
        {
            search.SearchType = 1;
            var apiUrl = string.Format("QAProductSaleReport/QueryDistributeRateReportDetail");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #24
0
        public ActionResult QueryMEs(RP_MESearch search, Page page)
        {
            search.Account_UID = this.CurrentUser.AccountUId;
            var apiUrl = string.Format("ProductionResourcePlan/QueryMEsAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #25
0
        public ActionResult QueryOQCMasterData(string jsonWithData)
        {
            var apiUrl = "OQCQuality/QueryOQCMasterDataAPI";
            var entity = JsonConvert.DeserializeObject <QAReportSearchVM>(jsonWithData);
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(entity, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #26
0
        private ExportOQCDataForExcel GetOQCInputDataForExportExcel(QAReportSearchVM search)
        {
            var apiUrl = string.Format("OQCQuality/DownloadOQCInputDataForExportExcelAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;
            var list   = JsonConvert.DeserializeObject <ExportOQCDataForExcel>(result);

            return(list);
        }
Пример #27
0
        public ActionResult GetDemissionInfoByID(ProcessIDTraConfigVM searchParm, Page page)
        {
            var apiUrl = string.Format("ProcessIDTRSConfig/GetProcessIDConfigDataAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(searchParm, page, apiUrl);
            //HttpResponseMessage responMessage = APIHelper.APIGetAsync(apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #28
0
        public ActionResult QueryMachine_Yields(Machine_YieldDTO search, Page page)
        {
            search.Plant_Organization_UID = GetPlantOrgUid();
            var apiUrl = string.Format("MachineYieldReport/QueryMachine_YieldsAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #29
0
        //获取所有同步失败的数据
        public ActionResult GetSyncFailedRecordData(Page page)
        {
            var apiUrl = string.Format("ProcessIDTRSConfig/QuerySyncFailedRecordAPI");
            MES_PIS_SyncFailedRecordDTO model         = new MES_PIS_SyncFailedRecordDTO();
            HttpResponseMessage         responMessage = APIHelper.APIPostAsync(model, page, apiUrl);
            //HttpResponseMessage responMessage = APIHelper.APIGetAsync(apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Пример #30
0
        public ActionResult YieldChartDatas(string jsonWithProduct)
        {
            var apiUrl = "ProductInput/YieldChartDatasAPI";
            var entity = JsonConvert.DeserializeObject <YieldChartSearch>(jsonWithProduct);


            HttpResponseMessage responMessage = APIHelper.APIPostAsync(entity, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }