diff --git a/DOAN.Service/MES/product/ProweekplanManageService.cs b/DOAN.Service/MES/product/ProweekplanManageService.cs index 20d7479..5240c55 100644 --- a/DOAN.Service/MES/product/ProweekplanManageService.cs +++ b/DOAN.Service/MES/product/ProweekplanManageService.cs @@ -111,15 +111,15 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan.Id = SnowFlakeSingle.Instance.NextId(); proWeeklyDatePlan.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan.PlanCode = proWeeklyPlan.PlanCode; - - DateTime? MondayDate = sheet.GetRow(2).GetCell(9)?.DateCellValue; + int weekdayindex = 9; + DateTime? MondayDate = sheet.GetRow(2).GetCell(weekdayindex)?.DateCellValue; proWeeklyDatePlan.WeekDate = (DateTime)MondayDate; proWeeklyPlan.PlanStartDate = (DateTime)MondayDate; proWeeklyPlan.PlanYear = MondayDate.Value.Year; year = MondayDate.Value.Year; // 星期一名称 - int weekdayindex = 9; + string MondayName = sheet.GetRow(3).GetCell(weekdayindex)?.ToString(); proWeeklyDatePlan.DayOfWeek = MondayName; //产品类型 @@ -144,9 +144,10 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan2.PlanCode = proWeeklyPlan.PlanCode; DateTime? TuesdayDate = sheet.GetRow(2).GetCell(weekdayindex + 4 * 1)?.DateCellValue; + proWeeklyDatePlan2.WeekDate = TuesdayDate; // 星期二名称 - string TuesdayName = sheet.GetRow(3).GetCell(9)?.ToString(); - proWeeklyDatePlan2.DayOfWeek = MondayName; + string TuesdayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 1)?.ToString(); + proWeeklyDatePlan2.DayOfWeek = TuesdayName; //产品类型 string Tuesdayproducttype = currentRow.GetCell(9).ToString(); @@ -154,7 +155,7 @@ namespace DOAN.Service.MES.product //计划数量 int TuesdayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan2.PlanNum = MondayPlanQty; + proWeeklyDatePlan2.PlanNum = TuesdayPlanQty; //是否变更 string TuesdayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan2.IsChange = MondayIsChange; @@ -170,16 +171,17 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan3.Id = SnowFlakeSingle.Instance.NextId(); proWeeklyDatePlan3.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan3.PlanCode = proWeeklyPlan.PlanCode; - DateTime? WednesdayDate = sheet.GetRow(2).GetCell(9)?.DateCellValue; + DateTime? WednesdayDate = sheet.GetRow(2).GetCell(weekdayindex + 4 * 2)?.DateCellValue; + proWeeklyDatePlan3.WeekDate = WednesdayDate; // 星期三名称 string WednesdayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 2)?.ToString(); - proWeeklyDatePlan3.DayOfWeek = MondayName; + proWeeklyDatePlan3.DayOfWeek = WednesdayName; //产品类型 string Wednesdayproducttype = currentRow.GetCell(9).ToString(); proWeeklyDatePlan3.ProductType = Mondayproducttype; //计划数量 int WednesdayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan3.PlanNum = MondayPlanQty; + proWeeklyDatePlan3.PlanNum = WednesdayPlanQty; //是否变更 string WednesdayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan3.IsChange = MondayIsChange; @@ -187,6 +189,9 @@ namespace DOAN.Service.MES.product int WednesdayActualQty = (int)currentRow.GetCell(12).NumericCellValue; proWeeklyDatePlan3.ActualQt = MondayActualQty; proWeeklyDatePlan3.CreatedTime = DateTime.Now; + + + // 2025/8/25 星期四 产品类型 // 2025/8/25 ProWeeklyDate proWeeklyDatePlan4 = new ProWeeklyDate(); @@ -194,15 +199,16 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan4.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan4.PlanCode = proWeeklyPlan.PlanCode; DateTime? ThursdayDate = sheet.GetRow(2).GetCell(weekdayindex + 4 * 3)?.DateCellValue; + proWeeklyDatePlan4.WeekDate = ThursdayDate; // 星期三名称 - string ThursdayName = sheet.GetRow(3).GetCell(9)?.ToString(); - proWeeklyDatePlan4.DayOfWeek = MondayName; + string ThursdayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 3)?.ToString(); + proWeeklyDatePlan4.DayOfWeek = ThursdayName; //产品类型 string Thursdayproducttype = currentRow.GetCell(9).ToString(); proWeeklyDatePlan4.ProductType = Mondayproducttype; //计划数量 int ThursdayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan4.PlanNum = MondayPlanQty; + proWeeklyDatePlan4.PlanNum = ThursdayPlanQty; //是否变更 string ThursdayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan4.IsChange = MondayIsChange; @@ -218,15 +224,16 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan5.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan5.PlanCode = proWeeklyPlan.PlanCode; DateTime? FridayDate = sheet.GetRow(2).GetCell(9)?.DateCellValue; + proWeeklyDatePlan5.WeekDate = FridayDate; // 星期三名称 string FridayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 4)?.ToString(); - proWeeklyDatePlan5.DayOfWeek = MondayName; + proWeeklyDatePlan5.DayOfWeek = FridayName; //产品类型 string Fridayproducttype = currentRow.GetCell(9).ToString(); proWeeklyDatePlan5.ProductType = Mondayproducttype; //计划数量 int FridayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan5.PlanNum = MondayPlanQty; + proWeeklyDatePlan5.PlanNum = FridayPlanQty; //是否变更 string FridayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan5.IsChange = MondayIsChange; @@ -242,15 +249,16 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan6.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan6.PlanCode = proWeeklyPlan.PlanCode; DateTime? SaturdayDate = sheet.GetRow(2).GetCell(9)?.DateCellValue; + proWeeklyDatePlan6.WeekDate = SaturdayDate; // 星期三名称 string SaturdayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 5)?.ToString(); - proWeeklyDatePlan6.DayOfWeek = MondayName; + proWeeklyDatePlan6.DayOfWeek = SaturdayName; //产品类型 string Saturdayproducttype = currentRow.GetCell(9).ToString(); proWeeklyDatePlan6.ProductType = Mondayproducttype; //计划数量 int SaturdayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan6.PlanNum = MondayPlanQty; + proWeeklyDatePlan6.PlanNum = SaturdayPlanQty; //是否变更 string SaturdayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan6.IsChange = MondayIsChange; @@ -265,15 +273,16 @@ namespace DOAN.Service.MES.product proWeeklyDatePlan7.FkWeeklyId = proWeeklyPlan.Id; proWeeklyDatePlan7.PlanCode = proWeeklyPlan.PlanCode; DateTime? SundayDate = sheet.GetRow(2).GetCell(9)?.DateCellValue; + proWeeklyDatePlan7.WeekDate = SundayDate; // 星期三名称 string SundayName = sheet.GetRow(3).GetCell(weekdayindex + 4 * 6)?.ToString(); - proWeeklyDatePlan7.DayOfWeek = MondayName; + proWeeklyDatePlan7.DayOfWeek = SundayName; //产品类型 string Sundayproducttype = currentRow.GetCell(9).ToString(); proWeeklyDatePlan7.ProductType = Mondayproducttype; //计划数量 int SundayPlanQty = (int)currentRow.GetCell(10).NumericCellValue; - proWeeklyDatePlan7.PlanNum = MondayPlanQty; + proWeeklyDatePlan7.PlanNum = SundayPlanQty; //是否变更 string SundayIsChange = currentRow.GetCell(11).ToString(); proWeeklyDatePlan7.IsChange = MondayIsChange; @@ -302,7 +311,7 @@ namespace DOAN.Service.MES.product //获取本周本年 所有日计划 Context .Deleteable() - .Where(it => it.PlanCode == + .Where(d => d.PlanCode == SqlFunc.Subqueryable() .Where(it => it.PlanYear == year && it.PlanWeek == week) .Select(it => it.PlanCode)).ExecuteCommand();