| | |
| | | public class GetStation |
| | | { |
| | | /// <summary> |
| | | /// å½ååºä½åä¸è¡æ¯å¦åå¨å
¥åºå ç¨ |
| | | /// trueï¼æ¯ falseï¼å¦ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool InBusyStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.InBusy.ToString()).Any(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// å½ååºä½åä¸è¡æ¯å¦åå¨åºåºå ç¨ |
| | | /// trueï¼æ¯ falseï¼å¦ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool OutBusyStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.OutBusy.ToString()).Any(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// å½ååºä½å¤è¾¹çè´§ä½æ¯å¦é½ä¸ºç©º |
| | | /// trueï¼å¦ falseï¼æ¯ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool QueueStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | 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) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// æ¾å¯å
¥åºç©ºæä½ |
| | | /// </summary> |
| | | public static void EmptyStation() |
| | |
| | | if (!Pipeline_client.IsConnected) throw new Exception("ä¸é¾æ¡æºè¿æ¥è¶
æ¶ï¼"); |
| | | var area = task.agv_Traytype == "SmallTray" ? "11" : "10"; |
| | | |
| | | #region ä¼å
åº3åºåºå
空æç |
| | | #region æ¥æ¾ABåºåºå¯åºåºç©ºæè´§ä½ |
| | | if (area == "11") |
| | | { |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.area).ThenBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault(); |
| | | |
| | | #region å¿
é¡»åºå®ABåºç©ºææè½åºç©ºæåº |
| | | //if (EmptyStation != null) |
| | | // if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) return; |
| | | #endregion |
| | | |
| | | #region ABåºç©ºæä½å ç¨åºç©ºæåº |
| | | if (EmptyStation != null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (EmptyStation != null)//空æè´§ä½ä¸ä¸ºç©ºå¤ææ¯å¦åå¨å
¶ä»ä»»å¡ |
| | | if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; |
| | | if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | #endregion |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¾ç©ºæåºåº |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | #endregion |
| | | |
| | | #region 空æè´§ä½ä¸ä¸ºç©ºå¤ææ¯å¦åå¨å
¶ä»ä»»å¡ |
| | | if (EmptyStation != null) |
| | | if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; |
| | | if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | #endregion |
| | | |
| | | #region æ´æ°è¡¥ç©ºæéåä»»å¡ |
| | | if (EmptyStation != null) |
| | | { |
| | | var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//读åæçä¿¡å·:1:æ,2æ |