add - 添加数据库表,区分DeliverAGV和AMRAGV(运输小车和机械臂小车)

master
SoulStar 4 months ago
parent 38ed1f0a4d
commit 44881027dc

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Business.@base
{
public class BaseAGVBusiness
{
}
}

@ -30,7 +30,11 @@ namespace SlnMesnac.Business.@base
return instance; return instance;
} }
public bool UpdateAGVStateByResposne() /// <summary>
/// 调用接口更新所有AGV的状态
/// </summary>
/// <returns></returns>
public bool UpdateALLAGVStateByResposne()
{ {
try try
{ {

@ -14,6 +14,8 @@ using SlnMesnac.Model.Enum;
using HslCommunication.Enthernet; using HslCommunication.Enthernet;
using System.Threading; using System.Threading;
using SlnMesnac.TouchSocket.Entity; using SlnMesnac.TouchSocket.Entity;
using SlnMesnac.Model.AirportApiEntity;
using System.Linq;
namespace SlnMesnac.Business.@base namespace SlnMesnac.Business.@base
{ {
@ -26,7 +28,13 @@ namespace SlnMesnac.Business.@base
private ILogger<BaseTaskInfoBusiness> _logger; private ILogger<BaseTaskInfoBusiness> _logger;
private IAirportTaskService _Taskservice; private IAirportTaskService _Taskservice;
private IAGVStateService _AGVStateService; private IAGVStateService _AGVStateService;
public BaseTaskInfoBusiness(ILogger<BaseTaskInfoBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer) private AirPorthttpClient _airpttpClient;
public BaseTaskInfoBusiness(
ILogger<BaseTaskInfoBusiness> logger,
IAirportTaskService Taskservice,
IAGVStateService agvService,
TcpServer tcpServer,
AirPorthttpClient airPorthttpClient)
{ {
_logger = logger; _logger = logger;
_tcpServer = tcpServer; _tcpServer = tcpServer;
@ -34,9 +42,45 @@ namespace SlnMesnac.Business.@base
_tcpServer.ReceiveStackWorkDoneEvent += _tcpServer_StackWorkDoneEvent; _tcpServer.ReceiveStackWorkDoneEvent += _tcpServer_StackWorkDoneEvent;
_Taskservice = Taskservice; _Taskservice = Taskservice;
_AGVStateService = agvService; _AGVStateService = agvService;
_airpttpClient = airPorthttpClient;
InitClearTimer(); InitClearTimer();
//doWhileGetAGVTaskInfo(); //doWhileGetAGVTaskInfo();
} }
public static BaseTaskInfoBusiness GetInstance(
ILogger<BaseTaskInfoBusiness> logger,
IAirportTaskService Taskservice,
IAGVStateService agvService,
TcpServer tcpServer,
AirPorthttpClient airPorthttpClient)
{
if (instance == null)
{
instance = new BaseTaskInfoBusiness(logger, Taskservice, agvService, tcpServer, airPorthttpClient);
}
return instance;
}
/// <summary>
/// 调用接口更新指定的任务状态
/// </summary>
/// <param name="request"></param>
public void RefreshTaskStateForResopnse(AGVRequestTaskStateDetailEntity request)
{
AGVResponseEntity<ResponseTaskStateDetailDataEntity> response = _airpttpClient.AGVGetTaskStateDetailRequest(request);
if (response.code == 1)
{
_logger.LogError("返回错误:" + response.message);
return;
}
if (response.code == 0)
{
AirportTask record = new AirportTask();
List<AirportTask> list = _Taskservice.GetTaskInfos();
//list.Where(x => x.taskno == response.Data
}
}
/// <summary> /// <summary>
/// 一次码垛完成,发送码垛结果 /// 一次码垛完成,发送码垛结果
/// </summary> /// </summary>
@ -102,15 +146,6 @@ namespace SlnMesnac.Business.@base
} }
} }
public static BaseTaskInfoBusiness GetInstance(ILogger<BaseTaskInfoBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer)
{
if (instance == null)
{
instance = new BaseTaskInfoBusiness(logger, Taskservice,agvService, tcpServer);
}
return instance;
}
private void doWhileGetAGVTaskInfo() private void doWhileGetAGVTaskInfo()
{ {
try try
@ -160,7 +195,7 @@ namespace SlnMesnac.Business.@base
foreach (var TaskItem in Task) foreach (var TaskItem in Task)
{ {
//AGV未派发AMR未派发 //AGV未派发AMR未派发
if (string.IsNullOrEmpty(TaskItem.agvno) && string.IsNullOrEmpty(TaskItem.manipulatorno)) if (string.IsNullOrEmpty(TaskItem.deliveragvno) && string.IsNullOrEmpty(TaskItem.amragvno))
{ {
_RefreshLogMessageAction?.Invoke($"正在为AGVAMR分配任务..."); _RefreshLogMessageAction?.Invoke($"正在为AGVAMR分配任务...");
_logger.LogInformation($"正在为AGVAMR分配任务"); _logger.LogInformation($"正在为AGVAMR分配任务");
@ -170,7 +205,7 @@ namespace SlnMesnac.Business.@base
//查询机械臂状态 //查询机械臂状态
} }
//AGV已派发AMR未派发 //AGV已派发AMR未派发
if (!string.IsNullOrEmpty(TaskItem.agvno) && string.IsNullOrEmpty(TaskItem.manipulatorno)) if (!string.IsNullOrEmpty(TaskItem.deliveragvno) && string.IsNullOrEmpty(TaskItem.amragvno))
{ {
//查询AMR状态 //查询AMR状态
CreateAMRTask(TaskItem); CreateAMRTask(TaskItem);
@ -179,7 +214,7 @@ namespace SlnMesnac.Business.@base
_logger.LogInformation($"正在为AMR分配任务"); _logger.LogInformation($"正在为AMR分配任务");
} }
//AGV未派发AMR已派发 //AGV未派发AMR已派发
if (string.IsNullOrEmpty(TaskItem.agvno) && !string.IsNullOrEmpty(TaskItem.manipulatorno)) if (string.IsNullOrEmpty(TaskItem.deliveragvno) && !string.IsNullOrEmpty(TaskItem.amragvno))
{ {
_RefreshLogMessageAction?.Invoke($"正在为AGV分配任务..."); _RefreshLogMessageAction?.Invoke($"正在为AGV分配任务...");
@ -232,7 +267,7 @@ namespace SlnMesnac.Business.@base
_AGVStateService.UpdateAsync(AgvItem); _AGVStateService.UpdateAsync(AgvItem);
//更新任务信息表状态为执行中 //更新任务信息表状态为执行中
AirportTask.manipulatorno = AgvItem.agvno; AirportTask.amragvno = AgvItem.agvno;
AirportTask.taskstate = "执行中"; AirportTask.taskstate = "执行中";
_Taskservice.UpdateTaskAsync(AirportTask); _Taskservice.UpdateTaskAsync(AirportTask);
break; break;
@ -257,7 +292,7 @@ namespace SlnMesnac.Business.@base
try try
{ {
iflag = true; iflag = true;
List<AGVState> State = GetAgvState(AgvType.AGV); List<AGVState> State = GetAgvState(AgvType.Deliver);
foreach (var AgvItem in State) foreach (var AgvItem in State)
{ {
//根据规则筛选最优AGV //根据规则筛选最优AGV
@ -276,7 +311,7 @@ namespace SlnMesnac.Business.@base
_AGVStateService.UpdateAsync(AgvItem); _AGVStateService.UpdateAsync(AgvItem);
//更新任务信息表状态为执行中 //更新任务信息表状态为执行中
AirportTask.agvno = AgvItem.agvno; AirportTask.deliveragvno = AgvItem.agvno;
AirportTask.taskstate = "执行中"; AirportTask.taskstate = "执行中";
_Taskservice.UpdateTaskAsync(AirportTask); _Taskservice.UpdateTaskAsync(AirportTask);
break; break;
@ -290,6 +325,7 @@ namespace SlnMesnac.Business.@base
return iflag; return iflag;
} }
} }
/// <summary> /// <summary>
/// 获取agv设备状态 /// 获取agv设备状态
/// </summary> /// </summary>

@ -6,7 +6,7 @@ namespace SlnMesnac.Model.Enum
{ {
public enum AgvType public enum AgvType
{ {
AGV = 1, Deliver = 1,
AMR = 2, AMR = 2,
} }
} }

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.domain
{
/// <summary>
/// AGV已激活地图点位表
/// </summary>
public class AGVMapPoint
{
/// <summary>
/// 自增编号
/// </summary>
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
/// <summary>
/// 地图ID
/// </summary>
public string MapID { get; set; }
/// <summary>
/// 点位ID
/// </summary>
public string PointGuid { get; set; }
/// <summary>
/// 位置点类型 0普通 1⾼精度 2充电桩 3闲置点
/// </summary>
public string? PointType { get; set; }
/// <summary>
/// 点位名称
/// </summary>
public string? PointName { get; set; }
/// <summary>
/// 地图名称
/// </summary>
public string? MapName { get; set; }
}
}

@ -18,7 +18,7 @@ namespace SlnMesnac.Model.domain
public string AGVNo { get; set; } public string AGVNo { get; set; }
/// <summary> /// <summary>
/// AGV类型 /// AGV类型 1DeliverAGV 2: AMRAGV
/// </summary> /// </summary>
public string AGVType { get; set; } public string AGVType { get; set; }
} }

@ -11,10 +11,6 @@ namespace SlnMesnac.Repository
[SugarTable("AGVState")] [SugarTable("AGVState")]
public partial class AGVState public partial class AGVState
{ {
public AGVState(){
}
/// <summary> /// <summary>
/// Desc: /// Desc:
/// Default: /// Default:
@ -32,7 +28,7 @@ namespace SlnMesnac.Repository
public string agvno {get;set;} public string agvno {get;set;}
/// <summary> /// <summary>
/// Desc:AGV类型 1AMR 2: 机械臂 /// Desc:AGV类型 1DeliverAGV 2: AMRAGV
/// Default: /// Default:
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>

@ -11,7 +11,8 @@ namespace SlnMesnac.Repository
[SugarTable("AirportTask")] [SugarTable("AirportTask")]
public partial class AirportTask public partial class AirportTask
{ {
public AirportTask(){ public AirportTask()
{
} }
@ -24,7 +25,7 @@ namespace SlnMesnac.Repository
public int id { get; set; } public int id { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:任务编号
/// Default: /// Default:
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
@ -32,7 +33,7 @@ namespace SlnMesnac.Repository
public string taskno { get; set; } public string taskno { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:传送带编号
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
@ -40,7 +41,7 @@ namespace SlnMesnac.Repository
public string conveyorno { get; set; } public string conveyorno { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:航班编号
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
@ -48,39 +49,39 @@ namespace SlnMesnac.Repository
public string flightno { get; set; } public string flightno { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:AMRAGV编号
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName="ManipulatorNo")] [SugarColumn(ColumnName = "AMRAGVNo")]
public string manipulatorno {get;set;} public string amragvno { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:AMRAGV是否到达
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName="ManipulatorAGVIsArrive")] [SugarColumn(ColumnName = "AMRAGVIsArrive")]
public string manipulatoragvisarrive {get;set;} public string amragvisarrive { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:搬运AGV编号
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName="AGVNo")] [SugarColumn(ColumnName = "DeliverAGVNo")]
public string agvno {get;set;} public string deliveragvno { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:搬运AGV是否到达
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName="AGVIsArrive")] [SugarColumn(ColumnName = "DeliverAGVIsArrive")]
public string agvisarrive {get;set;} public string deliveragvisarrive { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:总数量
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
@ -88,7 +89,7 @@ namespace SlnMesnac.Repository
public int? totalcount { get; set; } public int? totalcount { get; set; }
/// <summary> /// <summary>
/// Desc: /// Desc:已装载数量
/// Default: /// Default:
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
@ -119,5 +120,16 @@ namespace SlnMesnac.Repository
[SugarColumn(ColumnName = "FinishTime")] [SugarColumn(ColumnName = "FinishTime")]
public DateTime? finishtime { get; set; } public DateTime? finishtime { get; set; }
/// <summary>
/// 运载小车任务编号
/// </summary>
[SugarColumn(ColumnName = "DeliverAGVTaskNo")]
public string deliveragvTaskNo { get; set; }
/// <summary>
/// 机械臂小车任务编号
/// </summary>
[SugarColumn(ColumnName = "AMRAGVTaskNo")]
public string amragvTaskNo { get; set; }
} }
} }

@ -15,7 +15,7 @@ namespace SlnMesnac.Model.domain
/// <summary> /// <summary>
/// 机械臂编号 /// 机械臂编号
/// </summary> /// </summary>
public string ManipulatorNo { get; set; } public string amragvno { get; set; }
/// <summary> /// <summary>
/// 任务编号 /// 任务编号

@ -15,7 +15,7 @@ namespace SlnMesnac.Model.domain
/// <summary> /// <summary>
/// 机械臂编号 /// 机械臂编号
/// </summary> /// </summary>
public string ManipulatorNo { get; set; } public string amragvno { get; set; }
/// <summary> /// <summary>
/// 机械臂所属AGV编号 /// 机械臂所属AGV编号

@ -15,7 +15,7 @@ namespace SlnMesnac.Model.domain
/// <summary> /// <summary>
/// 机械臂编号 /// 机械臂编号
/// </summary> /// </summary>
public string ManipulatorNo { get; set; } public string amragvno { get; set; }
/// <summary> /// <summary>
/// 任务编号 /// 任务编号

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.domain
{
public class VisionTask
{
/// <summary>
/// 自增编号
/// </summary>
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
/// <summary>
/// 视觉任务编号
/// </summary>
public string? VisionTaskID { get; set; }
/// <summary>
/// 总数量
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// 已抓取数量
/// </summary>
public int LoadedCount { get; set; }
/// <summary>
/// 刷新时间
/// </summary>
public DateTime? RefreshTime { get; set; }
/// <summary>
/// 所属总任务编号
/// </summary>
public string? AirportTaskID { get; set; }
}
}

@ -0,0 +1,18 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Model.Enum;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service
{
public interface IAGVSettingService : IBaseService<AGVSetting>
{
/// <summary>
/// 查询所有AGV状态
/// </summary>
/// <returns></returns>
List<AGVSetting> GetAllAgvSetting();
}
}

@ -10,17 +10,17 @@ namespace SlnMesnac.Repository.service
public interface IAirportTaskService : IBaseService<AirportTask> public interface IAirportTaskService : IBaseService<AirportTask>
{ {
/// <summary> /// <summary>
/// 锟斤拷取站台锟斤拷锟斤拷锟叫憋拷 /// 获取所有任务信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<AirportTask> GetTaskInfos(); List<AirportTask> GetTaskInfos();
/// <summary> /// <summary>
/// 锟斤拷取锟斤拷执锟斤拷锟斤拷锟斤拷锟叫憋拷 /// 获取AGV任务信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<AirportTask> GetAGVTaskInfos(); List<AirportTask> GetAGVTaskInfos();
/// <summary> /// <summary>
/// 根据站台号查询任务列表 /// 根据站台号查询任务列表
/// </summary> /// </summary>
@ -28,22 +28,21 @@ namespace SlnMesnac.Repository.service
Task<List<AirportTask>> GetTaskInfoListAsync(string ConveyorNo); Task<List<AirportTask>> GetTaskInfoListAsync(string ConveyorNo);
/// <summary> /// <summary>
/// 锟斤拷锟斤拷锟斤拷锟斤拷锟叫憋拷 /// 更新任务信息
/// </summary> /// </summary>
/// <param name="record"></param> /// <param name="record"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateTaskAsync(AirportTask record); Task<bool> UpdateTaskAsync(AirportTask record);
/// <summary> /// <summary>
/// 新增任务 /// 新增任务信息
/// </summary> /// </summary>
/// <param name="record"></param> /// <param name="record"></param>
/// <returns></returns> /// <returns></returns>
Task<bool> AddTaskAsync(AirportTask record); Task<bool> AddTaskAsync(AirportTask record);
/// <summary> /// <summary>
/// 删除任务 /// 删除任务信息
/// </summary> /// </summary>
/// <param name="record"></param> /// <param name="record"></param>
/// <returns></returns> /// <returns></returns>

@ -0,0 +1,32 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class AGVSettingServiceImpl : BaseServiceImpl<AGVSetting>, IAGVSettingService
{
private ILogger<AGVSettingServiceImpl> _logger;
public AGVSettingServiceImpl(Repository<AGVSetting> repository, ILogger<AGVSettingServiceImpl> logger) : base(repository)
{
_logger = logger;
}
public List<AGVSetting> GetAllAgvSetting()
{
List<AGVSetting> agvSettingList = null;
try
{
agvSettingList = base._rep.GetList();
}
catch (Exception ex)
{
_logger.LogError($"所有AGV设置获取错误:{ex.Message}");
}
return agvSettingList;
}
}
}

@ -19,6 +19,7 @@ namespace SlnMesnac.Repository.service.Impl
{ {
_logger = logger; _logger = logger;
} }
public List<AGVState> GetAgvState(AgvType AgvType) public List<AGVState> GetAgvState(AgvType AgvType)
{ {
string _AgvType = Convert.ToString(((int)AgvType).ToString()); string _AgvType = Convert.ToString(((int)AgvType).ToString());
@ -62,6 +63,11 @@ namespace SlnMesnac.Repository.service.Impl
return result; return result;
} }
/// <summary>
/// 根据响应数据更新AGV状态
/// </summary>
/// <param name="response"></param>
/// <returns></returns>
public async Task<bool> UpdateOrAddByResponse(AGVResponseEntity<List<ResponseRobotAtrributeDataEntity>> response) public async Task<bool> UpdateOrAddByResponse(AGVResponseEntity<List<ResponseRobotAtrributeDataEntity>> response)
{ {
List<AGVState> records = new List<AGVState>(); List<AGVState> records = new List<AGVState>();

@ -51,7 +51,7 @@ namespace SlnMesnac.Repository.service.Impl
List<AirportTask> taskInfos = null; List<AirportTask> taskInfos = null;
try try
{ {
String sql = "SELECT id,ConveyorNo,TaskNo,FlightNo,AGVNo,MAX(StartTime) as StartTime,TaskState, TotalCount ,LoadCount FROM AirportTask group by ConveyorNo "; 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<AirportTask>(sql); taskInfos = base._rep.AsTenant().GetConnection("AGV").Ado.SqlQuery<AirportTask>(sql);
} }
catch (Exception ex) catch (Exception ex)
@ -70,7 +70,7 @@ namespace SlnMesnac.Repository.service.Impl
List<AirportTask> taskInfos = null; List<AirportTask> taskInfos = null;
try try
{ {
String sql = "select *from ( SELECT id, ConveyorNo,TaskNo,FlightNo,AGVNo,ManipulatorNo,MAX(StartTime) as StartTime,TaskState, TotalCount ,LoadCount FROM AirportTask group by ConveyorNo )"; string sql = "select *from ( SELECT id, ConveyorNo,TaskNo,FlightNo,DeliverAGVNo, amragvno,MAX(StartTime) as StartTime,TaskState, TotalCount ,LoadCount FROM AirportTask group by ConveyorNo )";
taskInfos = base._rep.AsTenant().GetConnection("AGV").Ado.SqlQuery<AirportTask>(sql); taskInfos = base._rep.AsTenant().GetConnection("AGV").Ado.SqlQuery<AirportTask>(sql);
} }
catch (Exception ex) catch (Exception ex)
@ -99,6 +99,7 @@ namespace SlnMesnac.Repository.service.Impl
bool result = await _rep.InsertAsync(record); bool result = await _rep.InsertAsync(record);
return result; return result;
} }
public async Task<bool> DeleteTaskAsync(AirportTask record) public async Task<bool> DeleteTaskAsync(AirportTask record)
{ {
bool iFlag = await _rep.DeleteAsync(record); bool iFlag = await _rep.DeleteAsync(record);

@ -86,7 +86,7 @@
<DataGridTextColumn Binding="{Binding taskno}" Header="任务编号" Width="*"/> <DataGridTextColumn Binding="{Binding taskno}" Header="任务编号" Width="*"/>
<DataGridTextColumn Binding="{Binding flightno}" Header="航班号" Width="*"/> <DataGridTextColumn Binding="{Binding flightno}" Header="航班号" Width="*"/>
<DataGridTextColumn Binding="{Binding agvno}" Header="AGV" Width="0.6*"/> <DataGridTextColumn Binding="{Binding agvno}" Header="AGV" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding manipulatorno}" Header="AMR" Width="0.6*"/> <DataGridTextColumn Binding="{Binding amragvno}" Header="AMR" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding taskstate}" Header="任务状态" Width="*"/> <DataGridTextColumn Binding="{Binding taskstate}" Header="任务状态" Width="*"/>
<DataGridTextColumn Binding="{Binding totalcount}" Header="总抓取数量" Width="*"/> <DataGridTextColumn Binding="{Binding totalcount}" Header="总抓取数量" Width="*"/>
<DataGridTextColumn Binding="{Binding loadcount}" Header="已抓取数量" Width="*"/> <DataGridTextColumn Binding="{Binding loadcount}" Header="已抓取数量" Width="*"/>

@ -58,6 +58,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
private DispatcherTimer _timer; private DispatcherTimer _timer;
private TcpServer _tcpServer; private TcpServer _tcpServer;
private AppConfig _appConfig; private AppConfig _appConfig;
private AirPorthttpClient _airPorthttpClient;
public IndexContentViewModel() public IndexContentViewModel()
{ {
@ -67,8 +68,9 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
_agvstateService = App.ServiceProvider.GetService<IAGVStateService>(); _agvstateService = App.ServiceProvider.GetService<IAGVStateService>();
_tcpServer = App.ServiceProvider.GetService<TcpServer>(); _tcpServer = App.ServiceProvider.GetService<TcpServer>();
_appConfig = App.ServiceProvider.GetService<AppConfig>(); _appConfig = App.ServiceProvider.GetService<AppConfig>();
_airPorthttpClient = App.ServiceProvider.GetService<AirPorthttpClient>();
_taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger, _taskservice, _agvstateService, _tcpServer); _taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger, _taskservice, _agvstateService, _tcpServer, _airPorthttpClient);
_taskInfoBusiness._RefreshLogMessageAction += RefreshLogMessage; _taskInfoBusiness._RefreshLogMessageAction += RefreshLogMessage;
_taskInfoBusiness._Taskaction += task => _taskInfoBusiness._Taskaction += task =>
{ {
@ -80,8 +82,8 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
x.id = task.id; x.id = task.id;
x.taskno = task.taskno; x.taskno = task.taskno;
x.flightno = task.flightno; x.flightno = task.flightno;
x.manipulatorno = task.manipulatorno; x.amragvno = task.amragvno;
x.agvno = task.agvno; x.deliveragvno = task.deliveragvno;
x.taskstate = task.taskstate; x.taskstate = task.taskstate;
TaskItems = new ObservableCollection<AirportTask>(TaskItems); TaskItems = new ObservableCollection<AirportTask>(TaskItems);
@ -117,7 +119,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
//_StateRefreshBusiness.UpdateManipulatorStateByResposne( //_StateRefreshBusiness.UpdateManipulatorStateByResposne(
// new Model.AirportApiEntity.ManipulatorStateRequestEntity() // new Model.AirportApiEntity.ManipulatorStateRequestEntity()
// { ManipulatorNo = "1", SignalSendTime = DateTime.Now.ToString()}); // { amragvno = "1", SignalSendTime = DateTime.Now.ToString()});
//List<AirportTask> AirportTaskItem = _taskservice.GetTaskInfos(); //List<AirportTask> AirportTaskItem = _taskservice.GetTaskInfos();
//TaskItems = new ObservableCollection<AirportTask>(AirportTaskItem); //TaskItems = new ObservableCollection<AirportTask>(AirportTaskItem);
// TaskItems = new ObservableCollection<AirportTask> // TaskItems = new ObservableCollection<AirportTask>
@ -180,10 +182,10 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
{ {
foreach (var VARIABLE in TaskItems) foreach (var VARIABLE in TaskItems)
{ {
if (VARIABLE.agvno == airportTask.conveyorno) if (VARIABLE.deliveragvno == airportTask.conveyorno)
{ {
VARIABLE.taskstate = airportTask.taskstate; VARIABLE.taskstate = airportTask.taskstate;
VARIABLE.agvno = airportTask.agvno; VARIABLE.deliveragvno = airportTask.deliveragvno;
VARIABLE.totalcount = airportTask.totalcount; VARIABLE.totalcount = airportTask.totalcount;
VARIABLE.loadcount = airportTask.loadcount; VARIABLE.loadcount = airportTask.loadcount;
} }
@ -317,8 +319,8 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
x.id = task.id; x.id = task.id;
x.taskno = task.taskno; x.taskno = task.taskno;
x.flightno = task.flightno; x.flightno = task.flightno;
x.manipulatorno = task.manipulatorno; x.amragvno = task.amragvno;
x.agvno = task.agvno; x.deliveragvno = task.deliveragvno;
x.taskstate = task.taskstate; x.taskstate = task.taskstate;
TaskItems = new ObservableCollection<AirportTask>(TaskItems); TaskItems = new ObservableCollection<AirportTask>(TaskItems);
} }

@ -25,6 +25,7 @@ namespace SlnMesnac.WPF.ViewModel
private readonly GenerateControl generateControl = new GenerateControl(); private readonly GenerateControl generateControl = new GenerateControl();
private IndexContent indexContent = new IndexContent(); private IndexContent indexContent = new IndexContent();
private AppConfig _appConfig; private AppConfig _appConfig;
private AirPorthttpClient _airPorthttpClient;
#region 参数定义 #region 参数定义
/// <summary> /// <summary>
@ -95,7 +96,8 @@ namespace SlnMesnac.WPF.ViewModel
_AGVStateService = App.ServiceProvider.GetService<IAGVStateService>(); _AGVStateService = App.ServiceProvider.GetService<IAGVStateService>();
_BaseTaskInfoBusinesslogger = App.ServiceProvider.GetService<ILogger<BaseTaskInfoBusiness>>(); _BaseTaskInfoBusinesslogger = App.ServiceProvider.GetService<ILogger<BaseTaskInfoBusiness>>();
_tcpServer = App.ServiceProvider.GetService<TcpServer>(); _tcpServer = App.ServiceProvider.GetService<TcpServer>();
BaseTaskInfoBusiness.GetInstance(_BaseTaskInfoBusinesslogger, _Taskservice, _AGVStateService, _tcpServer); _airPorthttpClient = App.ServiceProvider.GetService<AirPorthttpClient>();
BaseTaskInfoBusiness.GetInstance(_BaseTaskInfoBusinesslogger, _Taskservice, _AGVStateService, _tcpServer, _airPorthttpClient);
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj)); ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
FormControlCommand = new RelayCommand<object>(x => FormControl(x)); FormControlCommand = new RelayCommand<object>(x => FormControl(x));
_tcpServer.RefreshStateAction+= (_clientIP, _state) => _tcpServer.RefreshStateAction+= (_clientIP, _state) =>

Loading…
Cancel
Save