From a3c63f891be17d0884198b9d92e82e23234ffe8e Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 23 五月 2024 09:30:14 +0800
Subject: [PATCH] 优化入库逻辑

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs       |   94 -----------------------------------------------
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs |   15 ++++---
 2 files changed, 8 insertions(+), 101 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
index 385af08..f88d6c8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
@@ -47,100 +47,6 @@
                 }
                 #endregion
 
-                #region MyRegion
-                //var tasks = agvtaskService.Find(x => x.agv_taskstate == "Queue").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
-                //foreach (var task in tasks)
-                //{
-                //    try
-                //    {
-                //        if (task.agv_tasktype == "TaskType_EmptyPallet")//绌烘墭浠诲姟
-                //        {
-                //            if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(2))
-                //            {
-                //                if (task.agv_tasknum.Contains("_"))
-                //                {
-                //                    string mainTaskNum = task.agv_tasknum.Split('_')[0];
-                //                    if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && task.agv_taskstate != "Executing" && task.agv_taskstate != "Create").Any() || !agvtaskService.Find(x => x.agv_tasknum == mainTaskNum).Any())
-                //                        GetStation.EmptyPalletStation(task);
-                //                }
-                //                else
-                //                    GetStation.EmptyPalletStation(task);
-
-                //                WriteDBLog.Success("鏇存柊绌烘墭闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
-                //                continue;
-                //            }
-                //        }
-                //        else if (task.agv_tasktype == "TaskType_OutsourceInbound" || task.agv_tasktype == "TaskType_Inbound")//澶栧崗搴撳叆搴�/AB搴撳叆搴�
-                //        {
-                //            if (task.agv_toaddress == "")
-                //            {
-                //                var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault();
-                //                var work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.drawingNo == stationinfo.stationType && x.heatID == stationinfo.heatNumber && x.processCode == "17").FirstOrDefault();
-                //                var TargetLocation = task.agv_tasktype == "TaskType_Inbound" ? GetLocation.GetEmptyLocation(stationinfoRepository, work, task) : StationTask.GetEmptyLocation(stationinfoRepository);
-                //                if (TargetLocation != null)
-                //                {
-                //                    if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
-                //                    task.agv_taskstate = "Create";
-                //                    task.agv_toaddress = TargetLocation.stationCode;
-                //                    TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
-                //                    TargetLocation.billetID = stationinfo.billetID;
-                //                    TargetLocation.stationType = task.agv_materielid;
-                //                    TargetLocation.heatNumber = stationinfo.heatNumber;
-                //                    TargetLocation.Number = task.jobID;
-                //                    stationinfoRepository.Update(TargetLocation, true);
-                //                    agvtaskService.Update(task, true);
-                //                    WriteDBLog.Success("鏇存柊鍏ュ簱闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
-                //                    continue;
-                //                }
-                //            }
-                //        }
-                //        else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//澶栧崗搴撳嚭搴�/AB搴撳嚭搴�
-                //        {
-                //            if (task.agv_toaddress == "")
-                //            {
-                //                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == "EmptyTray" || x.location_state == "Empty") && x.enable).ToList();
-                //                foreach (var EmptyStation in EmptyStations)
-                //                {
-                //                    if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
-                //                    task.agv_taskstate = "Create";
-                //                    task.agv_toaddress = EmptyStation.stationCode;
-                //                    EmptyStation.location_state = LocationStateEnum.Busy.ToString();
-                //                    stationinfoRepository.Update(EmptyStation, true);
-                //                    agvtaskService.Update(task, true);
-                //                    WriteDBLog.Success("鏇存柊鍑哄簱闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
-                //                    return;
-                //                }
-                //            }
-                //        }
-                //        else if (task.agv_tasktype == "TaskType_OutsourceCarry")//绉诲簱澶栧崗
-                //        {
-                //            if (task.agv_toaddress == "")
-                //            {
-                //                var TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
-                //                if (TargetLocation != null)
-                //                {
-                //                    if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
-
-                //                    task.agv_taskstate = "Create";
-                //                    task.agv_toaddress = TargetLocation.stationCode;
-                //                    TargetLocation.location_state = LocationStateEnum.OutBusy.ToString();
-                //                    TargetLocation.stationType = task.agv_materielid;
-                //                    stationinfoRepository.Update(TargetLocation, true);
-                //                    agvtaskService.Update(task, true);
-                //                    WriteDBLog.Success("鏇存柊绉诲簱澶栧崗闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
-                //                    continue;
-                //                }
-                //            }
-                //        }
-                //    }
-                //    catch (Exception ex)
-                //    {
-                //        //WriteDBLog.Error("鏇存柊闃熷垪浠诲姟", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
-                //        WriteLog.Write_Log("鏇存柊闃熷垪浠诲姟", "鏇存柊澶辫触", "", $"閿欒淇℃伅锛歿ex.Message}");
-                //    }
-                //}
-                #endregion
-
             }
             catch (Exception ex)
             {
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 9722c24..a917cb0 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"
@@ -121,13 +121,14 @@
                     #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.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
+                    }
                     #endregion
 
                     #region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�

--
Gitblit v1.9.3