heteng 2 лет назад
Родитель
Сommit
6c1bfb60aa

+ 1 - 1
MicroServices/Business/Business.Application.Contracts/Dto/LineScheduledDto.cs

@@ -22,7 +22,7 @@ namespace Business.Dto
         public DateTime EndTime { get; set; }
 
         /// <summary>
-        /// 有效生产时长(小时)
+        /// 有效生产时长(分钟)
         /// </summary>
         public decimal EffTime { get; set; }
 

+ 1 - 1
MicroServices/Business/Business.Application.Contracts/Dto/LineStartDto.cs

@@ -27,7 +27,7 @@ namespace Business.Dto
         public int Op { get; set; }
 
         /// <summary>
-        /// 产线准备时间
+        /// 产线准备时间(小时)
         /// </summary>
         public decimal setupTime { get; set; }
 

+ 22 - 22
MicroServices/Business/Business.Application/ResourceExamineManagement/ProductionScheduleAppService.cs

@@ -310,7 +310,7 @@ namespace Business.ResourceExamineManagement
                     QtyOrded = item.QtyOrded,
                     OrdDate = item.OrdDate.GetValueOrDefault(),
                     ProdLine = item.ProdLine,
-                    LbrVar = item.LbrVar,
+                    LbrVar = item.LbrVar * 60,
                     Worked = 0,
                     QtyWorked = 0,
                     Op = op
@@ -556,7 +556,7 @@ namespace Business.ResourceExamineManagement
                     }
                     List<LineWorkPointDto> workPoints = DealWorkDayToLevels(lineStart.Line, workStartTime, curCalendar, mlqtyWorkDtls);
                     //如果当天的可用产能大于特殊工单生产时长,此时需要考虑当天是否安排了其他的特殊工单
-                    if (dto.EffTime * 60 > sumTsTimes)
+                    if (dto.EffTime > sumTsTimes)
                     {
                         //获取特殊工单
                         secWOMasters = tsWorkOrds.Where(p => p.ProdLine == lineStart.Line && p.OrdDate.Value.Date == workStartTime.Date).OrderBy(p => p.OrdDate).ToList();
@@ -580,7 +580,7 @@ namespace Business.ResourceExamineManagement
                         //特殊工单待排产时长增加新增的特殊工单生产时长
                         sumTsTimes += secWOMasters.Sum(p => p.LbrVar) * 60;
                     }
-                    if (dto.EffTime * 60 >= sumTsTimes)//当天的可用产能满足特殊工单生产时长
+                    if (dto.EffTime >= sumTsTimes)//当天的可用产能满足特殊工单生产时长
                     {
                         DateTime beginTime = workStartTime;
                         DateTime endTime = dto.EndTime;
@@ -662,7 +662,7 @@ namespace Business.ResourceExamineManagement
                             item.Worked = item.LbrVar;
                             sumTsTimes -= needTime;
                         }
-                        if (dto.EffTime * 60 == sumTsTimes)//当天产能完全占用
+                        if (dto.EffTime == sumTsTimes)//当天产能完全占用
                         {
                             sumTsTimes = 0;//排产完毕,特殊工单时长置0
                             //获取下一个工作日
@@ -703,7 +703,7 @@ namespace Business.ResourceExamineManagement
                     }
                     else//当天的可用产能不满足特殊工单生产时长
                     {
-                        decimal residueTime = dto.EffTime * 60;//当天产能剩余产能(分钟)
+                        decimal residueTime = dto.EffTime;//当天产能剩余产能(分钟)
                         DateTime beginTime = workStartTime;//排产开始时间
                         DateTime endTime = dto.EndTime;//排产结束时间
                         foreach (var item in workDtos)
@@ -821,7 +821,7 @@ namespace Business.ResourceExamineManagement
                             }
                         }
                         //特殊工单剩余待排产时长(分钟)
-                        sumTsTimes -= dto.EffTime * 60;
+                        sumTsTimes -= dto.EffTime;
                         //获取下一个工作日
                         workStartTime = GetNextWorkDay((int)workStartTime.DayOfWeek, workStartTime, mLCalendars);
                     }
@@ -831,7 +831,7 @@ namespace Business.ResourceExamineManagement
                 //正常工单排产
                 //正常工单产线已排产数量
                 decimal sumQty = 0m;
-                //产线准备时间
+                //产线准备时间(分钟)
                 decimal sumTimes = 0m;
                 fstWOMasters.Clear();
                 workDtos.Clear();
@@ -866,18 +866,18 @@ namespace Business.ResourceExamineManagement
                         sumTsTimes += secWOMasters.Sum(p => p.LbrVar) * 60;
                     }
                     //排产开始时,需要先减去产线准备时间
-                    if (sumTimes < lineStart.setupTime)
+                    if (sumTimes < lineStart.setupTime * 60)
                     {
                         //当天的可用生产时长能满足提前期
-                        if (dto.EffTime > lineStart.setupTime - sumTimes)
+                        if (dto.EffTime > lineStart.setupTime * 60 - sumTimes)
                         {
                             //当天剩余时长(分钟)
-                            decimal residueTime = (dto.EffTime - lineStart.setupTime - sumTimes) * 60;
+                            decimal residueTime = dto.EffTime - lineStart.setupTime * 60 - sumTimes;
                             //产线提前期安排完之后,需要考虑当前是否存在特殊工单:
                             //1、如果当天是排产的最后一天,则先排完正常工单,再安排特殊工单;
                             //2、如果是排产中间日期,则先安排特殊工单排产
                             //当天剩余产能
-                            decimal sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (lineStart.setupTime - sumTimes));
+                            decimal sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (lineStart.setupTime - sumTimes / 60));
                             //判断已排产数量+当天的产能是否超过工单数量
                             if (sumQty + sumAmount <= workOrd.QtyOrded)//当天的产能需要全部排产
                             {
@@ -985,7 +985,7 @@ namespace Business.ResourceExamineManagement
                                         }
 
                                         //剩余产能继续排正常工单
-                                        sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (lineStart.setupTime - sumTimes - sumTsTimes / 60));
+                                        sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (lineStart.setupTime - sumTimes / 60 - sumTsTimes / 60));
                                         //记录生产周期
                                         curSequences.Add(new PeriodSequenceDet
                                         {
@@ -1471,7 +1471,7 @@ namespace Business.ResourceExamineManagement
                                 #endregion 特殊工单排产-结束
                             }
                             //记录提前期
-                            sumTimes = lineStart.setupTime;
+                            sumTimes = lineStart.setupTime * 60;
                         }
                         else//当天可用生产时长不能满足或者刚好满足提前期
                         {
@@ -1489,8 +1489,8 @@ namespace Business.ResourceExamineManagement
                         {
                             if (sumTsTimes > 0)//当天有特殊工单,先排特殊工单
                             {
-                                //当天剩余产能
-                                decimal residueTime = dto.EffTime * 60;
+                                //当天剩余产能(分钟)
+                                decimal residueTime = dto.EffTime;
                                 DateTime beginTime = workStartTime;//排产开始时间
                                 DateTime endTime = dto.EndTime;//排产结束时间
                                 //获取当天的工作时间段
@@ -1593,7 +1593,7 @@ namespace Business.ResourceExamineManagement
                                     }
 
                                     //剩余产能继续排正常工单
-                                    decimal sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (dto.EffTime - sumTsTimes / 60));
+                                    decimal sumAmount = dto.ProductQty - Math.Floor(dto.Rate * (dto.EffTime - sumTsTimes) / 60);
                                     //记录生产周期
                                     curSequences.Add(new PeriodSequenceDet
                                     {
@@ -1868,7 +1868,7 @@ namespace Business.ResourceExamineManagement
 
                             #region 特殊工单排产-开始
                             //当天剩余产能(分钟)
-                            decimal restTime = dto.EffTime * 60 - workTime;
+                            decimal restTime = dto.EffTime - workTime;
                             if (sumTsTimes > 0)//存在特殊工单
                             {
                                 DateTime beginTime = workEndTime;//排产开始时间
@@ -2100,7 +2100,7 @@ namespace Business.ResourceExamineManagement
         {
             foreach (var item in workOrds)
             {
-                //工单的生产时长(小时)
+                //工单的生产时长(分钟)
                 decimal sumTimes = item.LbrVar;
                 //工单的排产开始时间
                 DateTime workStartTime = item.OrdDate;
@@ -2167,7 +2167,7 @@ namespace Business.ResourceExamineManagement
                     else// 最后一天的产能只能占用一部分
                     {
                         //剩余生产时长(分钟)
-                        decimal workTime = sumTimes * 60;
+                        decimal workTime = sumTimes;
                         var curPoint = workPoints.Find(p => p.StartPoint <= workStartTime && workStartTime <= p.EndPoint);
                         TimeSpan span = curPoint.EndPoint - workStartTime;
                         //当前工作时间段的有效生产时间
@@ -2258,13 +2258,13 @@ namespace Business.ResourceExamineManagement
             //计算starttime处于那个工作时间段
             var curPoint = workPoints.Where(p => startTime >= p.StartPoint && startTime <= p.EndPoint).First();
             TimeSpan span = curPoint.EndPoint - startTime;
-            scheduledDto.EffTime = (decimal)span.TotalHours;
+            scheduledDto.EffTime = (decimal)span.TotalMinutes;
             //获取后续工作时间段的有效工作时间
             var nextPoints = workPoints.Where(p => p.Level > curPoint.Level).ToList();
             foreach (var item in nextPoints)
             {
                 span = item.EndPoint - item.StartPoint;
-                scheduledDto.EffTime += (decimal)span.TotalHours;
+                scheduledDto.EffTime += (decimal)span.TotalMinutes;
             }
             //判断当前产线的UPH
             var curRunCrews = prodLineDetailRunCrews.Where(p=>p.ProdLineDetailRecID == lineStart.RecID).ToList();
@@ -2273,7 +2273,7 @@ namespace Business.ResourceExamineManagement
             decimal rate = curLevel == null ? lineStart.Rate : curLevel.Rate;
             scheduledDto.Rate = rate;
             //计算当天的产能(向下取整)
-            scheduledDto.ProductQty = Math.Floor(scheduledDto.EffTime * rate);
+            scheduledDto.ProductQty = Math.Floor(scheduledDto.EffTime / 60 * rate);
             //计算班次
             scheduledDto.Period = 1;//默认一班制
             if (shopCal.ShiftsStart2 != 0 && shopCal.ShiftsHours2 != 0)