using SqlSugar.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_Tasks.ShuttleCarJob; using WIDESEAWCS_Tasks.StackerCraneJob; namespace WIDESEAWCS_Tasks { public partial class CommonStackerCraneJob { /// /// 心跳 /// /// public void Heartbeat(SpeStackerCrane commonStackerCrane) { var HeartBeat = commonStackerCrane.GetValue(StackerCraneDBName.HeartBeat); commonStackerCrane.SetValue(StackerCraneDBName.WCSHeartBeat, !HeartBeat); } /// /// 堆垛机与穿梭车信息交互 /// /// public void ShuttleCarSignal(SpeStackerCrane commonStackerCrane) { var ASRSRqtGetAGV = commonStackerCrane.GetValue(StackerCraneDBName.ASRSRqtGetAGV); var ASRSRqtGetGoods = commonStackerCrane.GetValue(StackerCraneDBName.ASRSRqtGetGoods); var ASRSRqtPutGoods = commonStackerCrane.GetValue(StackerCraneDBName.ASRSRqtPutGoods); var ASRSRqtPutAGV = commonStackerCrane.GetValue(StackerCraneDBName.ASRSRqtPutAGV); var ASRSGetAGVDone = commonStackerCrane.GetValue(StackerCraneDBName.ASRSGetAGVDone); var ASRSGetGoodsDone = commonStackerCrane.GetValue(StackerCraneDBName.ASRSGetGoodsDone); var ASRSPutAGoodsDone = commonStackerCrane.GetValue(StackerCraneDBName.ASRSPutAGoodsDone); var ASRSPutAGVDone = commonStackerCrane.GetValue(StackerCraneDBName.ASRSPutAGVDone); //任务查询目的地找到车 if (ASRSRqtGetAGV || ASRSRqtGetGoods || ASRSRqtPutGoods || ASRSRqtPutAGV || ASRSGetAGVDone || ASRSGetGoodsDone || ASRSPutAGoodsDone || ASRSPutAGVDone) { Dt_Task? task = GetTaskInfo(commonStackerCrane); if (task != null) { if ((task.TaskType == TaskInboundTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt()) && task.TargetIsPickPlace && ASRSRqtPutGoods)//请求放货 { commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, ASRSRqtPutGoods); } else if ((task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt()) && ASRSRqtGetGoods && task.SourceIsPickPlace)//请求取货 { commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, ASRSRqtGetGoods); }else if (_taskService.TaskOutboundTypes.Contains(task.TaskType)&& ASRSPutAGoodsDone) { } else { Dt_ShuttleCar? shuttleCar1 = GetShuttleCarInfo(ASRSRqtPutGoods ? task.TargetAddress : task.SourceAddress); if (shuttleCar1 != null) { ShuttleCar shuttleCar = Storage.Devices.FirstOrDefault(x => x.DeviceName == shuttleCar1.ShuttleCarName) as ShuttleCar; if (shuttleCar != null) { shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtGetAGV, ASRSRqtGetAGV, shuttleCar.DeviceCode); shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtGetGoods, ASRSRqtGetGoods, shuttleCar.DeviceCode); shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtPutGoods, ASRSRqtPutGoods, shuttleCar.DeviceCode); var AGVAlwASRSGetAGV = shuttleCar.GetValue(ShuttleCarDBName.AGVAlwASRSGetAGV, shuttleCar.DeviceCode);//允许取车 commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetAGV, AGVAlwASRSGetAGV); var AGVAlwASRSGetGoods = shuttleCar.GetValue(ShuttleCarDBName.AGVAlwASRSGetGoods, shuttleCar.DeviceCode);//允许取货 commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, AGVAlwASRSGetGoods); var AGVAlwASRSPuttGoods = shuttleCar.GetValue(ShuttleCarDBName.AGVAlwASRSPuttGoods, shuttleCar.DeviceCode);//允许放货 commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, AGVAlwASRSPuttGoods); commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPutAGV, ASRSRqtPutAGV); shuttleCar.SetValue(ShuttleCarDBName.ASRSGetAGVDone, ASRSGetAGVDone, shuttleCar.DeviceCode); shuttleCar.SetValue(ShuttleCarDBName.ASRSGetGoodsDone, ASRSGetGoodsDone, shuttleCar.DeviceCode); shuttleCar.SetValue(ShuttleCarDBName.ASRSPutAGoodsDone, ASRSPutAGoodsDone, shuttleCar.DeviceCode); //shuttleCar.SetValue(ShuttleCarDBName.ASRSPutAGVDone, ASRSPutAGVDone, shuttleCar.DeviceCode); } } } } } } /// /// 获取任务信息 /// /// /// /// public Dt_Task GetTaskInfo(SpeStackerCrane commonStackerCrane) { return _taskService.GetTaskInfo(commonStackerCrane.CurrentTaskNum); } /// /// 获取穿梭车信息 /// /// /// public Dt_ShuttleCar GetShuttleCarInfo(string Address) { return _shuttleCarService.QueryShuttleCar(Address); } } }