diff --git a/SlnMesnac.Business/base/BaseAGVBusiness.cs b/SlnMesnac.Business/base/BaseAGVBusiness.cs
index acfce19..e53d27e 100644
--- a/SlnMesnac.Business/base/BaseAGVBusiness.cs
+++ b/SlnMesnac.Business/base/BaseAGVBusiness.cs
@@ -252,10 +252,10 @@ namespace SlnMesnac.Business.@base
try
{
//终止小车当前任务
- result = EndTaskAndClearError(agvguid);//////////////////////////////////////////////////////////////////还没改完///////////////////////////////////////////////////////////////
- var param = _appConfig.JobConfig.Where(x => x.JobGUID == jobGuid).First();
+ result = EndTaskAndClearError(agvguid);
+ var param = _AGVJobService.GetAGVJobByJobGuid(jobGuid);
//调用小车到抓取位置
- return DownloadTask(agvguid, jobGuid, param.PointGUID, param.PointParamName);
+ return DownloadTask(agvguid, jobGuid, param.PointGuid, param.PointParamName);
}
catch (Exception ex)
{
@@ -371,9 +371,8 @@ namespace SlnMesnac.Business.@base
}
}
-
///
- /// 入库所有满载AGV
+ /// 入库所有即将满载AGV
///
public void ClearFullAGV()
{
@@ -382,7 +381,7 @@ namespace SlnMesnac.Business.@base
var list = _AGVStateService.GetAgvState(AgvType.Deliver);
foreach (var record in list)
{
- if (record.stackcount >= BaseTaskInfoBusiness.DeliverStackNumber && record.agvworkstate == "待机")
+ if (record.stackcount >= BaseTaskInfoBusiness.DeliverStackNumber - 2 && record.agvworkstate == "待机")
{
//入库代码
EndTaskAndClearErrorAndDownloadTask(record.agvno,
@@ -394,7 +393,7 @@ namespace SlnMesnac.Business.@base
list = _AGVStateService.GetAgvState(AgvType.AMR);
foreach (var record in list)
{
- if (record.stackcount >= BaseTaskInfoBusiness.AMRStackNumber && record.agvworkstate == "待机")
+ if (record.stackcount >= BaseTaskInfoBusiness.AMRStackNumber - 2 && record.agvworkstate == "待机")
{
//入库代码
EndTaskAndClearErrorAndDownloadTask(record.agvno,
@@ -410,5 +409,17 @@ namespace SlnMesnac.Business.@base
}
}
+ ///
+ /// 下载AGV模板和点位到数据库
+ ///
+ public bool DownloadAgvJob()
+ {
+ List joblist = new List();
+
+
+
+
+ return false;
+ }
}
}
diff --git a/SlnMesnac.Config/AppConfig.cs b/SlnMesnac.Config/AppConfig.cs
index 4dc8c16..c383e63 100644
--- a/SlnMesnac.Config/AppConfig.cs
+++ b/SlnMesnac.Config/AppConfig.cs
@@ -29,64 +29,39 @@ namespace SlnMesnac.Config
///
/// 系统配置
///
- #pragma warning disable CS8618 // Non-nullable field 'Data' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
+#pragma warning disable CS8618 // Non-nullable field 'Data' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
public class AppConfig : IOptions
{
///
/// 日志文件路径
///
public string logPath { get; set; }
-
+
///
/// Sql连接配置
///
public List sqlConfig { get; set; }
-
+
///
/// PLC连接配置
///
public List plcConfig { get; set; }
-
+
///
/// RFID连接配置
///
public List rfidConfig { get; set; }
-
- ///
- /// 视觉机械臂连接配置
- ///
- public List visionConfig { get; set; }
-
- ///
- /// AGV配置
- ///
- public List AGVConfig { get; set; }
-
- ///
- /// 地图点位配置
- ///
- public List PositionConfig { get; set; }
-
///
- /// 模板配置
+ /// AGVC服务器IP
///
- public List JobConfig { get; set; }
-
-
-
+ public string AGVCIpConfig { get; set; }
///
/// Redis配置
///
public string redisConfig { get; set; }
- ///
- /// AMR
- ///
-
- public string AMRIP { get; set; }
-
///
/// AGV地址配置
///
diff --git a/SlnMesnac.Repository/service/IAGVJobService.cs b/SlnMesnac.Repository/service/IAGVJobService.cs
index 3c10ab7..ce1ec76 100644
--- a/SlnMesnac.Repository/service/IAGVJobService.cs
+++ b/SlnMesnac.Repository/service/IAGVJobService.cs
@@ -14,6 +14,12 @@ namespace SlnMesnac.Repository.service
///
List GetAGVJobList();
+ ///
+ /// AGVGuid获取Job
+ ///
+ ///
+ ///
+ AGVJob GetAGVJobByJobGuid(string guid);
///
/// 根据模板类型获取对应的AGV模板列表
diff --git a/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs b/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs
index fd97676..de2a411 100644
--- a/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs
+++ b/SlnMesnac.Repository/service/Impl/AGVJobServiceImpl.cs
@@ -19,6 +19,24 @@ namespace SlnMesnac.Repository.service.Impl
_logger = logger;
}
+ public AGVJob GetAGVJobByJobGuid(string guid)
+ {
+ try
+ {
+ var list = _rep.GetList(x => x.JobGuid == guid).FirstOrDefault();
+ if (list == null)
+ {
+ return new AGVJob();
+ }
+ return list;
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError($"获取列表发生错误: {ex.Message}");
+ return new AGVJob();
+ }
+ }
+
public List GetAGVJobList()
{
try
diff --git a/SlnMesnac.TouchSocket/AirPorthttpClient.cs b/SlnMesnac.TouchSocket/AirPorthttpClient.cs
index 8f3d53b..6e13d6e 100644
--- a/SlnMesnac.TouchSocket/AirPorthttpClient.cs
+++ b/SlnMesnac.TouchSocket/AirPorthttpClient.cs
@@ -31,7 +31,7 @@ namespace SlnMesnac.TouchSocket
private readonly AppConfig _appConfig;
private readonly ILogger _logger;
private System.Net.Http.HttpClient _httpClient;
- public string Url = "http://192.168.10.199:5102";
+ public string Url;
public AirPorthttpClient(AppConfig appConfig, ILogger logger)
{
@@ -58,6 +58,8 @@ namespace SlnMesnac.TouchSocket
public void init()
{
+ Url = _appConfig.AGVIpConfig;
+
_httpClient = new HttpClient();
}
@@ -328,6 +330,15 @@ namespace SlnMesnac.TouchSocket
}
}
+ /////
+ ///// AGV入库接口
+ /////
+ /////
+ //public bool AGVInStore(string agvGuid)
+ //{
+
+ //}
+
/////
///// 获取当前所有任务模板信息(目前不可用)
/////
diff --git a/SlnMesnac.TouchSocket/AirportTcpServer.cs b/SlnMesnac.TouchSocket/AirportTcpServer.cs
deleted file mode 100644
index 784afc4..0000000
--- a/SlnMesnac.TouchSocket/AirportTcpServer.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Hosting;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace SlnMesnac.TouchSocket
-{
- public class AirportTcpServer : BackgroundService
- {
- protected override Task ExecuteAsync(CancellationToken stoppingToken)
- {
- return Task.CompletedTask;
- }
-
-
- }
-}
diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs
index f294450..f9398ba 100644
--- a/SlnMesnac.TouchSocket/ApiServer.cs
+++ b/SlnMesnac.TouchSocket/ApiServer.cs
@@ -33,14 +33,14 @@ namespace SlnMesnac.TouchSocket
{
public ApiServer()
{
-
+ AgvInStoreEvent += OnAGVArrival;
}
- public delegate void AGVArrivalStart(string message, AGVSingalEntity aGVArrivalSingalEntity);
+ public delegate void AGVInStoreDelegate(string agvGuid);
///
/// AGV到位信号刷新
///
- public event AGVArrivalStart AGVArrivalStartEvent;
+ public event AGVInStoreDelegate AgvInStoreEvent;
///
/// AGV到位信号接口
@@ -48,24 +48,25 @@ namespace SlnMesnac.TouchSocket
///
///
[EnableCors("cors")]
- [WebApi(HttpMethodType.POST)]
- public object AGVSignal(string messageHeader, AGVSingalEntity aGVArrivalSingalEntity)
+ [WebApi(HttpMethodType.GET)]
+ public object AGVInStoreSignal(string agvGuid)
{
- AGVArrivalStartEvent?.Invoke(messageHeader, aGVArrivalSingalEntity);
+ AgvInStoreEvent?.Invoke(agvGuid);
return "Success";
}
public void SubscribeToAGVArrivalEvent()
{
- // 订阅 AGV 到位事件
- AGVArrivalStartEvent += OnAGVArrival;
+ // 订阅事件
+ AgvInStoreEvent += OnAGVArrival;
}
// 处理 AGV 到位事件的方法
- public void OnAGVArrival(string message, AGVSingalEntity aGVArrivalSingalEntity)
+ public void OnAGVArrival(string agvGuid)
{
- Console.WriteLine($"收到AGV到位信号: {message}");
- Console.WriteLine($"AGV编号: {aGVArrivalSingalEntity.AGVNo}, 到达位置: {aGVArrivalSingalEntity.DestinationNo}");
+
+
+
// 这里可以处理更多的业务逻辑,比如记录日志、更新系统状态等
}
diff --git a/SlnMesnac.TouchSocket/TcpServer.cs b/SlnMesnac.TouchSocket/TcpServer.cs
index 6ee4ed4..104f08b 100644
--- a/SlnMesnac.TouchSocket/TcpServer.cs
+++ b/SlnMesnac.TouchSocket/TcpServer.cs
@@ -55,8 +55,6 @@ namespace SlnMesnac.TouchSocket
public delegate void RefreshClientInfo(TcpService tcpService);
public event RefreshClientInfo? RefreshClientInfoEvent;
- public Action RefreshStateAction;
-
public delegate void GetVisionData(TcpVisionEntity entity, string id);
///
@@ -108,7 +106,6 @@ namespace SlnMesnac.TouchSocket
{
_logger.LogInformation($"客户端{client.IP}:{client.Port}接入服务成功");
RefreshClientInfoEvent?.Invoke(_service);
- RefreshStateAction?.Invoke(client.IP, true);
client.ResetId(client.IP);
TestClientID = client.IP;
VID = client.IP;
@@ -117,7 +114,6 @@ namespace SlnMesnac.TouchSocket
_service.Disconnected = (client, e) =>
{
_logger.LogInformation($"客户端{client.IP}:{client.Port}断开连接");
- RefreshStateAction?.Invoke(client.IP, false);
RefreshClientInfoEvent?.Invoke(_service);
return EasyTask.CompletedTask;
};
diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml
index 7a0ad7f..8d60430 100644
--- a/SlnMesnac.WPF/MainWindow.xaml
+++ b/SlnMesnac.WPF/MainWindow.xaml
@@ -6,9 +6,9 @@
xmlns:local="clr-namespace:SlnMesnac.WPF"
mc:Ignorable="d"
Title="MainWindow" Height="1080" Width="1920"
- WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" Topmost="False">
+ WindowState="Normal" WindowStyle="SingleBorderWindow" ResizeMode="NoResize" Topmost="False">
-
+
@@ -24,42 +24,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
@@ -68,115 +48,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
@@ -187,13 +67,13 @@
-
-
-
-
-
-
-
- -->
-
-
-
-
diff --git a/SlnMesnac.WPF/Page/IndexPage/IndexContent.xaml b/SlnMesnac.WPF/Page/IndexPage/IndexContent.xaml
index 54cc212..6e75502 100644
--- a/SlnMesnac.WPF/Page/IndexPage/IndexContent.xaml
+++ b/SlnMesnac.WPF/Page/IndexPage/IndexContent.xaml
@@ -40,10 +40,7 @@
-
-
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -86,120 +72,60 @@
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -213,17 +139,18 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/SlnMesnac.WPF/SlnMesnac.WPF.csproj b/SlnMesnac.WPF/SlnMesnac.WPF.csproj
index 6de51f1..b46500e 100644
--- a/SlnMesnac.WPF/SlnMesnac.WPF.csproj
+++ b/SlnMesnac.WPF/SlnMesnac.WPF.csproj
@@ -9,6 +9,7 @@
+
@@ -20,6 +21,7 @@
+
@@ -53,4 +55,10 @@
+
+
+ Always
+
+
+
diff --git a/SlnMesnac.WPF/Startup.cs b/SlnMesnac.WPF/Startup.cs
index c7c727b..871605c 100644
--- a/SlnMesnac.WPF/Startup.cs
+++ b/SlnMesnac.WPF/Startup.cs
@@ -45,8 +45,8 @@ namespace SlnMesnac.WPF
//注册PLC工厂
services.AddPlcFactorySetup();
- //注册httpClient
- //services.AddHostedService();
+ //注册ApiServer
+ //services.AddHostedService();
//注册TCPServer
//services.AddHostedService();
diff --git a/SlnMesnac.WPF/Templates/image/background.png b/SlnMesnac.WPF/Templates/image/background.png
new file mode 100644
index 0000000..f7c3417
Binary files /dev/null and b/SlnMesnac.WPF/Templates/image/background.png differ
diff --git a/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs
index 78b2773..f648a0e 100644
--- a/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs
+++ b/SlnMesnac.WPF/ViewModel/IndexPage/IndexContentViewModel.cs
@@ -194,19 +194,12 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
+
///
- /// 机械臂复位,停止所有任务,复位所有小车
+ /// 未知刷新类
///
- public void StopAllTask()
- {
- //机械臂复位
-
- //所有任务设置为已终止
-
- //所有小车任务结束
- }
-
+ ///
public async void RefreshTaskItems(AirportTask airportTask)
{
try
@@ -230,16 +223,20 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
}
+
#region 参数定义
+
///
/// 任务列表
///
private ObservableCollection _taskItems = new ObservableCollection();
+
public ObservableCollection TaskItems
{
get => _taskItems;
set => SetProperty(ref _taskItems, value);
}
+
///
/// 日志信息
///
@@ -250,10 +247,12 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
get => _logMessages;
set => SetProperty(ref _logMessages, value);
}
+
///
/// 日期时间
///
private DateTime _currentDateTime;
+
public DateTime CurrentDateTime
{
get => _currentDateTime;
@@ -265,15 +264,18 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
}
}
+
///
/// 航班信息
///
private ObservableCollection _flightItems = new ObservableCollection();
+
public ObservableCollection FlightItems
{
get => _flightItems;
set => SetProperty(ref _flightItems, value);
}
+
#endregion
///
@@ -301,6 +303,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
}
+
///
/// 系统运行日志输出
///
@@ -332,6 +335,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
});
}
+
///
/// 添加任务
///
@@ -415,22 +419,13 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
}
}
- ///
- /// 手动呼叫
- ///
- [RelayCommand]
- private void ManualCall()
- {
- MessageBox.Show("手动呼叫");
- }
-
///
/// 手动终止
///
[RelayCommand]
private void ManualTerminate()
{
- MessageBox.Show("手动终止");
+ MessageBox.Show("入库");
}
///
@@ -439,7 +434,8 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
[RelayCommand]
private void Reset()
{
- MessageBox.Show("复位");
+ MessageBox.Show("终止成功");
+
}
}
diff --git a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs
index f0f5145..2868bd5 100644
--- a/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs
+++ b/SlnMesnac.WPF/ViewModel/MainWindowViewModel.cs
@@ -37,6 +37,7 @@ namespace SlnMesnac.WPF.ViewModel
private IAGVJobService _agvJobService;
private IVisionSettingService _visionSettingService;
private TcpServer _tcpServer;
+ private ApiServer _apiServer;
//代码生成
private readonly GenerateControl generateControl = new GenerateControl();
private IndexContent indexContent = new IndexContent();
@@ -130,17 +131,13 @@ namespace SlnMesnac.WPF.ViewModel
_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);
+ _apiServer = new ApiServer();
+
ControlOnClickCommand = new RelayCommand