| | |
| | | using WIDESEA_WMS.IServices; |
| | | using WIDESEA_WMS.Repositories; |
| | | using static FreeSql.Internal.GlobalFilter; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | |
| | | namespace WIDESEA_WCS.JobsPart.Common |
| | | { |
| | |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context); |
| | | Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | var tasks = agvtaskService.Find(x => x.agv_taskstate == "Queue").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList(); |
| | | foreach (var task in tasks) |
| | | { |
| | | if (task.agv_tasktype == "TaskType_EmptyPallet")//空æä»»å¡ |
| | | { |
| | | if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(1)) |
| | | if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(2)) |
| | | { |
| | | if (task.agv_tasknum.Contains("_")) |
| | | { |
| | | string mainTaskNum = task.agv_tasknum.Split('_')[0]; |
| | | if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && (task.agv_taskstate == "Executing1" || task.agv_taskstate == "Complete1")).Any()) |
| | | if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && task.agv_taskstate != "Executing" && task.agv_taskstate != "Create").Any() || !agvtaskService.Find(x => x.agv_tasknum == mainTaskNum).Any()) |
| | | GetStation.EmptyPalletStation(task); |
| | | } |
| | | else |
| | |
| | | #endregion |
| | | } |
| | | } |
| | | else if (task.agv_tasktype == "TaskType_OutsourceInbound")//䏿å»å¤åå£ |
| | | else if (task.agv_tasktype == "TaskType_OutsourceInbound" || task.agv_tasktype == "TaskType_Inbound")//å¤ååºå
¥åº/ABåºå
¥åº |
| | | { |
| | | if (task.agv_toaddress == "") |
| | | { |
| | | var TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository); |
| | | var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault(); |
| | | var work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.drawingNo == stationinfo.stationType && x.heatID == stationinfo.heatNumber && x.processCode == "17").FirstOrDefault(); |
| | | var TargetLocation = task.agv_tasktype == "TaskType_Inbound" ? GetLocation.GetEmptyLocation(stationinfoRepository, work, stationinfo) : StationTask.GetEmptyLocation(stationinfoRepository); |
| | | if (TargetLocation != null) |
| | | { |
| | | if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue; |
| | | var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault(); |
| | | task.agv_taskstate = "Create"; |
| | | task.agv_toaddress = TargetLocation.stationCode; |
| | | TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); |
| | |
| | | { |
| | | if (task.agv_toaddress == "") |
| | | { |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.location_state == "Empty" && x.enable).ToList(); |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.tray_status == "EmptyTray" /*x.location_state == "Empty"*/ && x.enable).ToList(); |
| | | foreach (var EmptyStation in EmptyStations) |
| | | { |
| | | if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue; |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (task.agv_tasktype == "TaskType_OutsourceCarry")//å¤åç§»åº |
| | | else if (task.agv_tasktype == "TaskType_OutsourceCarry")//ç§»åºå¤å |
| | | { |
| | | if (task.agv_toaddress == "") |
| | | { |