From 35118ff75d09100bd2f0952e81bc8608144cb835 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Wed, 30 Oct 2024 17:53:58 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E6=B7=BB=E5=8A=A0=E6=9C=BA=E6=A2=B0?= =?UTF-8?q?=E8=87=82=E8=81=94=E5=92=8CAGV=E8=87=AA=E5=8A=A8=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E4=BB=BB=E5=8A=A1=E5=85=A8=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A4=A7=E8=87=B4=E5=86=99=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Business/base/BaseAGVBusiness.cs | 2 +- SlnMesnac.Business/base/VisionBusiness.cs | 287 +++++++++++++++++- ...ManipulatorSetting.cs => VisionSetting.cs} | 10 +- .../service/IAirportTaskService.cs | 7 + .../service/IVisionSettingService.cs | 38 +++ .../service/Impl/AGVJobServiceImpl.cs | 4 +- .../service/Impl/AGVStateServiceImpl.cs | 3 +- .../service/Impl/AirportTaskServiceImpl.cs | 20 ++ .../service/Impl/VisionSettingServiceImpl.cs | 71 +++++ .../IndexPage/IndexContentViewModel.cs | 4 +- .../ViewModel/MainWindowViewModel.cs | 4 +- 11 files changed, 425 insertions(+), 25 deletions(-) rename SlnMesnac.Model/domain/{ManipulatorSetting.cs => VisionSetting.cs} (66%) create mode 100644 SlnMesnac.Repository/service/IVisionSettingService.cs create mode 100644 SlnMesnac.Repository/service/Impl/VisionSettingServiceImpl.cs diff --git a/SlnMesnac.Business/base/BaseAGVBusiness.cs b/SlnMesnac.Business/base/BaseAGVBusiness.cs index ff890ff..92a48d3 100644 --- a/SlnMesnac.Business/base/BaseAGVBusiness.cs +++ b/SlnMesnac.Business/base/BaseAGVBusiness.cs @@ -332,7 +332,7 @@ namespace SlnMesnac.Business.@base { return null; } - int min = lists.Min(x => x.stackcount); + int min = lists.Min(x => x.stackcount); //小车不可能是满的还空闲 AGVState agv = lists.Where(x => x.stackcount == min).FirstOrDefault(); //var list = _AGVStateService return agv; diff --git a/SlnMesnac.Business/base/VisionBusiness.cs b/SlnMesnac.Business/base/VisionBusiness.cs index 45956f3..1c85e6e 100644 --- a/SlnMesnac.Business/base/VisionBusiness.cs +++ b/SlnMesnac.Business/base/VisionBusiness.cs @@ -1,10 +1,16 @@ using Microsoft.Extensions.Logging; +using SlnMesnac.Model.domain; +using SlnMesnac.Model.Enum; +using SlnMesnac.Repository; using SlnMesnac.Repository.service; using SlnMesnac.TouchSocket; using SlnMesnac.TouchSocket.Entity; using System; using System.Collections.Generic; +using System.Linq; using System.Text; +using System.Threading.Tasks; +using System.Transactions; namespace SlnMesnac.Business.@base { @@ -17,14 +23,20 @@ namespace SlnMesnac.Business.@base private static VisionBusiness instance; private TcpServer _tcpServer; private IAirportTaskService _airportTaskService; + private IVisionSettingService _visionSettingService; + private IAGVStateService _aGVStateService; + private IAGVJobService _AGVJobService; private BaseAGVBusiness _baseAGVBusiness; - public VisionBusiness(ILogger logger, TcpServer tcpServer, IAirportTaskService airportTaskService) + public VisionBusiness(ILogger logger, TcpServer tcpServer, IAirportTaskService airportTaskService, IVisionSettingService visionSettingService, IAGVStateService aGVStateService, IAGVJobService aGVJobService) { _logger = logger; _tcpServer = tcpServer; _airportTaskService = airportTaskService; + _visionSettingService = visionSettingService; + _aGVStateService = aGVStateService; + _AGVJobService = aGVJobService; //视觉系统回复状态 _tcpServer.ReceiveVisionSysStateEvent += VisionStateRequest; @@ -32,17 +44,19 @@ namespace SlnMesnac.Business.@base _tcpServer.ReceiveVisionStartWorkEvent += GetVisionWorkState; //视觉系统通知一次码垛完成结果 _tcpServer.ReceiveStackWorkDoneEvent += StackResultSend; + //_tcpServer.ReceiveStackWorkDoneEvent += AutoStackResultSend; //视觉系统通知人工异常处理完成 _tcpServer.ReceiveManualExceptionDealDoneEvent += GetManualExceptionDealDone; //视觉系统回复复位结果 _tcpServer.ReceiveStackRobotResetEvent += GetResetResult; + _AGVJobService = aGVJobService; } - public static VisionBusiness GetInstance(ILogger logger, TcpServer tcpServer, IAirportTaskService airportTaskService) + public static VisionBusiness GetInstance(ILogger logger, TcpServer tcpServer, IAirportTaskService airportTaskService, IVisionSettingService visionSettingService, IAGVStateService aGVStateService, IAGVJobService aGVJobService) { if (instance == null) { - instance = new VisionBusiness(logger, tcpServer, airportTaskService); + instance = new VisionBusiness(logger, tcpServer, airportTaskService, visionSettingService, aGVStateService, aGVJobService); } return instance; } @@ -107,6 +121,262 @@ namespace SlnMesnac.Business.@base } } + /// + /// 收到堆筐请求 + /// + /// + /// + /// + public void AutoStackResultSend(TcpVisionEntity entity, string id) + { + if (entity.DataLength == 1) + { + if (entity.DataBytes[0] == 0x00) + { + _logger.LogInformation($"视觉系统一次码垛结束,码垛完成 Deliver:{VDCount} AMR:{VACount}"); + //上位机回复收到码垛结果 + _tcpServer.SendReplayStackResult(id); + VisionSetting record = _visionSettingService.GetList(x => x.VisionID == id).ToList().First(); + AirportTask airportTask = _airportTaskService.GetTaskInfos(x => x.amragvno == record.AMRGUID && + x.visiontaskno == (BitConverter.ToInt16(entity.SN, 0) - 1).ToString() && x.taskstate == "抓取中").First(); + //成功码垛先码垛计数 + StackCount(airportTask, entity.DataBytes[1]); + //////////////下面是下一次码垛的综合判断条件////////////// + //先判断总数是否需要继续工作 + if (airportTask.totalcount > airportTask.loadcount) + { + //如上一次是AMR 如有Deliver 判断是否到达 到达向deliver发送开始工作,没就判断amr是否装满 继续向amr + //上一次是AMR + if (entity.DataBytes[1] == 0x01) + { + //妹有Deliver的任务(小车号和是否已到达都没有)amr肯定能抓完 继续amr抓取 + if (string.IsNullOrEmpty(airportTask.deliveragvno) && string.IsNullOrEmpty(airportTask.deliveragvisarrive)) + { + //一直向amr抓,直到抓满 + RequestVisionStartWork(StackState.AMRNoPositioning, id); + } + //有Delievr任务(有任务号且状态为未到达)继续amr抓取 + else if (!string.IsNullOrEmpty(airportTask.deliveragvno) && airportTask.deliveragvisarrive == "未到达") + { + //判断AMR小车是否装满,没满就开装,满了就结束,开始循环判断deliver是否到达 + //amr没满 继续装amr + if (_aGVStateService.GetSingleAGVState(airportTask.amragvno).stackcount < BaseTaskInfoBusiness.AMRStackNumber) + { + RequestVisionStartWork(StackState.AMRNoPositioning, id); + } + //AMR满了 + else + { + AirportTask task; + //结束抓取、循环判断deliver是否到达,到了就向新的Deliver开始抓取 + Task.Run(() => + { + //请求复位 + RequestVisionReplace(id); + while (true) + { + //循环判断该任务的deliver是否到达 + Task.Delay(1000); + task = _airportTaskService.GetTaskInfos(x => x.amragvno == record.AMRGUID && x.taskstate == "抓取中").First(); + if (task.deliveragvisarrive == "已到达") + { + RequestVisionStartWork(StackState.AGVNeedPositioning, id); + break; + } + } + }); + } + } + //有Deliver任务(有任务号且已到达)向Deliver发送开始抓取 + else if (!string.IsNullOrEmpty(airportTask.deliveragvno) && airportTask.deliveragvisarrive == "已到达") + { + RequestVisionStartWork(StackState.AGVNeedPositioning, id); + } + //异常情况 + else + { + throw new Exception($"任务 {airportTask.taskno} 状态异常!请清除任务并重新下发任务!"); + } + } + //如上一次是deliver-->则判断deliver是否装满-->装满则deliver入库-->判断剩下的数量用不用调新的deliver-->用就调新的deliver然后发向amr抓取(还得判断AMR是否抓满)-->不用就直接向amr抓取 + //上一次是Deliver + else if (entity.DataBytes[1] == 0x00) + { + //判断Deliver是否装满,装满就直接入库,未装满继续装 + //deliver没满,继续装 + if (_aGVStateService.GetSingleAGVState(airportTask.deliveragvno).stackcount < BaseTaskInfoBusiness.DeliverStackNumber) + { + RequestVisionStartWork(StackState.AGVNoPositioning, id); + } + //deliver满了,入库然后判断 + else + { + //入库代码 + _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(airportTask.deliveragvno, + _AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", airportTask.conveyorno).JobName); + airportTask.deliveragvno = null; + airportTask.deliveragvisarrive = null; + _airportTaskService.UpdateTaskAsync(airportTask); + //判断剩下的数量用不用调用新的deliver + //剩下的数量不用 直接向amr抓取 + int amrleft = BaseTaskInfoBusiness.AMRStackNumber - _aGVStateService.GetSingleAGVState(airportTask.amragvno).stackcount; + if (airportTask.totalcount - airportTask.loadcount < amrleft) + { + RequestVisionStartWork(StackState.AMRNeedPositioning, id); + } + //剩下的数量需要调用,并判断向AMR抓取 + else + { + //调新的deliver + AGVState newagv = _baseAGVBusiness.GetBestAGV(AgvType.Deliver); + _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(newagv.agvno, + _AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入位", airportTask.conveyorno).JobName); + airportTask.deliveragvno = newagv.agvno; + airportTask.deliveragvisarrive = "未到达"; + _airportTaskService.UpdateTaskAsync(airportTask); + //amr无容量,结束抓取,等待Deliver到达 + if (amrleft == 0) + { + AirportTask task; + //结束抓取、循环判断deliver是否到达,到了就向新的Deliver开始抓取 + Task.Run(() => + { + //请求复位 + RequestVisionReplace(id); + while (true) + { + //循环判断该任务的deliver是否到达 + Task.Delay(1000); + task = _airportTaskService.GetTaskInfos(x => x.amragvno == record.AMRGUID && x.taskstate == "抓取中").First(); + if (task.deliveragvisarrive == "已到达") + { + RequestVisionStartWork(StackState.AGVNeedPositioning, id); + break; + } + } + }); + } + //amr有容量,抓 + else + { + RequestVisionStartWork(StackState.AMRNeedPositioning, id); + } + } + } + } + //未知代码 + else + { + throw new Exception($"任务 {airportTask.taskno} 未知上次码垛代码!请检查视觉系统状态!"); + } + } + //总数达标,结束任务,复位机械臂,调回小车,任务状态调整 + else + { + _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(airportTask.amragvno, + _AGVJobService.GetAGVJobListByTypeAndConveyorNo("1000入库", airportTask.conveyorno).JobName); + airportTask.amragvno = null; + airportTask.amragvisarrive = null; + airportTask.visiontaskno = null; + if (!string.IsNullOrEmpty(airportTask.deliveragvno)) + { + _baseAGVBusiness.EndTaskAndClearErrorAndDownloadTask(airportTask.deliveragvno, + _AGVJobService.GetAGVJobListByTypeAndConveyorNo("800入库", airportTask.conveyorno).JobName); + airportTask.deliveragvno = null; + airportTask.deliveragvisarrive = null; + } + airportTask.finishtime = DateTime.Now; + airportTask.taskstate = "已完成"; + _airportTaskService.UpdateTaskAsync(airportTask); + } + } + //码垛过程失败 + else if (entity.DataBytes[0] == 0x01) + { + _logger.LogError($"视觉系统一次码垛结束,码垛过程失败,重新发送码垛信号"); + if (entity.DataBytes[1] == 0x01) + { + //发送向复合机器人(AMR)码垛的信号 + RequestVisionStartWork(StackState.AMRNoPositioning, id); + _logger.LogInformation("下一次码垛开始,方向:复合机器人"); + } + else if (entity.DataBytes[1] == 0x00) + { + //发送向搬运机器人(AGVDeliver)码垛的信号 + RequestVisionStartWork(StackState.AGVNoPositioning, id); + _logger.LogInformation("下一次码垛开始,方向:搬运机器人"); + } + else + { + _logger.LogError($"码垛失败返回未知码垛结果代码,请手动重新发送码垛信号"); + } + } + //码垛检查失败 + else if (entity.DataBytes[0] == 0x02) + { + _logger.LogError($"视觉系统一次码垛结束,码垛检查失败,请手动矫正并手动开始下一次码垛"); + //仍然要码垛计数,只是筐码的不准 + VisionSetting record = _visionSettingService.GetList(x => x.VisionID == id).ToList().First(); + AirportTask airportTask = _airportTaskService.GetTaskInfos(x => x.amragvno == record.AMRGUID && + x.visiontaskno == (BitConverter.ToInt16(entity.SN, 0) - 1).ToString() && x.taskstate == "抓取中").First(); + StackCount(airportTask, entity.DataBytes[1]); + } + //未知代码 + else + { + _logger.LogError($"视觉系统一次码垛结束,未知返回代码!请检查视觉系统状态!"); + throw new Exception($"视觉系统 {id }一次码垛结束,未知返回代码!请检查视觉系统状态!"); + } + } + //数据格式错误 + else + { + _logger.LogError($"视觉系统一次码垛结束,返回数据格式错误,请检查视觉系统状态!"); + } + } + + public void StackCount(AirportTask airportTask, byte lastCount) + { + //AMR码垛计数 + if (lastCount == 0x01) + { + airportTask.loadcount++; + AGVState aGVState = _aGVStateService.GetSingleAGVState(airportTask.amragvno); + aGVState.stackcount++; + //判断返回结果 + if (_aGVStateService.UpdateAsync(aGVState).Result || _airportTaskService.UpdateTaskAsync(airportTask).Result) + { + _logger.LogInformation($"计数更新成功 {airportTask.amragvno} AMR: {aGVState.stackcount} Total: {airportTask.loadcount}"); + } + else + { + _logger.LogError("计数更新失败!"); + throw new Exception("计数更新失败!"); + } + } + //Deliver码垛计数 + else if (lastCount == 0x00) + { + airportTask.loadcount++; + AGVState aGVState = _aGVStateService.GetSingleAGVState(airportTask.deliveragvno); + aGVState.stackcount++; + //判断返回结果 + if (_aGVStateService.UpdateAsync(aGVState).Result || _airportTaskService.UpdateTaskAsync(airportTask).Result) + { + _logger.LogInformation($"计数更新成功 {airportTask.amragvno} AMR: {aGVState.stackcount} Total: {airportTask.loadcount}"); + } + else + { + _logger.LogError("计数更新失败!"); + throw new Exception("计数更新失败!"); + } + } + else + { + throw new Exception($"任务 {airportTask.taskno} 未知上次码垛代码!请检查视觉系统状态!"); + } + } + int VDCount = 1; int VACount = 0; int VDTotal = 8; @@ -127,16 +397,7 @@ namespace SlnMesnac.Business.@base //上位机回复收到码垛结果 _tcpServer.SendReplayStackResult(id); //这里写是否继续下一次码垛的判断条件 - - //判断总数是否继续工作 - if (true) - { - - } - //如有Deliver 判断是否到达 到达向deliver发送开始工作 - - //如上一次是deliver-->则判断deliver是否装满-->装满则deliver入库-->判断剩下的数量用不用调新的deliver-->用就调新的deliver然后发向amr抓取-->不用就直接向amr抓取 if ((VDCount < VDTotal && Vjudge == true && TotalJudge == true) || (VACount < VATotal && Vjudge == false && TotalJudge == true)) { //如果码垛没结束继续发下一次的码垛信号 @@ -209,7 +470,7 @@ namespace SlnMesnac.Business.@base /// public void GetResetResult(TcpVisionEntity entity, string id) { - if(entity.DataLength == 0x01) + if (entity.DataLength == 0x01) { if (entity.DataBytes[0] == 0x00) { diff --git a/SlnMesnac.Model/domain/ManipulatorSetting.cs b/SlnMesnac.Model/domain/VisionSetting.cs similarity index 66% rename from SlnMesnac.Model/domain/ManipulatorSetting.cs rename to SlnMesnac.Model/domain/VisionSetting.cs index 2e38320..46eb8ba 100644 --- a/SlnMesnac.Model/domain/ManipulatorSetting.cs +++ b/SlnMesnac.Model/domain/VisionSetting.cs @@ -4,7 +4,7 @@ using System.Text; namespace SlnMesnac.Model.domain { - public class ManipulatorSetting + public class VisionSetting { /// /// 自增编号 @@ -13,14 +13,14 @@ namespace SlnMesnac.Model.domain public int ID { get; set; } /// - /// 机械臂编号 + /// 视觉编号 /// - public string amragvno { get; set; } + public string VisionID { get; set; } /// - /// 机械臂所属AGV编号 + /// 机械臂所属AMR编号 /// - public string RelatedAGVNo { get; set; } + public string AMRGUID { get; set; } } } diff --git a/SlnMesnac.Repository/service/IAirportTaskService.cs b/SlnMesnac.Repository/service/IAirportTaskService.cs index c665cb6..d7a6927 100644 --- a/SlnMesnac.Repository/service/IAirportTaskService.cs +++ b/SlnMesnac.Repository/service/IAirportTaskService.cs @@ -2,6 +2,7 @@ using SlnMesnac.Model.domain; using SlnMesnac.Repository.service.@base; using System; using System.Collections.Generic; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; @@ -15,6 +16,12 @@ namespace SlnMesnac.Repository.service /// List GetTaskInfos(); + /// + /// ȡϢ + /// + /// + List GetTaskInfos(Expression> expression); + /// /// ȡAGVϢ /// diff --git a/SlnMesnac.Repository/service/IVisionSettingService.cs b/SlnMesnac.Repository/service/IVisionSettingService.cs new file mode 100644 index 0000000..bf68584 --- /dev/null +++ b/SlnMesnac.Repository/service/IVisionSettingService.cs @@ -0,0 +1,38 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text; + +namespace SlnMesnac.Repository.service +{ + public interface IVisionSettingService : IBaseService + { + /// + /// 获取视觉配置列表 + /// + /// + List GetList(); + + /// + /// 获取视觉配置列表 + /// + /// + List GetList(Expression> expression); + + /// + /// 根据ID获取单条视觉配置 + /// + /// + /// + VisionSetting GetVisionSettingByID(string id); + + /// + /// 根据AMRGUID获取单条视觉配置 + /// + /// + /// + VisionSetting GetVisionSettingByAMRGUID(string guid); + } +} diff --git a/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs b/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs index c9a7c25..f7c4ec8 100644 --- a/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs +++ b/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs @@ -34,7 +34,7 @@ namespace SlnMesnac.Repository.service.Impl { try { - var list = _rep.GetList().Where(x => x.JobType == jobType).ToList(); + var list = _rep.GetList(x => x.JobType == jobType).ToList(); return list; } catch (Exception ex) @@ -48,7 +48,7 @@ namespace SlnMesnac.Repository.service.Impl { try { - AGVJob record = GetAGVJobListByJobType(jobType).Where(x => x.ConveyorNo == conveyorno).First(); + AGVJob record = _rep.GetList(x => x.ConveyorNo == conveyorno && x.JobType == jobType).First(); return record; } catch (Exception ex) diff --git a/SlnMesnac.Repository/service/Impl/AGVStateServiceImpl.cs b/SlnMesnac.Repository/service/Impl/AGVStateServiceImpl.cs index 20c1c20..89de1d5 100644 --- a/SlnMesnac.Repository/service/Impl/AGVStateServiceImpl.cs +++ b/SlnMesnac.Repository/service/Impl/AGVStateServiceImpl.cs @@ -138,8 +138,7 @@ namespace SlnMesnac.Repository.service.Impl { try { - var lists = GetAllAGVState(); - return lists.Where(x => x.agvno == AGVguid).First(); + return _rep.GetList(x => x.agvno == AGVguid).First(); } catch (Exception ex) { diff --git a/SlnMesnac.Repository/service/Impl/AirportTaskServiceImpl.cs b/SlnMesnac.Repository/service/Impl/AirportTaskServiceImpl.cs index d8b0000..04adb9a 100644 --- a/SlnMesnac.Repository/service/Impl/AirportTaskServiceImpl.cs +++ b/SlnMesnac.Repository/service/Impl/AirportTaskServiceImpl.cs @@ -62,6 +62,26 @@ namespace SlnMesnac.Repository.service.Impl return taskInfos; } + /// + /// 获取所有的任务信息 + /// + /// + public List GetTaskInfos(Expression> expression) + { + List taskInfos = null; + try + { + //string sql = "SELECT id,ConveyorNo,TaskNo,FlightNo,DeliverAGVNo, MAX(StartTime) as StartTime,TaskState, TotalCount ,LoadCount FROM AirportTask group by ConveyorNo "; + //taskInfos = base._rep.AsTenant().GetConnection("AGV").Ado.SqlQuery(sql); + taskInfos = _rep.GetList(expression); + } + catch (Exception ex) + { + _logger.LogError($"获取任务信息异常:{ex.Message}"); + } + return taskInfos; + } + /// /// 获取AGV任务信息 /// diff --git a/SlnMesnac.Repository/service/Impl/VisionSettingServiceImpl.cs b/SlnMesnac.Repository/service/Impl/VisionSettingServiceImpl.cs new file mode 100644 index 0000000..ec1f407 --- /dev/null +++ b/SlnMesnac.Repository/service/Impl/VisionSettingServiceImpl.cs @@ -0,0 +1,71 @@ +using Microsoft.Extensions.Logging; +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text; + +namespace SlnMesnac.Repository.service.Impl +{ + public class VisionSettingServiceImpl : BaseServiceImpl, IVisionSettingService + { + private ILogger _logger; + public VisionSettingServiceImpl(Repository repository, ILogger logger) : base(repository) + { + _logger = logger; + } + + public List GetList() + { + try + { + return _rep.GetList(); + } + catch (Exception ex) + { + _logger.LogError($"获取视觉配置列表错误"); + return null; + } + } + + public List GetList(Expression> expression) + { + try + { + return _rep.GetList(expression); + } + catch (Exception ex) + { + _logger.LogError($"获取视觉配置列表错误"); + return null; + } + } + + public VisionSetting GetVisionSettingByAMRGUID(string guid) + { + try + { + return _rep.GetSingle(x => x.AMRGUID == guid); + } + catch(Exception ex) + { + _logger.LogError($"根据AMRGUID获取视觉配置错误"); + return null; + } + } + + public VisionSetting GetVisionSettingByID(string id) + { + try + { + return _rep.GetSingle(x => x.VisionID == id); + } + catch (Exception ex) + { + _logger.LogError($"根据VisionID获取视觉配置错误"); + return null; + } + } + } +} diff --git a/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs index db86a68..3ffed62 100644 --- a/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs @@ -58,6 +58,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage private IAGVStateService _agvstateService; private IAGVMapPointService _agvmapPointService; private IAGVJobService _agvJobService; + private IVisionSettingService _visionSettingService; private BaseTaskInfoBusiness _taskInfoBusiness; private BaseStateRefreshBusiness _StateRefreshBusiness; private BaseAGVBusiness _baseAGVBusiness; @@ -79,11 +80,12 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage _agvmapPointService = App.ServiceProvider.GetService(); _agvstateService = App.ServiceProvider.GetService(); _agvJobService = App.ServiceProvider.GetService(); + _visionSettingService = App.ServiceProvider.GetService(); _tcpServer = App.ServiceProvider.GetService(); _appConfig = App.ServiceProvider.GetService(); _airPorthttpClient = App.ServiceProvider.GetService(); - _visionBusiness = VisionBusiness.GetInstance(_visionBusinessLogger, _tcpServer, _taskservice); + _visionBusiness = VisionBusiness.GetInstance(_visionBusinessLogger, _tcpServer, _taskservice, _visionSettingService, _agvstateService, _agvJobService); _baseAGVBusiness = BaseAGVBusiness.GetInstance(_AGVBusinessLogger, _airPorthttpClient, _agvstateService, _agvmapPointService, _appConfig); _taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger, _taskservice, _agvstateService, _agvmapPointService, _agvJobService, diff --git a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs index 6b21488..c432ff3 100644 --- a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs @@ -32,6 +32,7 @@ namespace SlnMesnac.WPF.ViewModel private IAGVMapPointService _AGVMapPointService; private IAGVSettingService _AGVSettingService; private IAGVJobService _agvJobService; + private IVisionSettingService _visionSettingService; private TcpServer _tcpServer; //代码生成 private readonly GenerateControl generateControl = new GenerateControl(); @@ -116,13 +117,14 @@ namespace SlnMesnac.WPF.ViewModel _AGVMapPointService = App.ServiceProvider.GetService(); _AGVSettingService = App.ServiceProvider.GetService(); _agvJobService = App.ServiceProvider.GetService(); + _visionSettingService = App.ServiceProvider.GetService(); _tcpServer = App.ServiceProvider.GetService(); _airPorthttpClient = App.ServiceProvider.GetService(); _baseTaskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_BaseTaskInfoBusinesslogger, _Taskservice, _AGVStateService, _AGVMapPointService, _agvJobService, _tcpServer, _airPorthttpClient, _baseAGVBusiness, _visionBusiness); _baseAGVBusiness = BaseAGVBusiness.GetInstance(_baseAGVBusinessLogger, _airPorthttpClient, _AGVStateService, _AGVMapPointService, _appConfig); - _visionBusiness = VisionBusiness.GetInstance(_VisionBusinessLogger, _tcpServer, _Taskservice); + _visionBusiness = VisionBusiness.GetInstance(_VisionBusinessLogger, _tcpServer, _Taskservice, _visionSettingService, _AGVStateService, _agvJobService); _baseStateRefreshBusiness = BaseStateRefreshBusiness.GetInstance(_StateRefreshBusinessLogger, _AGVStateService, _airPorthttpClient, _AGVSettingService); ControlOnClickCommand = new RelayCommand(obj => ControlOnClick(obj)); FormControlCommand = new RelayCommand(x => FormControl(x));