From af7de9f234a057fd67c22818783d4f5bd5bb5cfe Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 25 六月 2024 15:00:11 +0800
Subject: [PATCH] 太重PDA

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
index 7c0a658..3759cb7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
@@ -39,7 +39,8 @@
                     dt_stationinfo TargetLocation = null;
 
                     #region 瀵绘壘宸插垎閰嶅悓鍥惧彿鍏ュ簱浠诲姟搴撲綅
-                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3")).FirstOrDefault();
+                    //TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.enable && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3") && x.enable).FirstOrDefault();
+                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.Number == agvtask.jobID && x.location_state == LocationStateEnum.InBusy.ToString() && x.enable && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.Number == agvtask.jobID && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3") && x.enable).FirstOrDefault();
                     if (TargetLocation != null)
                     {
                         TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();
@@ -50,7 +51,9 @@
 
                     #region 鏌ユ壘搴撳瓨
                     dt_inventory inventory = null;
-                    inventory = area1 == "4" ? inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid && x.area == area1).OrderByDescending(x => x.OnlineTime).FirstOrDefault()
+                    //inventory = area1 == "4" ? inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid && x.area == area1).OrderByDescending(x => x.OnlineTime).FirstOrDefault()
+                    //  : inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid && (x.area == "2" || x.area == "3")).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
+                    inventory = area1 == "4" ? inventoryRepository.Find(x => x.workOrder == agvtask.jobID && x.area == area1).OrderByDescending(x => x.OnlineTime).FirstOrDefault()
                         : inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid && (x.area == "2" || x.area == "3")).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                     #endregion
 
@@ -121,22 +124,24 @@
                     #endregion
 
                     #region 瀵绘壘瀵瑰簲搴撳尯绌鸿揣浣�
-                    //var TargetLocations = area1 == "4" ? stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "4").OrderBy(x => x.line).ThenBy(x => x.column).ToList()
-                    //    : stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "2" || x.area == "3")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
-                    //foreach (var Location in TargetLocations)
-                    //{
-                    //    if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid).Any())
-                    //        if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
-                    //}
+
+                    var TargetLocations = area1 == "4" ? stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "4").OrderBy(x => x.line).ThenBy(x => x.column).ToList()
+                        : stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "2" || x.area == "3")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
+                    foreach (var Location in TargetLocations)
+                    {
+                        //if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid).Any())
+                        if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.Number == agvtask.jobID).Any())
+                            if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
+                    }
                     #endregion
 
                     #region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
                     var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype);
-                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                     if (TargetLocation == null && area != "4")
                     {
                         area = area == "2" ? "3" : "2";
-                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                     }
 
                     #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡

--
Gitblit v1.9.3