- 归类 类和方法
- 添加 enum 把任务状态和agv状态都改为 enum
- 清除部分AppConfg引用
master
SoulStar 2 weeks ago
parent 063deee15f
commit 30b171ac56

@ -26,30 +26,38 @@ namespace SlnMesnac.Business.@base
private AirPorthttpClient _airPorthttpClient;
private IAGVStateService _AGVStateService;
private IAGVMapPointService _AGVMapPointService;
private IAGVJobService _AGVJobService;
private IAGVSettingService _AGVSettingService;
public BaseAGVBusiness(ILogger<BaseAGVBusiness> logger,
AirPorthttpClient airPorthttpClient,
IAGVStateService AGVStateService,
IAGVMapPointService aGVMapPointService,
AppConfig appConfig)
public BaseAGVBusiness(ILogger<BaseAGVBusiness> logger,
AirPorthttpClient airPorthttpClient,
IAGVStateService AGVStateService,
IAGVMapPointService aGVMapPointService,
AppConfig appConfig,
IAGVJobService aGVJobService,
IAGVSettingService aGVSettingService)
{
_logger = logger;
_airPorthttpClient = airPorthttpClient;
_AGVStateService = AGVStateService;
_AGVMapPointService = aGVMapPointService;
_appConfig = appConfig;
_AGVJobService = aGVJobService;
_AGVSettingService = aGVSettingService;
}
public static BaseAGVBusiness GetInstance(ILogger<BaseAGVBusiness> logger,
AirPorthttpClient airPorthttpClient,
IAGVStateService AGVStateService,
IAGVMapPointService aGVMapPointService,
AppConfig appConfig)
public static BaseAGVBusiness GetInstance(ILogger<BaseAGVBusiness> logger,
AirPorthttpClient airPorthttpClient,
IAGVStateService AGVStateService,
IAGVMapPointService aGVMapPointService,
AppConfig appConfig,
IAGVJobService aGVJobService,
IAGVSettingService aGVSettingService
)
{
if (instance == null)
{
instance = new BaseAGVBusiness(logger, airPorthttpClient, AGVStateService, aGVMapPointService, appConfig);
instance = new BaseAGVBusiness(logger, airPorthttpClient, AGVStateService, aGVMapPointService, appConfig, aGVJobService, aGVSettingService);
}
return instance;
}
@ -78,22 +86,22 @@ namespace SlnMesnac.Business.@base
verifyStatus = 0,
enableSplitCar = 0,
load = new List<LoadsEntity>()
{
new LoadsEntity()
{
jobid = JobGUID,
location = PointGUID,
param = new List<ParamEntity>()
{
new ParamEntity()
{
new LoadsEntity()
{
jobid = JobGUID,
location = PointGUID,
param = new List<ParamEntity>()
{
new ParamEntity()
{
paramname = ParamName,
paramvalue = PointGUID,
}
},
robotPort = ""
}
},
paramname = ParamName,
paramvalue = PointGUID,
}
},
robotPort = ""
}
},
};
return aGVRequestAddTaskEntity;
}
@ -238,16 +246,16 @@ namespace SlnMesnac.Business.@base
/// <param name="agvguid"></param>
/// <param name="jobName"></param>
/// <returns>新任务GUID</returns>
public string EndTaskAndClearErrorAndDownloadTask(string agvguid, string jobName)
public string EndTaskAndClearErrorAndDownloadTask(string agvguid, string jobGuid)
{
bool result = false;
try
{
//终止小车当前任务
result = EndTaskAndClearError(agvguid);
var param = _appConfig.JobConfig.Where(x => x.JobName == jobName).First();
result = EndTaskAndClearError(agvguid);//////////////////////////////////////////////////////////////////还没改完///////////////////////////////////////////////////////////////
var param = _appConfig.JobConfig.Where(x => x.JobGUID == jobGuid).First();
//调用小车到抓取位置
return DownloadTask(agvguid, param.JobGUID, param.PointGUID, param.PointParamName);
return DownloadTask(agvguid, jobGuid, param.PointGUID, param.PointParamName);
}
catch (Exception ex)
{
@ -289,7 +297,7 @@ namespace SlnMesnac.Business.@base
{
Task.Run(() =>
{
var response = _airPorthttpClient.AGVErrorClear(_appConfig.AGVConfig.Where(x => x.AGVGUID == agvguid).First().AGVIp);
var response = _airPorthttpClient.AGVErrorClear(_AGVSettingService.GetAgvSettingByAgvGuid(agvguid).AGVNo);
Task.Delay(500);
if (response == null)
{
@ -297,7 +305,7 @@ namespace SlnMesnac.Business.@base
result = false;
return false;
}
if(response.code == 0)
if (response.code == 0)
{
_logger.LogError("清除报警成功");
result = true;
@ -340,6 +348,7 @@ namespace SlnMesnac.Business.@base
{
if (min >= BaseTaskInfoBusiness.AMRStackNumber)
{
_logger.LogInformation("无可用车辆!");
return null;
}
}
@ -347,6 +356,7 @@ namespace SlnMesnac.Business.@base
{
if (min >= BaseTaskInfoBusiness.DeliverStackNumber)
{
_logger.LogInformation("无可用车辆!");
return null;
}
}
@ -354,12 +364,51 @@ namespace SlnMesnac.Business.@base
//var list = _AGVStateService
return agv;
}
catch(Exception ex)
catch (Exception ex)
{
_logger.LogError($"AGV筛选发生错误{ex.Message}");
return null;
}
}
/// <summary>
/// 入库所有满载AGV
/// </summary>
public void ClearFullAGV()
{
try
{
var list = _AGVStateService.GetAgvState(AgvType.Deliver);
foreach (var record in list)
{
if (record.stackcount >= BaseTaskInfoBusiness.DeliverStackNumber && record.agvworkstate == "待机")
{
//入库代码
EndTaskAndClearErrorAndDownloadTask(record.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", "0").JobGuid);
_AGVStateService.ResetAGVStackCount(record.agvno);
_logger.LogInformation($"Deliver [{record.agvno}] 入库");
}
}
list = _AGVStateService.GetAgvState(AgvType.AMR);
foreach (var record in list)
{
if (record.stackcount >= BaseTaskInfoBusiness.AMRStackNumber && record.agvworkstate == "待机")
{
//入库代码
EndTaskAndClearErrorAndDownloadTask(record.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("1000入库", "0").JobGuid);
_AGVStateService.ResetAGVStackCount(record.agvno);
_logger.LogInformation($"AMR [{record.agvno}] 入库");
}
}
}
catch (Exception ex)
{
_logger.LogError($"清理满载AGV时发生错误Error: [{ex.Message}]");
}
}
}
}

@ -1,106 +0,0 @@
using SlnMesnac.Plc;
using SlnMesnac.Rfid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* LAPTOP-E0N2L34V
* SlnMesnac.Business.base
* b00d95c1-a164-43a3-9f34-2a5d2efb3f34
*
* WenJY
* wenjy@mesnac.com
* 2024-04-12 17:36:19
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Business.@base
{
internal class BaseBusiness
{
private readonly List<PlcAbsractFactory> _plcFactories;
private readonly List<RfidAbsractFactory> _rfidFactories;
public BaseBusiness(List<PlcAbsractFactory> plcFactories, List<RfidAbsractFactory> rfidFactories)
{
_plcFactories = plcFactories;
_rfidFactories = rfidFactories;
}
/// <summary>
/// 根据Key获取PLC连接信息
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public PlcAbsractFactory GetPlcByKey(string key)
{
if(_plcFactories == null)
{
throw new ArgumentNullException($"根据Key获取PLC连接信息异常:PLC 连接信息为空");
}
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("根据Key获取PLC连接信息异常:设备Key参数为空");
}
try
{
var info = _plcFactories.Where(x => x.ConfigKey == key).FirstOrDefault();
return info;
}catch(Exception ex)
{
throw new InvalidOperationException($"根据Key获取PLC连接信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据Key获取Rfid连接信息
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public RfidAbsractFactory GetRfidByKey(string key)
{
if (_rfidFactories == null)
{
throw new ArgumentNullException($"根据Key获取RFID连接信息异常:PLC 连接信息为空");
}
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("根据Key获取RFID连接信息异常:设备Key参数为空");
}
try
{
var info = _rfidFactories.Where(x => x.ConfigKey == key).FirstOrDefault();
return info;
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据Key获取RFID连接信息异常:{ex.Message}");
}
}
}
}

@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Business.util;
using SlnMesnac.Model.AirportApiEntity;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
@ -70,9 +71,12 @@ namespace SlnMesnac.Business.@base
{
_logger.LogError("AGV状态操作失败" + ex.Message);
}
}
/// <summary>
/// Timer刷新方法
/// </summary>
/// <returns></returns>
public async Task TimerUpadteAGVState()
{
if (!await UpdateALLAGVStateByResposne())
@ -121,7 +125,7 @@ namespace SlnMesnac.Business.@base
{
agvno = entity.Guid,
agvalarmstate = entity.AgvMoveStatus != 6 ? "正常" : "异常",
agvtype = _aGVSettingService.GetAgvSettingByID(entity.Guid),
agvtype = _aGVSettingService.GetAgvTypeByAGVGuid(entity.Guid),
agvworkstate = AGVStatusSelect(entity.AgvMoveStatus),
refreshtime = DateTime.Now,
taskno = entity.TaskID,
@ -184,13 +188,4 @@ namespace SlnMesnac.Business.@base
}
}
}
public enum TimerControl
{
Start = 1,
Stop = 2,
Dispose = 3
}
}

@ -16,6 +16,7 @@ using System.Threading;
using SlnMesnac.TouchSocket.Entity;
using SlnMesnac.Model.AirportApiEntity;
using System.Linq;
using SlnMesnac.Business.util;
namespace SlnMesnac.Business.@base
{
@ -24,8 +25,16 @@ namespace SlnMesnac.Business.@base
/// </summary>
public class BaseTaskInfoBusiness
{
/// <summary>
/// AMR最大运载量
/// </summary>
public const int AMRStackNumber = 10;
/// <summary>
/// Deliver最大运载量
/// </summary>
public const int DeliverStackNumber = 15;
private TcpServer _tcpServer = null;
public Action<AirportTask> _Taskaction;
public Action<string> _RefreshLogMessageAction;
@ -35,7 +44,8 @@ namespace SlnMesnac.Business.@base
private IAGVMapPointService _AGVMapPointService;
private IAGVStateService _AGVStateService;
private IAGVJobService _AGVJobService;
private AirPorthttpClient _airpttpClient;
private IVisionSettingService _AGVVisionSettingService;
private AirPorthttpClient _airPorthttpClient;
private BaseAGVBusiness _baseAGVBusiness;
private VisionBusiness _visionBusiness;
System.Timers.Timer RefreshTimer;
@ -45,6 +55,7 @@ namespace SlnMesnac.Business.@base
IAGVStateService agvService,
IAGVMapPointService aGVMapPointService,
IAGVJobService agvJobService,
IVisionSettingService aVisionSettingService,
TcpServer tcpServer,
AirPorthttpClient airPorthttpClient,
BaseAGVBusiness baseAGVBusiness,
@ -54,19 +65,19 @@ namespace SlnMesnac.Business.@base
_tcpServer = tcpServer;
_Taskservice = Taskservice;
_AGVStateService = agvService;
_airpttpClient = airPorthttpClient;
_airPorthttpClient = airPorthttpClient;
//doWhileGetAGVTaskInfo();
_baseAGVBusiness = baseAGVBusiness;
_AGVMapPointService = aGVMapPointService;
_AGVJobService = agvJobService;
_AGVVisionSettingService = aVisionSettingService;
//新建Timer
RefreshTimer = new System.Timers.Timer(1000);
RefreshTimer.Elapsed += (sender, e) =>
{
//清理满载AGV 刷新状态
ClearFullAGV();
//清理满载AGV 刷新状态
//ClearFullAGV();
RefreshTaskState();
};
@ -79,6 +90,7 @@ namespace SlnMesnac.Business.@base
IAGVStateService agvService,
IAGVMapPointService aGVMapPointService,
IAGVJobService aAGVJobService,
IVisionSettingService aVisionSettingService,
TcpServer tcpServer,
AirPorthttpClient airPorthttpClient,
BaseAGVBusiness baseAGVBusiness,
@ -87,14 +99,14 @@ namespace SlnMesnac.Business.@base
if (instance == null)
{
instance = new BaseTaskInfoBusiness(logger,
Taskservice, agvService, aGVMapPointService, aAGVJobService,
Taskservice, agvService, aGVMapPointService, aAGVJobService, aVisionSettingService,
tcpServer, airPorthttpClient, baseAGVBusiness, visionBusiness);
}
return instance;
}
/// <summary>
/// 从航班接口获取新任务插入数据库
/// 获取新任务插入数据库
/// </summary>
/// <returns></returns>
public async Task<bool> NewTaskInfo(string taskNo, string conveyNo, string flightNo, int totalCount)
@ -127,7 +139,7 @@ namespace SlnMesnac.Business.@base
}
/// <summary>
/// AGV状态查询控制
/// 任务刷新Timer控制
/// </summary>
/// <param name="state"></param>
public void TaskStateUpdateTimerOperation(TimerControl state)
@ -157,7 +169,10 @@ namespace SlnMesnac.Business.@base
}
#region 任务初次派车调度
/// <summary>
/// AGV调度
/// Timer刷新任务状态, 有新任务初次下发AGV, Timer执行
/// </summary>
public void RefreshTaskState()
@ -185,7 +200,7 @@ namespace SlnMesnac.Business.@base
{
string amrTaskId = _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(
firstAMR.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("1000入位", taskItem.conveyorno).JobName);
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("1000入位", taskItem.conveyorno).JobGuid);
_logger.LogInformation($"为AMR[ {firstAMR.agvno}]分配任务,目标:[ {taskItem.conveyorno} ]号传送带");
taskItem.amragvno = firstAMR.agvno;
taskItem.amragvisarrive = "未到达";
@ -208,7 +223,7 @@ namespace SlnMesnac.Business.@base
{
string deliverTaskID = _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(
firstDeliver.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", taskItem.conveyorno).JobName);
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", taskItem.conveyorno).JobGuid);
_logger.LogInformation($"为Deliver[ {firstDeliver.agvno} ]分配任务,目标:[ {taskItem.conveyorno} ]号传送带");
taskItem.deliveragvno = firstDeliver.agvno;
taskItem.deliveragvisarrive = "未到达";
@ -245,7 +260,7 @@ namespace SlnMesnac.Business.@base
{
string deliverTaskID = _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(
firstDeliver.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", taskItem.conveyorno).JobName);
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", taskItem.conveyorno).JobGuid);
_logger.LogInformation($"为Deliver[ {firstDeliver.agvno} ]分配任务,目标:[ {taskItem.conveyorno} ]号传送带");
taskItem.deliveragvno = firstDeliver.agvno;
taskItem.deliveragvisarrive = "未到达";
@ -330,42 +345,39 @@ namespace SlnMesnac.Business.@base
}
}
#endregion
/// <summary>
/// 入库满载AGV
/// 停止所有任务
/// </summary>
public void ClearFullAGV()
public void StopAllTask()
{
try
List<AirportTask> taskList = _Taskservice.GetTaskInfos(x => x.taskstate == "抓取中" || x.taskstate == "派车中").ToList();
//任务状态设置为已终止并且机械臂复位
foreach (var taskInfo in taskList)
{
var list = _AGVStateService.GetAgvState(AgvType.Deliver);
foreach (var record in list)
{
if (record.stackcount >= BaseTaskInfoBusiness.DeliverStackNumber && record.agvworkstate == "待机")
{
//入库代码
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(record.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", "0").JobName);
_AGVStateService.ResetAGVStackCount(record.agvno);
_logger.LogInformation($"Deliver [{record.agvno}] 入库");
}
}
list = _AGVStateService.GetAgvState(AgvType.AMR);
foreach (var record in list)
{
if (record.stackcount >= BaseTaskInfoBusiness.AMRStackNumber && record.agvworkstate == "待机")
{
//入库代码
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(record.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("1000入库", "0").JobName);
_AGVStateService.ResetAGVStackCount(record.agvno);
_logger.LogInformation($"AMR [{record.agvno}] 入库");
}
}
_visionBusiness.RequestVisionReplace(_AGVVisionSettingService.GetVisionSettingByAMRGUID(taskInfo.amragvno).VisionID);
taskInfo.finishtime = DateTime.Now;
taskInfo.taskstate = "已终止";
_Taskservice.UpdateTaskAsync(taskInfo);
_logger.LogInformation($"任务 [{taskInfo.taskno}] 已终止");
}
catch (Exception ex)
//agv全部停止
var responseList = _airPorthttpClient.AGVAllStateRequest();
if (responseList == null || responseList.count == 0)
{
_logger.LogInformation($"连接失败或无小车连接");
return;
}
foreach (var response in responseList.Data)
{
_logger.LogError($"清理满载AGV时发生错误Error: [{ex.Message}]");
if (!string.IsNullOrEmpty(response.TaskID) && response.AgvMoveStatus != 1 && response.AgvMoveStatus != 3)
{
_baseAGVBusiness.EndTaskAndClearError(response.Guid);
_logger.LogInformation($"小车 [{response.Name}] 任务已终止");
}
}
_logger.LogInformation($"全部复位完毕");
}
}
}

@ -0,0 +1,31 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Config;
using SlnMesnac.Repository.service;
using SlnMesnac.TouchSocket;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Business.@base
{
public class InOutControl
{
private ILogger<InOutControl> _logger;
private static InOutControl instance;
public InOutControl(ILogger<InOutControl> logger)
{
_logger = logger;
}
public static InOutControl GetInstance(ILogger<InOutControl> logger)
{
if (instance == null)
{
instance = new InOutControl(logger);
}
return instance;
}
}
}

@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Business.util;
using SlnMesnac.Model.domain;
using SlnMesnac.Model.Enum;
using SlnMesnac.Repository;
@ -208,18 +209,18 @@ namespace SlnMesnac.Business.@base
//////////////////////////////////////////////////////上一次是AMR////////////////////////////////////////////////////
if (entity.DataBytes[1] == 0x00)
{
//妹有Deliver的任务小车号和是否已到达都没有amr肯定能抓完 继续amr抓取
//----妹有Deliver的任务小车号和是否已到达都没有amr肯定能抓完 继续amr抓取
if (string.IsNullOrEmpty(airportTask.deliveragvno) && string.IsNullOrEmpty(airportTask.deliveragvisarrive))
{
//一直向amr抓直到抓满
RequestVisionStartWork(StackState.NXAMRNoPositioning, AMRCount, id);
_logger.LogInformation($"任务 [{airportTask.taskno}] 继续向AMR [{airportTask.amragvno}] 抓取");
}
//有Delievr任务有任务号且状态为未到达继续amr抓取
//----有Delievr任务有任务号且状态为未到达继续amr抓取
else if (!string.IsNullOrEmpty(airportTask.deliveragvno) && airportTask.deliveragvisarrive == "未到达")
{
//判断AMR小车是否装满没满就开装满了就结束开始循环判断deliver是否到达
//amr没满 继续装amr
//----amr没满 继续装amr
if (_aGVStateService.GetSingleAGVState(airportTask.amragvno).stackcount < BaseTaskInfoBusiness.AMRStackNumber)
{
RequestVisionStartWork(StackState.NXAMRNoPositioning, AMRCount, id);
@ -229,7 +230,7 @@ namespace SlnMesnac.Business.@base
else
{
AirportTask task;
//结束抓取、循环判断deliver是否到达到了就向新的Deliver开始抓取
//---结束抓取、循环判断deliver是否到达到了就向新的Deliver开始抓取
Task.Run(() =>
{
//请求复位
@ -250,13 +251,13 @@ namespace SlnMesnac.Business.@base
});
}
}
//有Deliver任务有任务号且已到达向Deliver发送开始抓取
//----有Deliver任务有任务号且已到达向Deliver发送开始抓取
else if (!string.IsNullOrEmpty(airportTask.deliveragvno) && airportTask.deliveragvisarrive == "已到达")
{
RequestVisionStartWork(StackState.NXAGVNeedPositioning, DeliverCount, id);
_logger.LogInformation($"任务 [{airportTask.taskno}] 向Deliver [{airportTask.deliveragvno}] 抓取");
}
//异常情况
//----异常情况
else
{
throw new Exception($"任务 {airportTask.taskno} 状态异常!请清除任务并重新下发任务!");
@ -267,38 +268,51 @@ namespace SlnMesnac.Business.@base
else if (entity.DataBytes[1] == 0x01)
{
//判断Deliver是否装满,装满就直接入库,未装满继续装
//deliver没满继续装
//----deliver没满继续装
if (_aGVStateService.GetSingleAGVState(airportTask.deliveragvno).stackcount < BaseTaskInfoBusiness.DeliverStackNumber)
{
RequestVisionStartWork(StackState.NXAGVNoPositioning, DeliverCount, id);
_logger.LogInformation($"任务 [{airportTask.taskno}] 继续向Deliver [{airportTask.deliveragvno}] 抓取");
}
//deliver满了入库然后判断
//----deliver满了入库然后判断
else
{
//入库代码
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(airportTask.deliveragvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", airportTask.conveyorno).JobName);
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", airportTask.conveyorno).JobGuid);
_logger.LogInformation($"任务 [{airportTask.taskno}] Deliver [{airportTask.deliveragvno}] 入库");
_aGVStateService.ResetAGVStackCount(airportTask.deliveragvno);
airportTask.deliveragvno = null;
airportTask.deliveragvisarrive = null;
_airportTaskService.UpdateTaskAsync(airportTask);
//判断剩下的数量用不用调用新的deliver
//剩下的数量不用 直接向amr抓取
//----剩下的数量不用 直接向amr抓取
int amrleft = BaseTaskInfoBusiness.AMRStackNumber - _aGVStateService.GetSingleAGVState(airportTask.amragvno).stackcount;
if (airportTask.totalcount - airportTask.loadcount < amrleft)
{
RequestVisionStartWork(StackState.NXAMRNeedPositioning, AMRCount, id);
_logger.LogInformation($"任务 [{airportTask.taskno}] 向AMR [{airportTask.amragvno}] 抓取");
}
//剩下的数量需要调用并判断向AMR抓取
//----剩下的数量需要调用并判断向AMR抓取
else
{
AGVState newagv = null;
//调新的deliver
AGVState newagv = _baseAGVBusiness.GetBestAGV(AgvType.Deliver);
Task.Run(() =>
{
do
{
newagv = _baseAGVBusiness.GetBestAGV(AgvType.Deliver);
if (newagv != null && !string.IsNullOrEmpty(newagv.agvno))
{
break;
}
Task.Delay(1000);
}
while (true);
});
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(newagv.agvno,
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", airportTask.conveyorno).JobName);
_AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", airportTask.conveyorno).JobGuid);
airportTask.deliveragvno = newagv.agvno;
airportTask.deliveragvisarrive = "未到达";
_logger.LogInformation($"任务 [{airportTask.taskno}] 调用Deliver [{airportTask.deliveragvno}] 入位");
@ -307,7 +321,7 @@ namespace SlnMesnac.Business.@base
if (amrleft <= 0)
{
AirportTask task;
//结束抓取、循环判断deliver是否到达到了就向新的Deliver开始抓取
//----结束抓取、循环判断deliver是否到达到了就向新的Deliver开始抓取
Task.Run(() =>
{
//请求复位
@ -327,7 +341,7 @@ namespace SlnMesnac.Business.@base
}
});
}
//amr有容量
//----amr有容量
else
{
RequestVisionStartWork(StackState.NXAMRNeedPositioning, AMRCount, id);

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace SlnMesnac.Business.util
{
public enum AgvTaskState
{
/// <summary>
/// 等待中
/// </summary>
[Description("等待中")]
Waiting = 0,
/// <summary>
/// 派车中
/// </summary>
[Description("派车中")]
Dispatching = 1,
/// <summary>
/// 抓取中
/// </summary>
[Description("抓取中")]
grabbing = 2,
/// <summary>
/// 终止
/// </summary>
[Description("终止")]
Stop = 9,
/// <summary>
/// 结束
/// </summary>
[Description("结束")]
End = 10,
/// <summary>
/// 异常
/// </summary>
[Description("异常")]
Error = 20,
}
public enum TimerControl
{
/// <summary>
/// Timer启动
/// </summary>
[Description("Timer启动")]
Start = 1,
/// <summary>
/// Timer关闭
/// </summary>
[Description("Timer关闭")]
Stop = 2,
/// <summary>
/// Timer释放
/// </summary>
[Description("Timer释放")]
Dispose = 3
}
/// <summary>
/// 请求视觉开始工作码垛信号
/// </summary>
public enum StackState
{
/// <summary>
/// 复合机器人码垛无需定位位置在X负侧
/// </summary>
[Description("复合机器人码垛无需定位位置在X负侧")]
NXAMRNoPositioning = 0x00,
/// <summary>
/// 复合机器人码垛需要定位位置在X负侧
/// </summary>
[Description("复合机器人码垛需要定位位置在X负侧")]
NXAMRNeedPositioning = 0x01,
/// <summary>
/// 搬运机器人码垛无需定位位置在X负侧
/// </summary>
[Description("搬运机器人码垛无需定位位置在X负侧")]
NXAGVNoPositioning = 0x02,
/// <summary>
/// 搬运机器人码垛需要定位位置在X负侧
/// </summary>
[Description("搬运机器人码垛需要定位位置在X负侧")]
NXAGVNeedPositioning = 0x03,
/// <summary>
/// 复合机器人码垛无需定位位置在X正侧
/// </summary>
[Description("复合机器人码垛无需定位位置在X正侧")]
PXAMRNoPositioning = 0x04,
/// <summary>
/// 复合机器人码垛需要定位位置在X正侧
/// </summary>
[Description("复合机器人码垛需要定位位置在X正侧")]
PXAMRNeedPositioning = 0x05,
/// <summary>
/// 搬运机器人码垛无需定位位置在X正侧
/// </summary>
[Description("搬运机器人码垛无需定位位置在X正侧")]
PXAGVNoPositioning = 0x06,
/// <summary>
/// 搬运机器人码垛需要定位位置在X正侧
/// </summary>
[Description("搬运机器人码垛需要定位位置在X正侧")]
PXAGVNeedPositioning = 0x07,
}
}

@ -14,6 +14,7 @@ namespace SlnMesnac.Repository.service
/// <returns></returns>
List<AGVJob> GetAGVJobList();
/// <summary>
/// 根据模板类型获取对应的AGV模板列表
/// </summary>
@ -24,8 +25,8 @@ namespace SlnMesnac.Repository.service
/// <summary>
/// 根据模板类型和传送带编号获取对应的AGV模板
/// </summary>
/// <param name="jobType"></param>
/// <param name="conveyorno"></param>
/// <param name="jobType">任务类型</param>
/// <param name="conveyorno">0就是通用模板 其他编号为对应传送带的调用模板</param>
/// <returns></returns>
AGVJob GetAGVJobListByTypeAndConveyorNo(string jobType, string conveyorno);
}

@ -16,12 +16,18 @@ namespace SlnMesnac.Repository.service
/// <returns></returns>
List<AGVSetting> GetAllAgvSetting();
/// <summary>
/// 根据AgvGuid获取单条AGV设置
/// </summary>
/// <returns></returns>
AGVSetting GetAgvSettingByAgvGuid(string guid);
/// <summary>
/// 根据AGVID获取AGV类型
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
string GetAgvSettingByID(string id);
string GetAgvTypeByAGVGuid(string guid);
/// <summary>
/// 插入AGV设置

@ -8,6 +8,9 @@ using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
/// <summary>
/// AGV模板服务类
/// </summary>
public class AGVJobServiceImpl : BaseServiceImpl<AGVJob>, IAGVJobService
{
private ILogger<AGVJobServiceImpl> _logger;
@ -21,12 +24,16 @@ namespace SlnMesnac.Repository.service.Impl
try
{
var list = _rep.GetList();
if (list == null)
{
return new List<AGVJob>();
}
return list;
}
catch (Exception ex)
{
_logger.LogError($"获取列表发生错误: {ex.Message}");
return null;
return new List<AGVJob>();
}
}
@ -35,12 +42,16 @@ namespace SlnMesnac.Repository.service.Impl
try
{
var list = _rep.GetList(x => x.JobType == jobType).ToList();
if (list == null)
{
return new List<AGVJob>();
}
return list;
}
catch (Exception ex)
{
_logger.LogError($"获取列表发生错误: {ex.Message}");
return null;
return new List<AGVJob>();
}
}
@ -49,12 +60,16 @@ namespace SlnMesnac.Repository.service.Impl
try
{
AGVJob record = _rep.GetList(x => x.ConveyorNo == conveyorno && x.JobType == jobType).First();
if(record == null)
{
return new AGVJob();
}
return record;
}
catch (Exception ex)
{
_logger.LogError($"获取列表发生错误: {ex.Message}");
return null;
return new AGVJob();
}
}
}

@ -35,23 +35,46 @@ namespace SlnMesnac.Repository.service.Impl
return agvSettingList;
}
/// <summary>
/// 根据AgvGuid获取单条AGV设置
/// </summary>
/// <returns></returns>
public AGVSetting GetAgvSettingByAgvGuid(string guid)
{
try
{
var res = _rep.GetList(x => x.AGVNo == guid).FirstOrDefault();
if(res == null)
{
return new AGVSetting();
}
return res;
}
catch (Exception ex)
{
_logger.LogError("根据AGVID获取AGV类型异常" + ex.Message);
return new AGVSetting();
}
}
/// <summary>
/// 根据AGVID获取AGV类型
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public string GetAgvSettingByID(string id)
public string GetAgvTypeByAGVGuid(string guid)
{
try
{
List<AGVSetting> list = _rep.GetList();
return list.Where(x => x.AGVNo == id).FirstOrDefault().AGVType;
var res = _rep.GetList(x => x.AGVNo == guid).FirstOrDefault().AGVType;
return res;
}
catch(Exception ex)
{
_logger.LogError("根据AGVID获取AGV类型异常" + ex.Message);
return "";
}
}
}
/// <summary>

@ -4,6 +4,7 @@ using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Security.Cryptography;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
@ -20,12 +21,17 @@ namespace SlnMesnac.Repository.service.Impl
{
try
{
return _rep.GetList();
var res = _rep.GetList();
if (res == null)
{
return new List<VisionSetting>();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"获取视觉配置列表错误");
return null;
return new List<VisionSetting>();
}
}
@ -33,12 +39,17 @@ namespace SlnMesnac.Repository.service.Impl
{
try
{
return _rep.GetList(expression);
var res = _rep.GetList(expression);
if (res == null)
{
return new List<VisionSetting>();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"获取视觉配置列表错误");
return null;
return new List<VisionSetting>();
}
}
@ -46,12 +57,17 @@ namespace SlnMesnac.Repository.service.Impl
{
try
{
return _rep.GetSingle(x => x.AMRGUID == guid);
var res = _rep.GetSingle(x => x.AMRGUID == guid);
if (res == null)
{
return new VisionSetting();
}
return res;
}
catch(Exception ex)
{
_logger.LogError($"根据AMRGUID获取视觉配置错误");
return null;
return new VisionSetting();
}
}
@ -59,12 +75,17 @@ namespace SlnMesnac.Repository.service.Impl
{
try
{
return _rep.GetSingle(x => x.VisionID == id);
var res = _rep.GetSingle(x => x.VisionID == id);
if (res == null)
{
return new VisionSetting();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"根据VisionID获取视觉配置错误");
return null;
return new VisionSetting();
}
}
}

@ -387,51 +387,4 @@ namespace SlnMesnac.TouchSocket
};
}
}
/// <summary>
/// 请求视觉开始工作码垛信号
/// </summary>
public enum StackState
{
/// <summary>
/// 复合机器人码垛无需定位位置在X负侧
/// </summary>
NXAMRNoPositioning = 0x00,
/// <summary>
/// 复合机器人码垛需要定位位置在X负侧
/// </summary>
NXAMRNeedPositioning = 0x01,
/// <summary>
/// 搬运机器人码垛无需定位位置在X负侧
/// </summary>
NXAGVNoPositioning = 0x02,
/// <summary>
/// 搬运机器人码垛需要定位位置在X负侧
/// </summary>
NXAGVNeedPositioning = 0x03,
/// <summary>
/// 复合机器人码垛无需定位位置在X正侧
/// </summary>
PXAMRNoPositioning = 0x04,
/// <summary>
/// 复合机器人码垛需要定位位置在X正侧
/// </summary>
PXAMRNeedPositioning = 0x05,
/// <summary>
/// 搬运机器人码垛无需定位位置在X正侧
/// </summary>
PXAGVNoPositioning = 0x06,
/// <summary>
/// 搬运机器人码垛需要定位位置在X正侧
/// </summary>
PXAGVNeedPositioning = 0x07,
}
}

@ -6,20 +6,7 @@
xmlns:local="clr-namespace:SlnMesnac.WPF.Page.ControlPage"
mc:Ignorable="d" d:DesignWidth="800" Background="Transparent" Height="590">
<Grid HorizontalAlignment="Center" Width="800" Height="590" VerticalAlignment="Bottom">
<Button Content="D定位抓取" x:Name="DeliverNeedPosition" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=DeliverNeedPosition}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="466,51,234,509" Click="Button_Click_1"/>
<Button Content="A定位抓取" x:Name="AMRNeedPosition" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name, ElementName=AMRNeedPosition}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="466,121,234,439" Click="Button_Click_1"/>
<Button Content="D无定抓取" x:Name="DeilverNoPosition" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=DeilverNoPosition}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="324,51,376,509" Click="Button_Click_1"/>
<Button Content="A无定抓取" x:Name="AMRNoPosition" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=AMRNoPosition}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="324,121,376,439" Click="Button_Click_1"/>
<Button Content="发送结束抓取" x:Name="VisionEnd" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=VisionEnd}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="466,185,234,375" Click="Button_Click_2"/>
<Button Content="调用800小车" x:Name="Get800" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Get800}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="47,51,653,509" Click="Button_Click_3"/>
<Button Content="入库800小车" x:Name="Out800" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Out800}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="47,121,653,439" Click="Button_Click_4"/>
<Button Content="测试按钮" x:Name="TestButton" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=TestButton}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="47,190,653,370" />
<Button Content="调用1000小车" x:Name="Get1000" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Get1000}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="187,51,513,509" Click="Button_Click_3"/>
<Button Content="入库1000小车" x:Name="Out1000" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Out1000}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="187,121,513,439" Click="Button_Click_4"/>
<Button Content="复位1000小车" x:Name="Reset1000" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Reset1000}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="187,190,513,370" Click="Button_Click_4"/>
<Button Content="手动停止800任务" x:Name="ManualStop800Task" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=ManualStop800Task}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="604,51,83,509" Click="Button_Click_5" RenderTransformOrigin="0.504,0.511"/>
<Button Content="手动清除800报警" x:Name="ManualClear800Error" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=ManualClear800Error}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="604,121,83,439" Click="Button_Click_6"/>
<Button Content="手动停止1000任务" x:Name="ManualStop1000Task" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=ManualStop1000Task}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="604,190,83,370" Click="Button_Click_7"/>
<Button Content="测试按钮" x:Name="TestButton" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=TestButton}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="54,204,646,356" />
<Button Content="开始AGV状态刷新" x:Name="StartAGVStateRefresh" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=StartAGVStateRefresh}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="Green" BorderBrush="#FF36B5C1" Margin="39,298,631,262" />
<Button Content="结束AGV状态刷新" x:Name="StopAGVStateRefresh" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=StopAGVStateRefresh}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="Green" BorderBrush="#FF36B5C1" Margin="39,361,631,199" />
<Button Content="开始任务状态刷新" x:Name="StartTaskRefresh" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name, ElementName=StartTaskRefresh}" Style="{StaticResource BUTTON_AGREE}" Height="30" Background="Green" BorderBrush="#FF36B5C1" Margin="201,298,469,262" />

@ -56,6 +56,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
private ILogger<VisionBusiness> _visionBusinessLogger;
private IAirportTaskService _taskservice;
private IAGVStateService _agvstateService;
private IAGVSettingService _aGVSettingService;
private IAGVMapPointService _agvmapPointService;
private IAGVJobService _agvJobService;
private IVisionSettingService _visionSettingService;
@ -86,9 +87,9 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
_airPorthttpClient = App.ServiceProvider.GetService<AirPorthttpClient>();
_visionBusiness = VisionBusiness.GetInstance(_visionBusinessLogger, _tcpServer, _taskservice, _visionSettingService, _agvstateService, _agvJobService);
_baseAGVBusiness = BaseAGVBusiness.GetInstance(_AGVBusinessLogger, _airPorthttpClient, _agvstateService, _agvmapPointService, _appConfig);
_baseAGVBusiness = BaseAGVBusiness.GetInstance(_AGVBusinessLogger, _airPorthttpClient, _agvstateService, _agvmapPointService, _appConfig, _agvJobService, _aGVSettingService);
_taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger,
_taskservice, _agvstateService, _agvmapPointService, _agvJobService,
_taskservice, _agvstateService, _agvmapPointService, _agvJobService, _visionSettingService,
_tcpServer, _airPorthttpClient, _baseAGVBusiness, _visionBusiness);
_taskInfoBusiness._RefreshLogMessageAction += RefreshLogMessage;
_taskInfoBusiness._Taskaction += task =>

@ -4,6 +4,7 @@ using HslCommunication.Enthernet;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SlnMesnac.Business.@base;
using SlnMesnac.Business.util;
using SlnMesnac.Config;
using SlnMesnac.Model.AirportApiEntity;
using SlnMesnac.Model.dto;
@ -124,9 +125,9 @@ namespace SlnMesnac.WPF.ViewModel
_tcpServer = App.ServiceProvider.GetService<TcpServer>();
_airPorthttpClient = App.ServiceProvider.GetService<AirPorthttpClient>();
_baseTaskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_BaseTaskInfoBusinesslogger,
_Taskservice, _AGVStateService, _AGVMapPointService, _agvJobService,
_Taskservice, _AGVStateService, _AGVMapPointService, _agvJobService, _visionSettingService,
_tcpServer, _airPorthttpClient, _baseAGVBusiness, _visionBusiness);
_baseAGVBusiness = BaseAGVBusiness.GetInstance(_baseAGVBusinessLogger, _airPorthttpClient, _AGVStateService, _AGVMapPointService, _appConfig);
_baseAGVBusiness = BaseAGVBusiness.GetInstance(_baseAGVBusinessLogger, _airPorthttpClient, _AGVStateService, _AGVMapPointService, _appConfig, _agvJobService, _AGVSettingService);
_visionBusiness = VisionBusiness.GetInstance(_VisionBusinessLogger, _tcpServer, _Taskservice, _visionSettingService, _AGVStateService, _agvJobService);
_baseStateRefreshBusiness = BaseStateRefreshBusiness.GetInstance(_StateRefreshBusinessLogger, _AGVStateService, _airPorthttpClient, _AGVSettingService);
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
@ -175,61 +176,10 @@ namespace SlnMesnac.WPF.ViewModel
break;
}
break;
// 最小化当前窗口
case "Minimized":
Application.Current.MainWindow.WindowState = WindowState.Minimized;
break;
case "DeliverNeedPosition":
//AMR就绪请求视觉初步开始工作
_visionBusiness.TotalJudge = true;
_visionBusiness.RequestVisionStartWork(StackState.NXAGVNeedPositioning, 0, _tcpServer.VID);
break;
case "AMRNeedPosition":
//AMR就绪请求无定向AMR开始工作
_visionBusiness.TotalJudge = true;
_visionBusiness.RequestVisionStartWork(StackState.NXAMRNeedPositioning, 0, _tcpServer.VID);
break;
case "DeilverNoPosition":
//AMR就绪请求无定向AGV开始工作
_visionBusiness.TotalJudge = true;
_visionBusiness.RequestVisionStartWork(StackState.NXAGVNoPositioning, 0, _tcpServer.VID);
break;
case "AMRNoPosition":
//AMR就绪请求无定向AMR开始工作
_visionBusiness.TotalJudge = true;
_visionBusiness.RequestVisionStartWork(StackState.NXAMRNoPositioning, 0, _tcpServer.VID);
break;
case "VisionEnd":
//码垛结束,请求视觉系统复位
_visionBusiness.RequestVisionReplace(_tcpServer.VID);
break;
case "Get800":
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(_appConfig.AGVConfig.Where(x => x.AGVName == "S800-B").First().AGVGUID, "800小车进入位置任务pause");
break;
case "Out800":
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(_appConfig.AGVConfig.Where(x => x.AGVName == "S800-B").First().AGVGUID, "800小车入库任务pause");
break;
case "Get1000":
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(_appConfig.AGVConfig.Where(x => x.AGVName == "S1000-A").First().AGVGUID, "1000小车进入位置任务pause");
break;
case "Out1000":
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(_appConfig.AGVConfig.Where(x => x.AGVName == "S1000-A").First().AGVGUID, "1000小车入库任务pause");
break;
case "Reset1000":
_baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(_appConfig.AGVConfig.Where(x => x.AGVName == "S1000-A").First().AGVGUID, "1000校正模板");
break;
case "ManualStop800Task":
//手动停止任务
_baseAGVBusiness.EndTaskAndClearError("S800-B");
break;
case "ManualClear800Error":
//手动清除报警
_baseAGVBusiness.ClaerError("S800-B");
break;
case "ManualStop1000Task":
_baseAGVBusiness.EndTaskAndClearError("S1000-A");
break;
case "StartAGVStateRefresh":
_baseStateRefreshBusiness.AGVStateUpdateTimerOperation(TimerControl.Start);
break;
@ -256,36 +206,14 @@ namespace SlnMesnac.WPF.ViewModel
}
}
/// <summary>
/// 停止所有任务和事件
/// </summary>
public void StopAllTaskActionInvoke()
{
taskControl.StopTaskAction = () =>
{
List<AirportTask> taskList = _Taskservice.GetTaskInfos(x => x.taskstate == "抓取中" && x.taskstate == "派车中").ToList();
//任务状态设置为已终止并且机械臂复位
foreach (var taskInfo in taskList)
{
_visionBusiness.RequestVisionReplace(_visionSettingService.GetVisionSettingByAMRGUID(taskInfo.amragvno).VisionID);
taskInfo.visiontaskno = null;
taskInfo.amragvisarrive = null;
taskInfo.amragvno = null;
taskInfo.deliveragvno = null;
taskInfo.deliveragvisarrive = null;
taskInfo.finishtime = DateTime.Now;
taskInfo.taskstate = "已终止";
_logger.LogInformation($"任务 [{taskInfo.taskno}] 已终止");
}
//agv全部停止
var responseList = _airPorthttpClient.AGVAllStateRequest();
foreach (var response in responseList.Data)
{
if (!string.IsNullOrEmpty(response.TaskID) && response.AgvMoveStatus != 1 && response.AgvMoveStatus != 3)
{
_baseAGVBusiness.EndTaskAndClearError(response.Guid);
_logger.LogInformation($"小车 [{response.Name}] 任务已终止");
}
}
_logger.LogInformation($"全部复位完毕");
_baseTaskInfoBusiness.StopAllTask();
};
}
@ -296,7 +224,7 @@ namespace SlnMesnac.WPF.ViewModel
{
try
{
string info = obj as string;
string? info = obj as string;
switch (info)
{
case "Index":
@ -315,4 +243,6 @@ namespace SlnMesnac.WPF.ViewModel
}
}
}

Loading…
Cancel
Save