| | |
| | | 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 空æåºåºå ç¨å
¥ABåºåº |
| | | if (stationinfoRepository.Find(x => x.area == area && x.enable && x.location_state == LocationStateEnum.Busy.ToString()).Any() || 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 |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Busy.ToString() && (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(); |
| | | |
| | | #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) |
| | | #region æ¥æ¾ABåºå¯å
¥ç©ºæç©ºè´§ä½ |
| | | if (area == "11") |
| | | { |
| | | stationinfo = Station(EmptyStation, stationinfoRepository); |
| | | if (stationinfo != null) |
| | | if (!QueueStation(stationinfo.stationCode)) return stationinfo; |
| | | #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 |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Busy.ToString() && (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(); |
| | | |
| | | 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; |
| | | #region æ¥æ¾åºåº2ååºåº3ç空æè´§ä½ |
| | | |
| | | 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 æªæ¾å°ç©ºæè´§ä½æå½åè¡å·²æ»¡,å¯»æ¾æ°çä¸è¡ |
| | | 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 空æåºåºæ»¡åå
¥ABåºåº |
| | | |
| | | //#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 |
| | | // if (EmptyStation == null) |
| | | // EmptyStation = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Busy.ToString() && (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(); |
| | | |
| | | // #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.enable && 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 |
| | | |
| | | #endregion |
| | | |
| | | #region æ¥çå½å空货ä½åæ¯å¦å卿æ |
| | | if (stationinfo != null) |
| | | if (GetStation.QueueStation(stationinfo.stationCode)) stationinfo = null; |