heteng 3 лет назад
Родитель
Сommit
e5190c904f

+ 0 - 24
MicroServices/Business/Business.Application.Contracts/Dto/InventoryDto.cs

@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Business.Business.Dto
-{
-    /// <summary>
-    /// 库存占用Dto
-    /// </summary>
-    public class InventoryDto
-    {
-        /// <summary>
-        /// 物料编码
-        /// </summary>
-        public string ItemNum { get; set; }
-
-        /// <summary>
-        /// 占用数量
-        /// </summary>
-        public decimal OccupyQty { get; set; }
-    }
-}

+ 34 - 0
MicroServices/Business/Business.Application.Contracts/Dto/WorkOrdRoutingDto.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Business.Business.Dto
+{
+    /// <summary>
+    /// 工单工艺路线预处理Dto
+    /// </summary>
+    public class WorkOrdRoutingDto
+    {
+        /// <summary>
+        /// 工序
+        /// </summary>
+        public int Op { get; set; }
+
+        /// <summary>
+        /// 父级工序
+        /// </summary>
+        public int ParentOp { get; set; }
+
+        /// <summary>
+        /// 层级
+        /// </summary>
+        public int level { get; set; }
+
+        /// <summary>
+        /// 标准节拍(小时/个)
+        /// </summary>
+        public decimal RunTime { get; set; }
+    }
+}

+ 59 - 0
MicroServices/Business/Business.Application/Quartz/ProductionScheduleAppService.cs

@@ -109,6 +109,9 @@ namespace Business.Quartz
             //获取当前日期往后的排产记录数据
             List<ScheduleResultOpMaster> schedules = _scheduleResultOpMaster.GetListAsync(p=>workOrds.Select(m=>m.ItemNum).Contains(p.ItemNum) && p.Domain == "1001").Result;
 
+            //3、工序预处理
+            List<WorkOrdRoutingDto> routingDtos = ProcPretreatment(workOrdRoutings);
+
             //3、排产
             //排产结果(记录所有工序的排产情况)
             List<ScheduleResultOpMaster> scheduleResults = new List<ScheduleResultOpMaster>();
@@ -121,5 +124,61 @@ namespace Business.Quartz
         
         }
 
+        /// <summary>
+        /// 工单工艺路线预处理
+        /// </summary>
+        /// <param name="WoRuntings"></param>
+        /// <returns></returns>
+        public List<WorkOrdRoutingDto> ProcPretreatment(List<WorkOrdRouting> woRuntings)
+        {
+            List<WorkOrdRoutingDto> routingDtos = new List<WorkOrdRoutingDto>();
+            //取主工序(第一层级工序)
+            var firsts = woRuntings.Where(p=>p.ParentOp == 0).ToList();
+            if (firsts.Count == 0)
+            {
+                return routingDtos;
+            }
+            WorkOrdRoutingDto dto;
+            foreach (var item in firsts)
+            {
+                dto = new WorkOrdRoutingDto();
+                dto.Op = item.OP;
+                dto.ParentOp= item.ParentOp;
+                dto.level = 1;
+                dto.RunTime = item.RunTime;
+                routingDtos.Add(dto);
+            }
+            //递归处理其他层级工序
+            RecursionProc(woRuntings, firsts, 1, routingDtos);
+
+            return routingDtos;
+        }
+
+        /// <summary>
+        /// 递归处理工序
+        /// </summary>
+        /// <param name="woRuntings">工单工序</param>
+        /// <param name="curLevels">上-层级工序</param>
+        /// <param name="level">层级</param>
+        /// <param name="routingDtos">返回结果</param>
+        public void RecursionProc(List<WorkOrdRouting> woRuntings, List<WorkOrdRouting> preLevels, int level, List<WorkOrdRoutingDto> routingDtos)
+        {
+            //获取当前层级工序
+            var curLevels = woRuntings.Where(p => preLevels.Select(m=>m.OP).Contains(p.ParentOp)).ToList();
+            if (curLevels.Count() == 0)
+            {
+                return;
+            }
+            foreach (var item in curLevels)
+            {
+                var dto = new WorkOrdRoutingDto();
+                dto.Op = item.OP;
+                dto.ParentOp = item.ParentOp;
+                dto.level = level + 1;
+                dto.RunTime = item.RunTime;
+                routingDtos.Add(dto);
+            }
+            RecursionProc(woRuntings, curLevels, level + 1, routingDtos);
+        }
     }
 }

+ 0 - 6
MicroServices/Business/Bussiness.Model/Production/WorkOrdMaster.cs

@@ -44,12 +44,6 @@ namespace Bussiness.Model.Production
         [Comment("工单")]
         public string? WorkOrd { get; set; }
 
-        /// <summary>
-        /// 订单日期
-        /// </summary>
-        [Comment("订单日期")]
-        public DateTime? OrdDate { get; set; }
-
         /// <summary>
         /// 物料编号
         /// </summary>

+ 8 - 2
MicroServices/Business/Bussiness.Model/Production/WorkOrdRouting.cs

@@ -54,13 +54,19 @@ namespace Bussiness.Model.Production
         /// 工序
         /// </summary>
         [Comment("工序")]
-        public int? OP { get; set; }
+        public int OP { get; set; }
 
         /// <summary>
         /// 父级工序
         /// </summary>
         [Comment("父级工序")]
-        public int? ParentOp { get; set; }
+        public int ParentOp { get; set; }
+
+        /// <summary>
+        /// 运行时间(标准节拍)
+        /// </summary>
+        [Comment("运行时间")]
+        public decimal RunTime { get; set; }
 
         /// <summary>
         /// 物料编号