Exemplo n.º 1
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"));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetProcessIDConfigDataAPI(dynamic data)
        {
            var jsonData = data.ToString();
            ProcessIDTransformConfigDTO searchModel = JsonConvert.DeserializeObject <ProcessIDTransformConfigDTO>(jsonData);
            var page   = JsonConvert.DeserializeObject <Page>(jsonData);
            var result = ProcessIDTRSConfigService.GetProcessIDConfigData(searchModel, page);

            return(Ok(result));
        }
Exemplo n.º 3
0
        //导出全部设备信息
        public ActionResult ExportAllProcessData(ProcessIDTransformConfigDTO search)
        {
            var apiUrl = string.Format("ProcessIDTRSConfig/ExportAllProcessInfoAPI");
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, apiUrl);
            var result      = responMessage.Content.ReadAsStringAsync().Result;
            var list        = JsonConvert.DeserializeObject <List <ProcessIDTransformConfigDTO> >(result).ToList();
            var stream      = new MemoryStream();
            var fileName    = PathHelper.SetGridExportExcelName("ProcessInfoReport");
            var stringHeads = GetProcessConfigHead();

            using (var excelPackage = new ExcelPackage(stream))
            {
                var worksheet = excelPackage.Workbook.Worksheets.Add("ProcessInfoReport");
                for (int colIndex = 0; colIndex < stringHeads.Length; colIndex++)
                {
                    worksheet.Cells[1, colIndex + 1].Value = stringHeads[colIndex];
                }

                for (int index = 0; index < list.Count; index++)
                {
                    var currentRecord = list[index];
                    worksheet.Cells[index + 2, 1].Value  = index + 1;                     //序号
                    worksheet.Cells[index + 2, 2].Value  = currentRecord.Binding_Seq;     //功能厂
                    worksheet.Cells[index + 2, 3].Value  = currentRecord.PIS_ProcessID;   //专案
                    worksheet.Cells[index + 2, 4].Value  = currentRecord.PIS_ProcessName; //OP类型
                    worksheet.Cells[index + 2, 5].Value  = currentRecord.MES_NgID;        //制程
                    worksheet.Cells[index + 2, 6].Value  = currentRecord.MES_PickingID;
                    worksheet.Cells[index + 2, 7].Value  = currentRecord.MES_GoodProductID;
                    worksheet.Cells[index + 2, 8].Value  = currentRecord.MES_ReworkID;
                    worksheet.Cells[index + 2, 9].Value  = currentRecord.Color;
                    worksheet.Cells[index + 2, 10].Value = currentRecord.IsEnabled == true ? "是" : "否";
                    worksheet.Cells[index + 2, 11].Value = currentRecord.IsSyncNG == true ? "是" : "否";
                    worksheet.Cells[index + 2, 12].Value = currentRecord.Modified_UID;
                    worksheet.Cells[index + 2, 13].Value = currentRecord.Modified_Date.ToString("yyyy-MM-dd HH:mm");
                    worksheet.Cells[index + 2, 14].Value = currentRecord.ReMark;
                }
                worksheet.Cells.AutoFitColumns();
                excelPackage.Save();
            }

            return(new FileContentResult(stream.ToArray(), "application/octet-stream")
            {
                FileDownloadName = Server.UrlEncode(fileName)
            });
        }
Exemplo n.º 4
0
        public string AddOrEditProcessInfo(ProcessIDTransformConfigDTO editModel)
        {
            if (editModel.ProcessTransformConfig_UID == 0)
            {
                return("没有找到该条数据,无法更新");
            }

            var updateSql = $" UPDATE ProcessIDTransformConfig SET PIS_ProcessName = N'{editModel.PIS_ProcessName}', MES_NgID = N'{editModel.MES_NgID}', MES_PickingID = N'{editModel.MES_PickingID}', MES_GoodProductID = N'{editModel.MES_GoodProductID}', MES_ReworkID = N'{editModel.MES_ReworkID}',Modified_UID ={ editModel.Modified_UID},Modified_Date ='{ editModel.Modified_Date}',ReMark = N'{editModel.ReMark}',Color = N'{editModel.Color}',IsEnabled = N'{editModel.IsEnabled}',IsSyncNG = N'{editModel.IsSyncNG}' WHERE ProcessTransformConfig_UID = { editModel.ProcessTransformConfig_UID}";
            var result    = DataContext.Database.ExecuteSqlCommand(updateSql.ToString());

            if (result > 0)
            {
                return("SUCCESS");
            }
            else
            {
                return("更新失败");
            }
        }
Exemplo n.º 5
0
        public PagedListModel <ProcessIDTransformConfigDTO> GetProcessIDConfigData(ProcessIDTransformConfigDTO serchModel, Page page)
        {
            var result = ProcessIDTRSConfigRepository.GetAll();
            List <ProcessIDTransformConfigDTO> dtoList = AutoMapper.Mapper.Map <List <ProcessIDTransformConfigDTO> >(result);

            if (serchModel.Binding_Seq != 0)
            {
                dtoList = dtoList.Where(p => p.Binding_Seq == serchModel.Binding_Seq).ToList();
            }

            if (serchModel.PIS_ProcessID != 0)
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessID == serchModel.PIS_ProcessID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.PIS_ProcessName))
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessName == serchModel.PIS_ProcessName).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_NgID))
            {
                dtoList = dtoList.Where(p => p.MES_NgID == serchModel.MES_NgID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_PickingID))
            {
                dtoList = dtoList.Where(p => p.MES_PickingID == serchModel.MES_PickingID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_GoodProductID))
            {
                dtoList = dtoList.Where(p => p.MES_GoodProductID == serchModel.MES_GoodProductID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_ReworkID))
            {
                dtoList = dtoList.Where(p => p.MES_ReworkID == serchModel.MES_ReworkID).ToList();
            }
            if (!string.IsNullOrEmpty(serchModel.Color))
            {
                dtoList = dtoList.Where(p => p.Color == serchModel.Color).ToList();
            }

            if (serchModel.Modified_UID != 0)
            {
                dtoList = dtoList.Where(p => p.Modified_UID == serchModel.Modified_UID).ToList();
            }

            if (serchModel.VM_IsEnabled != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsEnabled))
            {
                serchModel.IsEnabled = serchModel.VM_IsEnabled == "1" ? true : false;
                dtoList = dtoList.Where(p => p.IsEnabled == serchModel.IsEnabled).ToList();
            }

            if (serchModel.VM_IsSyncNG != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsSyncNG))
            {
                serchModel.IsSyncNG = serchModel.VM_IsSyncNG == "1" ? true : false;
                dtoList             = dtoList.Where(p => p.IsSyncNG == serchModel.IsSyncNG).ToList();
            }

            var totalCount = dtoList.Count();
            var resultList = dtoList.Skip(page.PageSize * page.PageNumber).Take(page.PageSize).ToList();

            return(new PagedListModel <ProcessIDTransformConfigDTO>(totalCount, resultList));
        }
Exemplo n.º 6
0
        public string AddOrEditProcessInfo(ProcessIDTransformConfigDTO editModel)
        {
            var result = ProcessIDTRSConfigRepository.AddOrEditProcessInfo(editModel);

            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 导出全部的配置信息
        /// </summary>
        /// <param name="serchModel"></param>
        /// <returns></returns>
        public List <ProcessIDTransformConfigDTO> ExportAllProcessInfo(ProcessIDTransformConfigDTO serchModel)
        {
            var result = ProcessIDTRSConfigRepository.GetAll();
            List <ProcessIDTransformConfigDTO> dtoList = AutoMapper.Mapper.Map <List <ProcessIDTransformConfigDTO> >(result);

            if (serchModel.Binding_Seq != 0)
            {
                dtoList = dtoList.Where(p => p.Binding_Seq == serchModel.Binding_Seq).ToList();
            }

            if (serchModel.PIS_ProcessID != 0)
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessID == serchModel.PIS_ProcessID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.PIS_ProcessName))
            {
                dtoList = dtoList.Where(p => p.PIS_ProcessName == serchModel.PIS_ProcessName).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_NgID))
            {
                dtoList = dtoList.Where(p => p.MES_NgID == serchModel.MES_NgID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_PickingID))
            {
                dtoList = dtoList.Where(p => p.MES_PickingID == serchModel.MES_PickingID).ToList();
            }

            if (!string.IsNullOrEmpty(serchModel.MES_GoodProductID))
            {
                dtoList = dtoList.Where(p => p.MES_GoodProductID == serchModel.MES_GoodProductID).ToList();
            }


            if (!string.IsNullOrEmpty(serchModel.MES_ReworkID))
            {
                dtoList = dtoList.Where(p => p.MES_ReworkID == serchModel.MES_ReworkID).ToList();
            }
            if (!string.IsNullOrEmpty(serchModel.Color))
            {
                dtoList = dtoList.Where(p => p.Color == serchModel.Color).ToList();
            }

            if (serchModel.Modified_UID != 0)
            {
                dtoList = dtoList.Where(p => p.Modified_UID == serchModel.Modified_UID).ToList();
            }

            if (serchModel.VM_IsEnabled != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsEnabled))
            {
                serchModel.IsEnabled = serchModel.VM_IsEnabled == "1" ? true : false;
                dtoList = dtoList.Where(p => p.IsEnabled == serchModel.IsEnabled).ToList();
            }

            if (serchModel.VM_IsSyncNG != "全部" && !string.IsNullOrEmpty(serchModel.VM_IsSyncNG))
            {
                serchModel.IsSyncNG = serchModel.VM_IsSyncNG == "1" ? true : false;
                dtoList             = dtoList.Where(p => p.IsSyncNG == serchModel.IsSyncNG).ToList();
            }

            return(dtoList.OrderBy(p => p.Binding_Seq).ToList());
        }