| | |
| | | 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(); |
| | |
| | | |
| | | #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 |
| | | |
| | |
| | | //} |
| | | #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; |
| | | //} |
| | | #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 æ¥çå½å空货ä½åæ¯å¦å卿æ |
| | | if (TargetLocation != null) |
| | | if (GetStation.QueueStation(TargetLocation.stationCode)) TargetLocation = null; |
| | | //if (GetStation.QueueStation(TargetLocation.stationCode)) TargetLocation = null; |
| | | if (!GetStation.QueueStation(TargetLocation.stationCode)) return TargetLocation; |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | if (TargetLocation == null) throw new Exception("åºä½å·²æ»¡"); |
| | | #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.Number == agvtask.jobID).Any()) |
| | | if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any() && !GetStation.QueueStation(Location.stationCode)) return Location; |
| | | } |
| | | #endregion |
| | | |
| | | //if (TargetLocation == null) throw new Exception("åºä½å·²æ»¡"); |
| | | return TargetLocation; |
| | | } |
| | | catch (Exception ex) |