From bb929bd0809eefc1108dd779846ff07d997f7ef0 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期五, 19 七月 2024 09:25:14 +0800
Subject: [PATCH] 反馈MES工单完成

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/AutoUpdateWork.cs |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/AutoUpdateWork.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/AutoUpdateWork.cs"
index 73ba95a..9854254 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/AutoUpdateWork.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/AutoUpdateWork.cs"
@@ -8,6 +8,7 @@
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
 using WIDESEA_WCS.IServices;
+using WIDESEA_WCS.Jobs.Task;
 using WIDESEA_WCS.Repositories;
 using WIDESEA_WCS.Services;
 using WIDESEA_WMS.IRepositories;
@@ -63,7 +64,7 @@
             Idt_management_timeRepository timeRepository = new dt_management_timeRepository(context);
 
             var val = timeRepository.Find(x => x.management_name == "FinishMesWork").FirstOrDefault().management_numericalvalue;
-            var mes_heads = mes_HeadRepository.Find(x => x.quantity == x.finishNum || x.CreateTime.AddDays(val) < DateTime.Now).ToList();
+            var mes_heads = mes_HeadRepository.Find(x => x.quantity == x.finishNum || x.CreateTime.AddDays(val) < DateTime.Now).Take(10).ToList();
 
             #region 妫�娴嬬嚎宸ュ崟
             var mes_head_jcxs = mes_heads.Where(x => x.processCode == "28").ToList();
@@ -71,7 +72,24 @@
             {
                 foreach (var mes_head in mes_head_jcxs)
                 {
-                    AddHtyMesWork(mes_head, mes_HeadRepository);
+                    if (mes_head.quantity == mes_head.agv_finishNum)
+                    {
+                        if (mes_head.creator == "MES")
+                        {
+                            var uploadResult = HandleTask_Mes.UploadMESInfo(mes_head.jobID);
+                            if (uploadResult.Status)
+                            {
+                                AddHtyMesWork(mes_head, mes_HeadRepository);
+                            }
+                        }
+                        else
+                        {
+                            AddHtyMesWork(mes_head, mes_HeadRepository);
+                        }
+                        
+                    }
+                        
+                    
                 }
             }
             #endregion
@@ -82,9 +100,23 @@
             {
                 foreach (var mes_head in mes_head_jjgs)
                 {
-                    var inventorys = inventoryRepository.Find(x => x.jobID == mes_head.jobID).ToList();
-                    if (inventorys.Count == mes_head.quantity)
-                        AddHtyMesWork(mes_head, mes_HeadRepository);
+                    if (mes_head.quantity == mes_head.agv_finishNum)
+                    {
+                        if (mes_head.creator == "MES")
+                        {
+                            var uploadResult = HandleTask_Mes.UploadMESInfo(mes_head.jobID);
+                            if (uploadResult.Status)
+                            {
+                                AddHtyMesWork(mes_head, mes_HeadRepository);
+                            }
+                        }
+                        else
+                        {
+                            AddHtyMesWork(mes_head, mes_HeadRepository);
+                        }
+                        
+                    }
+                       
                 }
             }
             #endregion

--
Gitblit v1.9.3