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
|
{
|
/// <summary>
|
/// 心跳
|
/// </summary>
|
/// <param name="commonStackerCrane"></param>
|
public void Heartbeat(SpeStackerCrane commonStackerCrane)
|
{
|
var HeartBeat = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.HeartBeat);
|
commonStackerCrane.SetValue(StackerCraneDBName.WCSHeartBeat, !HeartBeat);
|
}
|
|
/// <summary>
|
/// 堆垛机与穿梭车信息交互
|
/// </summary>
|
/// <param name="commonStackerCrane"></param>
|
public void ShuttleCarSignal(SpeStackerCrane commonStackerCrane)
|
{
|
var ASRSRqtGetAGV = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSRqtGetAGV);
|
var ASRSRqtGetGoods = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSRqtGetGoods);
|
var ASRSRqtPutGoods = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSRqtPutGoods);
|
var ASRSRqtPutAGV = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSRqtPutAGV);
|
var ASRSGetAGVDone = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSGetAGVDone);
|
var ASRSGetGoodsDone = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSGetGoodsDone);
|
var ASRSPutAGoodsDone = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSPutAGoodsDone);
|
var ASRSPutAGVDone = commonStackerCrane.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.ASRSPutAGVDone);
|
//任务查询目的地找到车
|
if (ASRSRqtGetAGV || ASRSRqtGetGoods || ASRSRqtPutGoods || ASRSRqtPutAGV || ASRSGetAGVDone || ASRSGetGoodsDone || ASRSPutAGoodsDone || ASRSPutAGVDone)
|
{
|
Dt_Task? task = GetTaskInfo(commonStackerCrane);
|
if (task != null)
|
{
|
if ((_taskService.TaskInboundTypes.Contains(task.TaskType)
|
|| task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt())
|
&& task.TargetIsPickPlace && ASRSRqtPutGoods)//请求放货
|
{
|
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, ASRSRqtPutGoods);
|
}
|
else if ((_taskService.TaskOutboundTypes.Contains(task.TaskType)
|
|| 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 = _shuttleCarService.QueryCode(task.ShuttleCarCode);
|
if (task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt() && task.Remark == "")
|
{
|
shuttleCar1 = _shuttleCarService.QueryNoCode(task.ShuttleCarCode);
|
task.Remark = shuttleCar1.ShuttleCarCode;
|
_taskService.UpdateData(task);
|
}
|
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, bool>(ShuttleCarDBName.AGVAlwASRSGetAGV, shuttleCar.DeviceCode);//允许取车
|
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetAGV, AGVAlwASRSGetAGV);
|
var AGVAlwASRSGetGoods = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSGetGoods, shuttleCar.DeviceCode);//允许取货
|
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, AGVAlwASRSGetGoods);
|
var AGVAlwASRSPuttGoods = shuttleCar.GetValue<ShuttleCarDBName, bool>(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);
|
}
|
}
|
}
|
}
|
}
|
}
|
/// <summary>
|
/// 获取任务信息
|
/// </summary>
|
/// <param name="commonStackerCrane"></param>
|
/// <returns></returns>
|
/// <exception cref="Exception"></exception>
|
public Dt_Task GetTaskInfo(SpeStackerCrane commonStackerCrane)
|
{
|
return _taskService.GetTaskInfo(commonStackerCrane.CurrentTaskNum);
|
}
|
|
/// <summary>
|
/// 获取穿梭车信息
|
/// </summary>
|
/// <param name="Address"></param>
|
/// <returns></returns>
|
public Dt_ShuttleCar GetShuttleCarInfo(string Address)
|
{
|
return _shuttleCarService.QueryShuttleCar(Address);
|
}
|
}
|
}
|