using Autofac.Core;
|
using Microsoft.AspNetCore.Components.Routing;
|
using Microsoft.AspNetCore.Hosting;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
|
using Quartz;
|
using System;
|
using System.Collections.Generic;
|
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.Eventing.Reader;
|
using System.Linq;
|
using System.Reflection.Metadata;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Common.Log;
|
using WIDESEAWCS_Common.TaskEnum;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.Enums;
|
using WIDESEAWCS_ITaskInfoRepository;
|
using WIDESEAWCS_ITaskInfoService;
|
using WIDESEAWCS_Model.Models;
|
using WIDESEAWCS_QuartzJob;
|
using WIDESEAWCS_QuartzJob.DeviceBase;
|
using WIDESEAWCS_QuartzJob.DTO;
|
using WIDESEAWCS_QuartzJob.Models;
|
using WIDESEAWCS_QuartzJob.Service;
|
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
|
using WIDESEAWCS_Tasks.StackerCraneJob;
|
|
namespace WIDESEAWCS_Tasks
|
{
|
[DisallowConcurrentExecution]
|
public class CommonStackerCraneJob : IJob
|
{
|
private readonly ITaskService _taskService;
|
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
|
private readonly ITaskRepository _taskRepository;
|
private readonly IRouterService _routerService;
|
|
public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService)
|
{
|
_taskService = taskService;
|
_taskExecuteDetailService = taskExecuteDetailService;
|
_taskRepository = taskRepository;
|
_routerService = routerService;
|
}
|
|
public Task Execute(IJobExecutionContext context)
|
{
|
try
|
{
|
CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
|
if (commonStackerCrane != null)
|
{
|
Signalinteraction(commonStackerCrane); //出库信号交互
|
Siganlinteraction2(commonStackerCrane); //入库信号交互
|
if (!commonStackerCrane.IsEventSubscribed)
|
{
|
commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订阅任务完成事件
|
}
|
|
if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal)
|
{
|
commonStackerCrane.CheckStackerCraneTaskCompleted();//防止任务完成事件监测超时,再手动触发一次
|
|
if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
|
{
|
Dt_Task? task = GetTask(commonStackerCrane);
|
if (task != null)
|
{
|
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
|
if (stackerCraneTaskCommand != null)
|
{
|
bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
|
if (sendFlag)
|
{
|
commonStackerCrane.LastTaskType = task.TaskType;
|
_taskService.UpdateTaskStatusToNext(task.TaskNum);
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
//Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
|
}
|
return Task.CompletedTask;
|
}
|
|
/// <summary>
|
/// 任务完成事件订阅的方法
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e)
|
{
|
CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
|
if (commonStackerCrane != null)
|
{
|
if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
|
{
|
Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
|
_taskService.StackCraneTaskCompleted(e.TaskNum);
|
commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
|
}
|
}
|
}
|
|
/// <summary>
|
/// 获取任务
|
/// </summary>
|
/// <param name="commonStackerCrane">堆垛机对象</param>
|
/// <returns></returns>
|
private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
|
{
|
Dt_Task task;
|
/*if (commonStackerCrane.LastTaskType == null)
|
{
|
task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
|
}
|
else
|
{
|
if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
|
{
|
task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
|
if (task == null)
|
{
|
task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode);
|
}
|
}
|
else
|
{
|
task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode);
|
}
|
}*/
|
task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
|
|
if (task != null && task.TaskType== (int)TaskOutboundTypeEnum.Outbound)
|
{
|
string[] targetCodes = task.SourceAddress.Split("-");
|
if (targetCodes[4] == "02")
|
{
|
|
task = OutTaskMovelibrary(task);
|
if (task != null)
|
{
|
if (OutTaskStationIsOccupied(task) != null)
|
{
|
return task;
|
}
|
}
|
}
|
if (OutTaskStationIsOccupied(task) != null)
|
{
|
return task;
|
}
|
else
|
{
|
List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList();
|
List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes);
|
foreach (var item in tasks)
|
{
|
if (OutTaskStationIsOccupied(task) != null)
|
{
|
return task;
|
}
|
}
|
//task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
|
}
|
}
|
|
return task;
|
}
|
|
/// <summary>
|
/// 出库任务判断出库站台是否被占用
|
/// </summary>
|
/// <param name="task">任务实体</param>
|
/// <returns>如果未被占用,返回传入的任务信息,否则,返回null</returns>
|
private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task)
|
{
|
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress));
|
if (device != null)
|
{
|
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Event"); //根据堆垛机地址,地址名称找协议
|
if (deviceProDTO != null)
|
{
|
int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //判断输送线是否允许放货信号
|
if (B_Event_Test == 1)
|
{
|
return task;
|
}
|
}
|
}
|
else
|
{
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用");
|
}
|
return null;
|
}
|
|
/// <summary>
|
/// 出库任务判断是否需要进行移库Move the library
|
/// </summary>
|
/// <param name="task">任务实体</param>
|
/// <returns>如果未被占用,返回传入的任务信息,否则,返回null</returns>
|
private Dt_Task? OutTaskMovelibrary([NotNull] Dt_Task task)
|
{
|
try
|
{
|
string[] targetCodes = task.SourceAddress.Split("-");
|
if (targetCodes[1] == "001")
|
{
|
targetCodes[1] = "002";
|
|
}
|
else if (targetCodes[1] == "004")
|
{
|
targetCodes[1] = "003";
|
}
|
targetCodes[4] = "01";
|
string SourceAddress = string.Join("-", targetCodes); //组装浅库位地址
|
Dt_Task? tasks = _taskService.QueryStationIsOccupiedOutTasks(task.Roadway, SourceAddress).FirstOrDefault();
|
if (tasks != null)
|
{
|
return task;
|
}
|
else
|
{
|
//向wms申请判断浅库位是否有货,是否需要进行移库
|
Dt_Task? taskst = _taskService.RequestWMSTaskMovelibrary(task);
|
if (taskst != null)
|
{
|
return taskst;
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
|
throw;
|
}
|
return null;
|
}
|
|
public void Signalinteraction(CommonStackerCrane commonStackerCrane)
|
{
|
if (Applyrelease(commonStackerCrane)) //读取堆垛机放货申请
|
{
|
Dt_Task task = _taskService.IngStackerCraneTask2(commonStackerCrane.DeviceCode);
|
if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
|
{
|
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress));
|
if (device != null)
|
{
|
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Event"); //根据堆垛机地址,地址名称找协议
|
if (deviceProDTO != null)
|
{
|
int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //判断输送线是否允许放货信号
|
if (B_Event_Test == 1)
|
{
|
|
if (Releasespermitted(commonStackerCrane, task.TargetAddress,true)) //写入堆垛机允许放货信
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机允许放货信号成功:true", $"(放货)写入{task.TargetAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机允许放货信号失败", $"(放货)写入{task.TargetAddress}");
|
}
|
}
|
else
|
{
|
if (Releasespermitted(commonStackerCrane, task.TargetAddress,false)) //写入堆垛机不允许放货信
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机不允许放货信号成功:false", $"(放货)写入{task.TargetAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机不允许放货信号失败", $"(放货)写入{task.TargetAddress}");
|
}
|
}
|
}
|
}
|
}
|
}
|
else
|
{
|
Dt_Task task = _taskService.IngStackerCraneTask2(commonStackerCrane.DeviceCode);
|
if (task !=null && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
|
{
|
if (Completesignal(commonStackerCrane, task.TargetAddress)) //读取到放货完成信号
|
{
|
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress));
|
if (device != null)
|
{
|
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
|
if (task.TargetAddress == "R02-002-027-011-01" || task.TargetAddress == "R01-002-041-011-01") //写入输送线去向
|
{
|
byte PLCtost = (byte)task.PLCTo;
|
if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", PLCtost))
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入去向成功,去向为:{PLCtost}", $"出料口去向");
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入去向失败,去向为:{PLCtost}", $"出料口去向");
|
}
|
}
|
|
if (PLCSignal(conveyorLine, task.TargetAddress, (byte)1)) //写入输送线 堆垛机放货 信号
|
{
|
//读取输送线反馈 堆垛机放下信号
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_StackerCraneLowered"); //输送线协议找读取信号
|
if (deviceProDTO2 != null)
|
{
|
int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读取输送线的 堆垛机放下 信号
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:读取到输送线-堆垛机放下信号:{B_TAKE}", $"(放货)读取{task.TargetAddress}");
|
|
if (B_TAKE == 1)
|
{
|
if (task.TargetAddress == "R02-002-027-011-01" || task.TargetAddress == "R01-002-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO3 = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Destination");
|
if (deviceProDTO3 != null)
|
{
|
int PLCwcstost = GetLine(conveyorLine, deviceProDTO3.DeviceProDataBlock);
|
if (PLCwcstost == task.PLCTo)
|
{
|
byte PLCtost2 = 0;
|
if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", PLCtost2))
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:清除去向成功", $"出料口去向");
|
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:清除去向失败", $"出料口去向");
|
}
|
// 清除输送线
|
if (PLCSignal(conveyorLine, task.TargetAddress, (byte)0))
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线清除-堆垛机放下信号成功", $"出料口去向");
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线清除-堆垛机放下信号失败", $"出料口去向");
|
}
|
//堆垛机写完成
|
if (Releasespermitted4(commonStackerCrane, task.TargetAddress, true))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机放下信号成功:true", $"出料口去向");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机放下信号失败:true", $"出料口去向");
|
}
|
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:去向比对不一致,输送线去向为:{PLCwcstost},wcs写入去向为:{task.PLCTo}", $"出料口去向");
|
}
|
}
|
}
|
|
if (task.TargetAddress != "R02-002-027-011-01" && task.TargetAddress != "R01-002-041-011-01")
|
{
|
// 清除输送线
|
if (PLCSignal(conveyorLine, task.TargetAddress, 0))
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线清除-堆垛机放下信号成功", $"(放货)读取{task.TargetAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线清除-堆垛机放下信号失败", $"(放货)读取{task.TargetAddress}");
|
}
|
|
//堆垛机写完成
|
if (Releasespermitted4(commonStackerCrane, task.TargetAddress, true))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机放下信号成功:true", $"(放货)写入{task.TargetAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机放下信号失败:true", $"(放货)写入{task.TargetAddress}");
|
}
|
}
|
|
|
}
|
else
|
{
|
// 清除输送线
|
if (PLCSignal(conveyorLine, task.TargetAddress, 0))
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:未读取到输送线反馈堆垛机完成反馈信号,重置为0", $"(放货)读取{task.TargetAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:未读取到输送线反馈堆垛机完成反馈信号,重置为0", $"(放货)读取{task.TargetAddress}");
|
}
|
}
|
}
|
}
|
else
|
{
|
WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线0-堆垛机放下信号失败", $"(放货)写入{task.TargetAddress}");
|
}
|
}
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:未读取到堆垛机放货完成信号", $"(放货)写入{task.TargetAddress}");
|
}
|
}
|
}
|
}
|
|
public void Siganlinteraction2(CommonStackerCrane commonStackerCrane)
|
{
|
Dt_Task task = _taskService.IngStackerCraneTask(commonStackerCrane.DeviceCode);
|
if (task != null && task.TaskType == (int)TaskInboundTypeEnum.Inbound)
|
{
|
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.SourceAddress));
|
if (device != null)
|
{
|
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_Event"); //根据堆垛机地址,地址名称找协议
|
if (deviceProDTO != null)
|
{
|
int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //判断输送线是否允许取货信号
|
if (B_Event_Test == 1)
|
{
|
if (Releasespermitted2(commonStackerCrane, task.SourceAddress,true)) //写入堆垛机允许取货信号
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机允许取货信号成功:true", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机允许取货信号失败", $"(取货)写入{task.SourceAddress}");
|
}
|
}
|
else
|
{
|
if (Releasespermitted2(commonStackerCrane, task.SourceAddress,false)) //写入堆垛机允许取货信号
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取到输送线允许取货信号,写入堆垛机允许取货信号成功:false", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取到输送线允许取货信号,写入堆垛机允许取货信号失败", $"(取货)写入{task.SourceAddress}");
|
}
|
|
}
|
}
|
|
if (Completesignal2(commonStackerCrane, task.SourceAddress)) //读取堆垛机取货完成信号
|
{
|
if(PLCSignal2(conveyorLine, task.SourceAddress, "W_StackerCranePicked", 1)) //写入输送线取货完成信号
|
{
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_StackerCranePicked"); //输送线协议找读取信号
|
if (deviceProDTO != null)
|
{
|
int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读取输送线的 堆垛机取走 信号
|
if (B_TAKE == 1)
|
{
|
//写入给堆垛机,输送线的 堆垛机取走 信号
|
if(Releasespermitted3(commonStackerCrane, task.SourceAddress,true))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机取走信号成功:true", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机取走信号失败:true", $"(取货)写入{task.SourceAddress}");
|
}
|
}
|
else
|
{
|
if (Releasespermitted3(commonStackerCrane, task.SourceAddress,false))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取输送线的堆垛机取走信号,写入堆垛机取走信号成功:false", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取输送线的堆垛机取走信号,写入堆垛机取走信号失败:false", $"(取货)写入{task.SourceAddress}");
|
}
|
}
|
}
|
}
|
}
|
else
|
{
|
if (PLCSignal2(conveyorLine, task.SourceAddress, "W_StackerCranePicked", 0)) //写入输送线清除信号
|
{
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_StackerCranePicked"); //输送线协议找读取信号
|
if (deviceProDTO != null)
|
{
|
int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读取输送线的 堆垛机取走 信号
|
if (B_TAKE == 0)
|
{
|
//写入给堆垛机,输送线的 堆垛机取走 信号
|
if (Releasespermitted3(commonStackerCrane, task.SourceAddress, false))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机取走信号成功:true", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:写入堆垛机取走信号失败:true", $"(取货)写入{task.SourceAddress}");
|
}
|
}
|
else
|
{
|
if (Releasespermitted3(commonStackerCrane, task.SourceAddress, false))
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取输送线的堆垛机取走信号,写入堆垛机取走信号成功:false", $"(取货)写入{task.SourceAddress}");
|
}
|
else
|
{
|
WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.SourceAddress},信息:未读取输送线的堆垛机取走信号,写入堆垛机取走信号失败:false", $"(取货)写入{task.SourceAddress}");
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
}
|
|
//获取输送线实例
|
public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine,string SCAddress,string Interactivet)
|
{
|
return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet);
|
}
|
|
//获取堆垛机例
|
public DeviceProDTO? GetDeviceProDTO2(CommonStackerCrane commonStackerCrane, string DeviceName, string Interactivet)
|
{
|
return commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeviceName && x.DeviceProParamName == Interactivet);
|
}
|
|
//读取堆垛机申请放货信号
|
public bool Applyrelease(CommonStackerCrane commonStackerCrane)
|
{
|
if (commonStackerCrane.DeviceCode == "SC02")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Bout");
|
if (deviceProDTO != null)
|
{
|
if(GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Dout");
|
if (deviceProDTO2 != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO2.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
if (commonStackerCrane.DeviceCode == "SC01")
|
{
|
DeviceProDTO? deviceProDTO4 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Cout");
|
if (deviceProDTO4 != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO4.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
DeviceProDTO? deviceProDTO3 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Dout");
|
if (deviceProDTO3 != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO3.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
DeviceProDTO? deviceProDTO5 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Aout");
|
if (deviceProDTO5 != null)
|
{
|
if(GetStacker(commonStackerCrane, deviceProDTO5.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
|
}
|
}
|
return false;
|
|
}
|
|
//写入堆垛机允许放货信号
|
public bool Releasespermitted(CommonStackerCrane commonStackerCrane, string Destinationaddress,bool SCcrane)
|
{
|
if (Destinationaddress == "R02-002-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Bout");
|
if (deviceProDTO != null)
|
{
|
if(SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R02-002-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Dout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-002-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Cout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-002-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Dout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
if (Destinationaddress == "R01-002-044-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Aout");
|
if (deviceProDTO != null)
|
{
|
if(SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
return false;
|
}
|
|
//读取堆垛机的放货完成信号
|
public bool Completesignal(CommonStackerCrane commonStackerCrane,string Destinationaddress)
|
{
|
if (Destinationaddress == "R02-002-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Bout");
|
if (deviceProDTO != null)
|
{
|
if(GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
|
}
|
}
|
if (Destinationaddress == "R02-002-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Dout");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-002-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Cout");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
if (Destinationaddress == "R01-002-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Dout");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
if (Destinationaddress == "R01-002-044-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Aout");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
return false;
|
|
}
|
|
//写入堆垛机放货确认信号
|
public bool Releasespermitted4(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane)
|
{
|
if (Destinationaddress == "R02-002-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Bout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R02-002-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Dout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-002-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Cout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-002-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Dout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-002-044-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Aout");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
return false;
|
}
|
|
|
//写入堆垛机允许取货信号
|
public bool Releasespermitted2(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane)
|
{
|
if (Destinationaddress == "R02-003-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Bin");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R02-003-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Din");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-003-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Cin");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-003-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Din");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
if (Destinationaddress == "R01-002-042-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Ain");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-002-043-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_A2in");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
return false;
|
}
|
|
//读取堆垛机取货完成信号
|
public bool Completesignal2(CommonStackerCrane commonStackerCrane, string Destinationaddress)
|
{
|
if (Destinationaddress == "R02-003-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Bin");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
if (Destinationaddress == "R02-003-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Din");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-003-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Cin");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
if (Destinationaddress == "R01-003-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Din");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
if (Destinationaddress == "R01-002-042-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Ain");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
if (Destinationaddress == "R01-002-043-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_A2in");
|
if (deviceProDTO != null)
|
{
|
if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status)
|
{
|
return true;
|
}
|
}
|
}
|
|
return false;
|
|
}
|
|
//写入堆垛机取货确认信号
|
public bool Releasespermitted3(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane)
|
{
|
if (Destinationaddress == "R02-003-027-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Bin");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R02-003-027-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Din");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
//1号
|
if (Destinationaddress == "R01-003-041-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Cin");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-003-041-011-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Din");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
if (Destinationaddress == "R01-002-042-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Ain");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
if (Destinationaddress == "R01-002-043-001-01")
|
{
|
DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_A2in");
|
if (deviceProDTO != null)
|
{
|
if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
|
}
|
}
|
|
return false;
|
}
|
|
|
//写入输送线放货完成信号,条码,层数,类型
|
public bool PLCSignal(CommonConveyorLine conveyorLine,string TargetAddress,byte staLow)
|
{
|
//处理出库放料完成后逻辑
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, TargetAddress, "W_StackerCraneLowered"); //放货完成信号
|
if (deviceProDTO2 != null)
|
{
|
if (SetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock, staLow))
|
{
|
return true;
|
|
}
|
}
|
return false;
|
}
|
|
//写入输送线 堆垛机取货完成信号
|
public bool PLCSignal2(CommonConveyorLine conveyorLine, string SourceAddress,string DeviceProParamName,Byte stock)
|
{
|
DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, SourceAddress, DeviceProParamName); //取货完成信号
|
if (deviceProDTO2 != null)
|
{
|
return SetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock, stock);
|
}
|
return false;
|
}
|
|
|
/// <summary>
|
/// 根据协议,地址,值,写入输送线信息,
|
/// </summary>
|
/// <param name="conveyorLine"></param>
|
/// <param name="DeviceProDataBlock"></param>
|
/// <param name="Pali"></param>
|
/// <returns></returns>
|
public bool SetLine(CommonConveyorLine conveyorLine,string DeviceProDataBlock,byte Pali)
|
{
|
return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali);
|
}
|
public bool SetLinestring(CommonConveyorLine conveyorLine, string DeviceProDataBlock, string Pali)
|
{
|
return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali);
|
}
|
/// <summary>
|
/// 根地址读取输送线信息
|
/// </summary>
|
/// <param name="conveyorLine"></param>
|
/// <param name="DeviceProDataBlock"></param>
|
/// <returns></returns>
|
public int GetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock)
|
{
|
return conveyorLine.Communicator.Read<byte>(DeviceProDataBlock);
|
}
|
|
/// <summary>
|
/// 读取堆垛机地址
|
/// </summary>
|
/// <param name="conveyorLine"></param>
|
/// <param name="DeviceProDataBlock"></param>
|
/// <returns></returns>
|
public WebResponseContent GetStacker(CommonStackerCrane commonStackerCrane,string DeviceProDataBlock)
|
{
|
WebResponseContent content= new WebResponseContent();
|
if (commonStackerCrane.Communicator.Read<bool>(DeviceProDataBlock))
|
{
|
return content.OK();
|
}
|
else
|
{
|
return content.Error();
|
}
|
|
}
|
|
/// <summary>
|
/// 写入堆垛机信号
|
/// </summary>
|
/// <param name="conveyorLine"></param>
|
/// <param name="DeviceProDataBlock"></param>
|
/// <returns></returns>
|
public WebResponseContent SetStacker(CommonStackerCrane commonStackerCrane, string DeviceProDataBlock,bool Pali)
|
{
|
WebResponseContent content = new WebResponseContent();
|
if (commonStackerCrane.Communicator.Write(DeviceProDataBlock, Pali))
|
{
|
return content.OK();
|
}
|
else
|
{
|
return content.Error();
|
}
|
}
|
|
/// <summary>
|
/// 任务实体转换成命令Model
|
/// </summary>
|
/// <param name="task">任务实体</param>
|
/// <returns></returns>
|
/// <exception cref="Exception"></exception>
|
public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
|
{
|
StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand();
|
|
stackerCraneTaskCommand.Barcode = task.PalletCode;
|
stackerCraneTaskCommand.TaskNum = task.TaskNum;
|
stackerCraneTaskCommand.WorkType = 1;
|
stackerCraneTaskCommand.TrayType = 0;
|
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务
|
{
|
string[] targetCodest = task.SourceAddress.Split("-");
|
if (targetCodest.Length == 5)
|
{
|
stackerCraneTaskCommand.StartRow = Convert.ToInt16(targetCodest[1]);
|
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(targetCodest[2]);
|
stackerCraneTaskCommand.StartLayer = Convert.ToInt16(targetCodest[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库起点错误,起点:【{task.SourceAddress}】");
|
return null;
|
}
|
string[] targetCodes = task.NextAddress.Split("-");
|
if (targetCodes.Length == 5)
|
{
|
stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
|
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
|
stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"入库任务终点错误,起点:【{task.NextAddress}】");
|
return null;
|
}
|
}
|
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
|
{
|
string[] sourceCodes = task.CurrentAddress.Split("-");
|
if (sourceCodes.Length == 5)
|
{
|
stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
|
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
|
stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】");
|
return null;
|
}
|
string[] sourceCodest = task.TargetAddress.Split("-");
|
if (sourceCodest.Length == 5)
|
{
|
stackerCraneTaskCommand.EndRow = Convert.ToInt16(sourceCodest[1]);
|
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(sourceCodest[2]);
|
stackerCraneTaskCommand.EndLayer = Convert.ToInt16(sourceCodest[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务终点错误,起点:【{task.TargetAddress}】");
|
return null;
|
}
|
}
|
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
|
{
|
string[] targetCodes = task.NextAddress.Split("-");
|
if (targetCodes.Length == 5)
|
{
|
stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
|
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
|
stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务终点错误,起点:【{task.NextAddress}】");
|
return null;
|
}
|
string[] sourceCodes = task.CurrentAddress.Split("-");
|
if (sourceCodes.Length == 5)
|
{
|
stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
|
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
|
stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]);
|
}
|
else
|
{
|
//数据配置错误
|
_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"移库任务起点错误,起点:【{task.CurrentAddress}】");
|
return null;
|
}
|
}
|
return stackerCraneTaskCommand;
|
}
|
}
|
}
|