From d7f620bfe0ed4e0d53f9b1b4307a1bab7300b6c7 Mon Sep 17 00:00:00 2001 From: 17630416519 Date: Mon, 15 Sep 2025 18:10:40 +0800 Subject: [PATCH] 1 --- .../MES/product/ProweekplanManageController.cs | 1 + DOAN.Model/MES/product/Dto/WeekplanQueryDto.cs | 2 +- DOAN.Model/MES/product/ProWeeklyPlan.cs | 4 ++-- .../MES/product/ProweekplanManageService.cs | 16 ++++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/DOAN.Admin.WebApi/Controllers/MES/product/ProweekplanManageController.cs b/DOAN.Admin.WebApi/Controllers/MES/product/ProweekplanManageController.cs index b16105e..3e2f5a1 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/product/ProweekplanManageController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/product/ProweekplanManageController.cs @@ -71,6 +71,7 @@ namespace DOAN.WebApi.Controllers.MES.product //TODO 导出excel指定日计划 [HttpGet("ExportWeekDatePlan")] + [AllowAnonymous] public IActionResult ExportWeekDatePlan(int year, int week, string dayofweek) { try diff --git a/DOAN.Model/MES/product/Dto/WeekplanQueryDto.cs b/DOAN.Model/MES/product/Dto/WeekplanQueryDto.cs index 533b34d..3e88910 100644 --- a/DOAN.Model/MES/product/Dto/WeekplanQueryDto.cs +++ b/DOAN.Model/MES/product/Dto/WeekplanQueryDto.cs @@ -141,7 +141,7 @@ namespace DOAN.Model.MES.product.Dto /// /// 计划状态(0:未开始;1:执行中;2:已完成;3:暂停;4:取消) /// - public byte PlanStatus { get; set; } = 0; + public string PlanStatus { get; set; } /// /// 车间计划员(工号,如EMP00123) diff --git a/DOAN.Model/MES/product/ProWeeklyPlan.cs b/DOAN.Model/MES/product/ProWeeklyPlan.cs index 3dbcc6f..73b2f2e 100644 --- a/DOAN.Model/MES/product/ProWeeklyPlan.cs +++ b/DOAN.Model/MES/product/ProWeeklyPlan.cs @@ -165,9 +165,9 @@ namespace DOAN.Model.MES.product /// /// 计划状态(0:未开始;1:执行中;2:已完成;3:暂停;4:取消) /// - [SugarColumn(ColumnDataType = "tinyint", IsNullable = false, ColumnDescription = "计划状态(0:未开始;1:执行中;2:已完成;3:暂停;4:取消)", ColumnName = "plan_status")] + [SugarColumn(ColumnDataType = "varchar(64)", IsNullable = false, ColumnDescription = "计划状态define", ColumnName = "plan_status")] [Required(ErrorMessage = "计划状态不能为空")] - public byte PlanStatus { get; set; } = 0; + public string PlanStatus { get; set; } = string.Empty; /// /// 车间计划员(工号,如EMP00123) diff --git a/DOAN.Service/MES/product/ProweekplanManageService.cs b/DOAN.Service/MES/product/ProweekplanManageService.cs index e76db23..550ff89 100644 --- a/DOAN.Service/MES/product/ProweekplanManageService.cs +++ b/DOAN.Service/MES/product/ProweekplanManageService.cs @@ -51,7 +51,7 @@ namespace DOAN.Service.MES.product IWorkbook workbook = new XSSFWorkbook(stream); - ISheet sheet = workbook.GetSheetAt(0); + ISheet sheet = workbook.GetSheet("Sheet1"); // 处理第2行 获取日期 IRow secondRow = sheet.GetRow(1); @@ -90,10 +90,14 @@ namespace DOAN.Service.MES.product //产品零件号 string _Specification = currentRow.GetCell(4)?.ToString(); proWeeklyPlan.Specification = _Specification; + if (string.IsNullOrEmpty(_ProductCode) && string.IsNullOrEmpty(_ProductName) && string.IsNullOrEmpty(_Specification)) + { + continue; + } //生产状态 string _PlanStatus = currentRow.GetCell(5)?.ToString(); if (!string.IsNullOrEmpty(_PlanStatus)) - proWeeklyPlan.PlanStatus = byte.Parse(_PlanStatus); + proWeeklyPlan.PlanStatus = _PlanStatus; //车间计划员 string planner = currentRow.GetCell(6)?.ToString(); @@ -115,9 +119,9 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan.PlanCode = proWeeklyPlan.PlanCode; int weekdayindex = 9; - DateTime? MondayDate = sheet.GetRow(2).GetCell(weekdayindex)?.DateCellValue; - proWeeklyDatePlan.WeekDate = (DateTime)MondayDate; - proWeeklyPlan.PlanStartDate = (DateTime)MondayDate; + DateTime? MondayDate = sheet.GetRow(2).GetCell(weekdayindex)?.DateCellValue; + proWeeklyDatePlan.WeekDate = MondayDate??DateTime.MinValue; + proWeeklyPlan.PlanStartDate = MondayDate ?? DateTime.MinValue; proWeeklyPlan.PlanYear = MondayDate.Value.Year; year = MondayDate.Value.Year; @@ -373,7 +377,7 @@ namespace DOAN.Service.MES.product string planStatus = row.GetCell(5)?.ToString(); if (!string.IsNullOrEmpty(planStatus)) { - proWeeklyPlan.PlanStatus = byte.Parse(planStatus); + proWeeklyPlan.PlanStatus = planStatus; } //车间计划员