From 2e2b2a3efe2a5def011834daa43d71da9b3b5d00 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 03 四月 2024 10:55:57 +0800 Subject: [PATCH] 优化逻辑 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 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 6781e0e..9474e1d 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" @@ -66,7 +66,10 @@ var station = stationinfoRepository.FindFirst(x => x.stationCode == inventory.stationCode); if (station.area == "1") { - TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault(); + //TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault(); + + TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁 + if (TargetLocation != null) { if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) @@ -92,7 +95,10 @@ { if (TargetLocation.area == "1") { - TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault(); + //TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault(); + + 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();//鎸夎瀛樻斁 + if (TargetLocation != null) { if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) @@ -111,6 +117,25 @@ } #endregion + #region 瀵绘壘绌鸿揣浣� + var TargetLocations = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).OrderBy(x => x.line).ThenBy(x => x.column).ToList(); + foreach (var Location in TargetLocations) + { + if (Location.area == "1") + { + if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location; + } + else + { + if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location; + } + } + //if (TargetLocation != null) + //{ + // if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.column == 1 && x.stationType == stationinfo.stationType).Any()) return TargetLocation; + //} + #endregion + #region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛� //var area1 = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, e) : mesinfo.area; //var area = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, stationinfo.tray_type) : mesinfo.area; @@ -126,6 +151,22 @@ if (TargetLocation == null) TargetLocation = stationinfoRepository.Find(x => x.line == 2 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "1").OrderBy(x => x.column).FirstOrDefault(); } + + #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡 + if (TargetLocation != null) + { + if (TargetLocation.area == "1") + { + //绗竴琛屼笉涓虹┖璐т綅鍒欎笉鑳芥斁缃浜岃 + if (stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString() && x.line == 1).Any()) TargetLocation = null; + } + else + { + if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) TargetLocation = null; + } + } + #endregion + #endregion if (TargetLocation == null) throw new Exception("搴撲綅宸叉弧"); -- Gitblit v1.9.3