| | |
| | | VOLContext context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); |
| | | string completor = UserContext.Current.UserName; |
| | | foreach (var Key in saveModel.DelKeys) |
| | | { |
| | | try |
| | | { |
| | | var station = repository.Find(x => x.id.ToString() == Key.ToString()).FirstOrDefault(); |
| | | if (!station.stationCode.Contains("X")) throw new Exception($"æ {station.stationCode}ä½¿ç¨æéï¼"); |
| | | if (!station.stationCode.Contains("X") && !station.stationCode.Contains("W01001004") && !station.stationCode.Contains("W01001005")) throw new Exception($"æ {station.stationCode}ä½¿ç¨æéï¼"); |
| | | if (!station.enable) throw new Exception($"{station.stationCode}æªå¯ç¨ï¼"); |
| | | if (station.location_state == LocationStateEnum.Abnormal.ToString()) throw new Exception($"{station.stationCode}ç¶æå¼å¸¸ï¼"); |
| | | if (station.location_state == LocationStateEnum.Empty.ToString()) throw new Exception($"{station.stationCode}ç¶æä¸ºç©ºï¼"); |
| | | if (station.remark == "æ¡æ¶ä¸æ") throw new Exception($"{station.stationCode}æ¡æ¶æ£å¨ä¸æï¼"); |
| | | if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any()) throw new Exception($"{station.stationCode}åå¨ä»»å¡ï¼"); |
| | | |
| | | if (!agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode).Any()) |
| | | |
| | | var task = agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).FirstOrDefault(); |
| | | if (task != null) |
| | | { |
| | | if (task.agv_taskstate != AGVTaskStateEnum.Queue.ToString()) throw new Exception($"{station.stationCode}åå¨ä»»å¡ï¼"); |
| | | task.agv_Traytype = station.tray_type == TrayTypeEnum.SmallTray.ToString() ? TrayTypeEnum.LargeTray.ToString() : TrayTypeEnum.SmallTray.ToString(); |
| | | agvtaskRepository.Update(task, x => new { x.agv_Traytype }, true); |
| | | } |
| | | else if (!agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode).Any()) |
| | | { |
| | | #region 为空æå¹¶ä¸æ°é为0,å建å空æä»»å¡ |
| | | if (station.tray_status == TrayStateEnum.EmptyTray.ToString() && station.quantity == 0) |