heteng пре 3 година
родитељ
комит
e700ea953a

+ 6 - 6
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -545,7 +545,7 @@ namespace Business.ResourceExamineManagement
         /// <param name="tech_id">工艺路径主键</param>
         /// <param name="packages">需要生产产品件数</param>
         /// <returns>生产时长</returns>
-        public async Task<decimal> ProductiveExamine(long tech_id, int packages)
+        public async Task<decimal> ProductiveExamine(string bom_number, int packages)
         {
             if (packages <= 0)
             {
@@ -553,14 +553,14 @@ namespace Business.ResourceExamineManagement
             }
             #region 1、数据准备
             //1.1、获取工艺路径数据
-            mes_technique tech = await _mes_technique.GetOneByID(tech_id);
+            mes_technique tech = _mes_technique.Find(p=>p.bom == bom_number).Result.FirstOrDefault();
             if (tech == null)
             {
                 throw new NotImplementedException("请先配置工艺路径!");
             }
 
             //1.2、获取工艺路径关联工序数据
-            List<mes_tech_process> tech_Processes = await _mes_tech_process.GetManyByCondition(x => x.tech_id == tech_id);
+            List<mes_tech_process> tech_Processes = await _mes_tech_process.GetManyByCondition(x => x.tech_id == tech.Id);
             if (tech_Processes.Count == 0)
             {
                 throw new NotImplementedException("请先配置工序!");
@@ -582,7 +582,7 @@ namespace Business.ResourceExamineManagement
             //工序需要等待时间记录
             List<StartTimeDto> starts = new List<StartTimeDto>();
             //1、获取工艺路径下的第一层级工序
-            List<mes_tech_process> fistChilds = tech_Processes.Where(p => p.parentprocid == tech_id).ToList();
+            List<mes_tech_process> fistChilds = tech_Processes.Where(p => p.parentprocid == tech.Id).ToList();
             if (fistChilds.Count == 0)
             {
                 throw new NotImplementedException("当前工艺路径没有配置工序,请调整!");
@@ -610,7 +610,7 @@ namespace Business.ResourceExamineManagement
                 }
                 sumTimes += curTakeTime;
                 //添加耗时记录
-                dto.tech_id = tech_id;
+                dto.tech_id = tech.Id;
                 dto.proc_id = chd.proc_id;
                 dto.nextproc_id = chd.nextprocid;
                 dto.wait_time = curTakeTime;
@@ -700,7 +700,7 @@ namespace Business.ResourceExamineManagement
             //根绝系统配置参数 取最早或者最晚开始日期
             var StartDate = DateTime.Now.Date.AddDays(3);
             mes_Morder.moentry_sys_stime = StartDate;
-            var ProductiveDate = ProductiveExamine(ic_bom.tech_id, (int)(seorderentry.qty.Value));
+            var ProductiveDate = ProductiveExamine(ic_bom.bom_number, (int)(seorderentry.qty.Value));
             //系统建议完工日期为 开工日期+产能检查时间=完工日期
             var Day = ProductiveDate.Result / (60 * 10); //返回的分钟除以十个小时得出工作天数;
             mes_Morder.moentry_sys_etime = StartDate.AddDays((double)Day);