| | |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | if (station.area == "10" || station.area == "11") |
| | | { |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any(); |
| | | } |
| | | else |
| | | { |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¾å½åè¡å¯å
¥åºç©ºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="EmptyStation"></param> |
| | | /// <param name="stationinfoRepository"></param> |
| | | /// <returns></returns> |
| | | public static dt_stationinfo Station(dt_stationinfo EmptyStation, Idt_stationinfoRepository stationinfoRepository) |
| | | { |
| | | dt_stationinfo stationinfo = null; |
| | |
| | | |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (stationinfo != null) |
| | | { |
| | | if (stationinfo.quantity < 5) return stationinfo; |
| | | else |
| | | |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | } |
| | | //if (stationinfo == null) |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return stationinfo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æå¯å
¥åºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="area"></param> |
| | | /// <returns></returns> |
| | | public static dt_stationinfo EmptyPalletStation1(string area) |
| | | { |
| | | dt_stationinfo stationinfo = null; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | |
| | | #region æ¥æ¾ABåºå¯å
¥ç©ºæç©ºè´§ä½ |
| | | if (area == "11" && stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | #region MyRegion |
| | | var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.area).ThenByDescending(x => x.line).ThenByDescending(x => x.column).FirstOrDefault(); |
| | | #endregion |
| | | |
| | | #region æ¥æ¾åºåº2ååºåº3ç空æè´§ä½ |
| | | //var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") |
| | | // && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault(); |
| | | |
| | | if (EmptyStation != null) |
| | | { |
| | | stationinfo = Station(EmptyStation, stationinfoRepository); |
| | | if (stationinfo != null) |
| | | if (!QueueStation(stationinfo.stationCode)) return stationinfo; |
| | | |
| | | EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (EmptyStation.quantity != 5) return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æªæ¾å°ç©ºæè´§ä½æå½åè¡å·²æ»¡,å¯»æ¾æ°çä¸è¡ |
| | | stationinfo = stationinfoRepository.Find(x => x.column == 2 && x.area == "3" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault(); |
| | | if (stationinfo == null) |
| | | stationinfo = stationinfoRepository.Find(x => x.column == 1 && x.area == "2" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault(); |
| | | #endregion |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¾ç©ºæåºåº |
| | | else |
| | | { |
| | | if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo; |
| | | stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | if (stationinfo != null) |
| | | if (!QueueStation(stationinfo.stationCode) && stationinfo.quantity < 5) return stationinfo; |
| | | stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥çå½å空货ä½åæ¯å¦å卿æ |
| | | if (stationinfo != null) |
| | | if (GetStation.QueueStation(stationinfo.stationCode)) stationinfo = null; |
| | | #endregion |
| | | |
| | | #region 夿å½åè´§ä½æ¯å¦åå¨ä»»å¡ |
| | | if (stationinfo != null) |
| | | if (agvtaskService.Find(x => x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null; |
| | | #endregion |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | } |
| | | return stationinfo; |
| | | } |
| | |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | |
| | | #region æ¥æ¾ç©ºæçåºåº |
| | | //if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any() && area != "10") |
| | | if (stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault(); |