heteng 2 年 前
コミット
31858be195

+ 7 - 3
MicroServices/Business/Business.Application/ResourceExamineManagement/ProductionScheduleAppService.cs

@@ -218,7 +218,7 @@ namespace Business.ResourceExamineManagement
             //获取非标准产线人员配置
             prodLineDetailRunCrews = _prodLineDetailRunCrew.Select(x => prodLines.Select(p => p.RecID).Contains(x.ProdLineDetailRecID) && x.IsActive && x.Domain == domain).ToList();
             //获取加班设置
-            List<ResourceOccupancyTime> resourceOccupancyTimes = _resourceOccupancyTime.Select(x => prodLines.Select(p => p.Line).Contains(x.Resource) && x.IsActive && x.Domain == domain && x.StartTime.Value > DateTime.Now).ToList();
+            resourceOccupancyTimes = _resourceOccupancyTime.Select(x => prodLines.Select(p => p.Line).Contains(x.Resource) && x.IsActive && x.Domain == domain && x.StartTime.Value > DateTime.Now).ToList();
             //获取生产周期数据
             List<PeriodSequenceDet> dbPeriodSequences = _periodSequenceDet.Select(p => lines.Contains(p.Line) && p.PlanDate >= earlist && p.Domain == domain && p.IsActive);
             //获取当前日期往后的排产记录数据
@@ -374,7 +374,6 @@ namespace Business.ResourceExamineManagement
                         //判断当天的可用生产时长能满足提前期
                         if (dto.EffTime >= lineStart.setupTime - sumTimes)
                         {
-                            sumTimes = lineStart.setupTime;
                             //当天剩余产能
                             decimal sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (lineStart.setupTime - sumTimes));
                             //判断已排产数量+当天的产能是否超过工单数量
@@ -486,6 +485,7 @@ namespace Business.ResourceExamineManagement
                                     });
                                 }
                             }
+                            sumTimes = lineStart.setupTime;
                         }
                         else {
                             //当天的可用生产时长不能满足提前期
@@ -658,7 +658,7 @@ namespace Business.ResourceExamineManagement
             var curLevel = curRunCrews.FirstOrDefault(p => p.StartDate.GetValueOrDefault().Date <= startTime.Date && p.EndDate.GetValueOrDefault().Date >= startTime.Date);
             decimal rate = curLevel == null ? lineStart.Rate : curLevel.Rate;
             scheduledDto.Rate = rate;
-            //计算当天的产能
+            //计算当天的产能(向下取整)
             scheduledDto.ProductQty = Math.Floor(scheduledDto.EffTime * rate);
             //计算班次
             scheduledDto.Period = 1;//默认一般制
@@ -696,6 +696,7 @@ namespace Business.ResourceExamineManagement
             lineStart.StartTime = actStart;
             lineStart.setupTime = lines[0].SetupTime;
             lineStart.Rate = lines[0].Rate;
+            lineStart.Op = op;
             //循环其他产线
             for (int i = 1; i < lines.Count; i++)
             {
@@ -713,6 +714,7 @@ namespace Business.ResourceExamineManagement
                     lineStart.StartTime = StartTime;
                     lineStart.setupTime = lines[i].SetupTime;
                     lineStart.Rate = lines[i].Rate;
+                    lineStart.Op = op;
                 }
             }
             return lineStart;
@@ -877,6 +879,7 @@ namespace Business.ResourceExamineManagement
             startDto.setupTime = lines[0].SetupTime;
             startDto.StartTime = schedule == null ? startTime : (startTime < schedule.WorkEndTime ? schedule.WorkEndTime : startTime);
             startDto.Rate = lines[0].Rate;
+            startDto.Op = op;
             //循环剩余产线,找到最早可开工产线
             for (int i = 1; i < lines.Count(); i++)
             {
@@ -890,6 +893,7 @@ namespace Business.ResourceExamineManagement
                     startDto.setupTime = lines[i].SetupTime;
                     startDto.StartTime = startTime;
                     startDto.Rate = lines[0].Rate;
+                    startDto.Op = op;
                 }
             }
             return startDto;

+ 5 - 1
MicroServices/Business/Business.Domain/StructuredDB/Production/ProdLineDetailRunCrew.cs

@@ -1,5 +1,7 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -15,6 +17,8 @@ namespace Business.StructuredDB.Production
         /// <summary>
         /// 主键ID    
         /// </summary>
+        [Comment("主键")]
+        [Key]
         public int RecID { get; set; }
 
         /// <summary>

+ 5 - 1
MicroServices/Business/Business.Domain/StructuredDB/Production/ResourceOccupancyTime.cs

@@ -1,5 +1,7 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -15,6 +17,8 @@ namespace Business.StructuredDB.Production
         /// <summary>
         /// 主键ID    
         /// </summary>
+        [Comment("主键")]
+        [Key]
         public int RecID { get; set; }
 
         /// <summary>