master
CaesarBao 3 months ago
parent d46e20ede0
commit 63540f27e8

@ -1,16 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SlnMesnac.Business.Airport
{
public class AirPortBusiness
{
}
}

@ -1,52 +0,0 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.AirportApiEntity;
using SlnMesnac.Repository.service;
using SlnMesnac.TouchSocket;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Business.@base
{
public class BaseStateRefreshBusiness
{
private IAGVStateService _AGVStateService;
private ILogger<BaseStateRefreshBusiness> _logger;
private static BaseStateRefreshBusiness instance;
private AirPorthttpClient _airPorthttpClient;
public BaseStateRefreshBusiness(ILogger<BaseStateRefreshBusiness> logger, IAGVStateService agvService, AirPorthttpClient airPorthttpClient)
{
_logger = logger;
_AGVStateService = agvService;
_airPorthttpClient = airPorthttpClient;
}
public static BaseStateRefreshBusiness GetInstance(ILogger<BaseStateRefreshBusiness> logger, IAGVStateService agvService, AirPorthttpClient airPorthttpClient)
{
if (instance == null)
{
instance = new BaseStateRefreshBusiness(logger, agvService, airPorthttpClient);
}
return instance;
}
public bool UpdateAGVStateByResposne()
{
try
{
var response = _airPorthttpClient.AGVAllStateRequest();
if(response == null)
{
return false;
}
_AGVStateService.UpdateOrAddByResponse(response);
}
catch (Exception e)
{
_logger.LogError("Error:" + e);
}
return true;
}
}
}

@ -28,7 +28,8 @@ namespace SlnMesnac.Business.@base
private ILogger<BaseTaskInfoBusiness> _logger;
private IAirportTaskService _Taskservice;
private IAGVStateService _AGVStateService;
public BaseTaskInfoBusiness(ILogger<BaseTaskInfoBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer)
private AirPorthttpClient _airPorthttpClient;
public BaseTaskInfoBusiness(ILogger<BaseTaskInfoBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer, AirPorthttpClient airPorthttpClient)
{
_logger = logger;
_tcpServer = tcpServer;
@ -36,8 +37,10 @@ namespace SlnMesnac.Business.@base
_tcpServer.ReceiveStackWorkDoneEvent += _tcpServer_StackWorkDoneEvent;
_Taskservice = Taskservice;
_AGVStateService = agvService;
InitClearTimer();
//InitClearTimer();
_airPorthttpClient = airPorthttpClient;
//doWhileGetAGVTaskInfo();
//GetTaskStateDetail();
}
/// <summary>
/// 一次码垛完成,发送码垛结果
@ -104,11 +107,11 @@ namespace SlnMesnac.Business.@base
}
}
public static BaseTaskInfoBusiness GetInstance(ILogger<BaseTaskInfoBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer)
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);
instance = new BaseTaskInfoBusiness(logger, Taskservice,agvService, tcpServer, airPorthttpClient);
}
return instance;
}
@ -262,7 +265,7 @@ namespace SlnMesnac.Business.@base
//更新任务信息表状态为执行中
AirportTask.agvno = AgvItem.agvno;
AirportTask.taskstate = "执行中";
AirportTask.taskstate = "AGV执行中";
//等待agv返回任务编号
AirportTask.agvtaskno = Guid.NewGuid().ToString("N");
@ -289,7 +292,7 @@ namespace SlnMesnac.Business.@base
//更新任务信息表状态为执行中
AirportTask.agvno = AgvItem.agvno;
AirportTask.taskstate = "执行中";
AirportTask.taskstate = "AMR执行中";
//等待agv返回任务编号
AirportTask.amrtaskno = Guid.NewGuid().ToString("N");
_Taskservice.UpdateTaskAsync(AirportTask);
@ -331,75 +334,83 @@ namespace SlnMesnac.Business.@base
{
Task.Run(() =>
{
List<AirportTask> Task = _Taskservice.GetAGVTaskInfos();
if (Task.Count > 0)
while (true)
{
// 设置计时器
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
foreach (AirportTask airportTask in Task)
List<AirportTask> Task = _Taskservice.GetAGVTaskInfos();
if (Task != null)
{
//1.根据搬运AGV任务编号查询agv是否到达
if (!string.IsNullOrEmpty(airportTask.agvtaskno))
// 设置计时器
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
foreach (AirportTask airportTask in Task)
{
//2.调用3.查询任务状态接口
//根据搬运AGV任务编号查询agv是否到达
bool iflag = true;
if (iflag)
//1.根据搬运AGV任务编号查询agv是否到达
if (!string.IsNullOrEmpty(airportTask.agvtaskno))
{
//3:已完成
// if (state == 3)
// {
//
// }
//更新任务表中AGV编号
airportTask.agvno = "";
//更新agv返回任务编号
airportTask.agvtaskno = Guid.NewGuid().ToString("N");
_Taskservice.UpdateTaskAsync(airportTask);
Console.WriteLine("搬运AGV已到达");
//2.调用3.查询任务状态接口
//根据搬运AGV任务编号查询agv是否到达
bool iflag = true;
if (iflag)
{
//3:已完成
// if (state == 3)
// {
//
// }
//更新任务表中AGV编号
airportTask.agvno = "";
//更新agv返回任务编号
airportTask.agvtaskno = Guid.NewGuid().ToString("N");
_Taskservice.UpdateTaskAsync(airportTask);
}
}
}
//根据复合AGV任务编号查询agv是否到达
if (!string.IsNullOrEmpty(airportTask.amrtaskno))
{
//根据复合AGV任务编号查询agv是否到达
bool iflag = true;
if (iflag)
//根据复合AGV任务编号查询复合agv是否到达
if (!string.IsNullOrEmpty(airportTask.amrtaskno))
{
//已到达更新任务表中AGV编号
Console.WriteLine("复合AGV已到达");
//根据复合AGV任务编号查询agv是否到达
bool iflag = true;
if (iflag)
{
//已到达更新任务表中AGV编号
}
}
}
//复合、搬运已到上料点
if (!string.IsNullOrEmpty(airportTask.agvtaskno) && !string.IsNullOrEmpty(airportTask.agvtaskno))
{
//1.获取任务抓取数量
//判断是否为第一车,搬运机器人码垛无需定位
if (airportTask.loadcount == 0)
//复合、搬运已到上料点
if (!string.IsNullOrEmpty(airportTask.agvtaskno) && !string.IsNullOrEmpty(airportTask.agvtaskno))
{
//下发视觉抓取任务
Console.WriteLine("复合AGV已到达且搬运AGV已到达");
Console.WriteLine("下发视觉抓取任务");
}
if (airportTask.loadcount == 0)
{
//下发视觉抓取任务
//1.获取任务抓取数量
//判断是否为第一车,搬运机器人码垛无需定位
if (airportTask.loadcount == 0)
{
//下发视觉抓取任务
}
if (airportTask.loadcount == 0)
{
//下发视觉抓取任务
}
}
}
}
}
// 检查是否超过两秒
if (stopwatch.ElapsedMilliseconds > 2000)
{
_logger.LogError("超时");
// 检查是否超过两秒
if (stopwatch.ElapsedMilliseconds > 2000)
{
_logger.LogError("超时");
}
}
Thread.Sleep(100);
}
Thread.Sleep(100);
});
}
catch (Exception ex)

@ -1,42 +0,0 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
using SlnMesnac.TouchSocket;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Business.@base
{
public class UpLoadBusiness
{
#region 单例模式
//private static readonly Lazy<UpLoadBusiness> lazy = new Lazy<UpLoadBusiness>(() => new UpLoadBusiness(_logger,_tcpServer,));
//public static UpLoadBusiness Instance
//{
// get
// {
// return lazy.Value;
// }
//}
public UpLoadBusiness(ILogger<UpLoadBusiness> logger, IAirportTaskService Taskservice, IAGVStateService agvService, TcpServer tcpServer)
{
_logger = logger;
_tcpServer = tcpServer;
_Taskservice = Taskservice;
_AGVStateService = agvService;
}
#endregion
private TcpServer _tcpServer = null;
public Action<AirportTask> _Taskaction;
public Action<string> _RefreshLogMessageAction;
private static UpLoadBusiness instance;
private ILogger<UpLoadBusiness> _logger;
private IAirportTaskService _Taskservice;
private IAGVStateService _AGVStateService;
}
}

@ -7,6 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Nancy" Version="2.0.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

@ -4,6 +4,8 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using Nancy.Json;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -221,5 +223,13 @@ namespace SlnMesnac.Common
}
return iNegate;
}
public static string ModeToJson(object Model)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string str = serializer.Serialize(Model);
//HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") };
//return result;
return str;
}
}
}

@ -48,6 +48,12 @@ namespace SlnMesnac.Extensions
{
foreach (var item in appConfig.sqlConfig)
{
#region 加载sqlite数据库地址
//if (item.configId == "Local")
//{
// item.connStr = $"Data Source={System.Environment.CurrentDirectory}\\data\\" + item.connStr;
//}
#endregion
var config = new ConnectionConfig()
{
ConfigId = item.configId,

@ -0,0 +1,443 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace SlnMesnac.Repository
{
///<summary>
///
///</summary>
[SugarTable("T_RP_StationPara_110_1"), TenantAttribute("mes")]
public partial class T_RP_StationPara_110_1
{
public T_RP_StationPara_110_1(){
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="ID")]
public int id {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Barcode")]
public string barcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="SemiBarcode")]
public string semibarcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ScanBarcode")]
public string scanbarcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="RFIDNO")]
public string rfidno {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ShiftNo")]
public string shiftno {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="StationID")]
public string stationid {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="MachineID")]
public string machineid {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="MaskID")]
public string maskid {get;set;}
/// <summary>
/// Desc:
/// Default:DateTime.Now
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="InsertTime")]
public DateTime? inserttime {get;set;}
/// <summary>
/// Desc:
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="UploadFlag")]
public string uploadflag {get;set;}
/// <summary>
/// Desc:
/// Default:1
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="FinalFlag")]
public string finalflag {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="State")]
public string state {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1")]
public string para1 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Min")]
public string para1Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Max")]
public string para1Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_State")]
public string para1State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Reserve")]
public string para1Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2")]
public string para2 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Min")]
public string para2Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Max")]
public string para2Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_State")]
public string para2State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Reserve")]
public string para2Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3")]
public string para3 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Min")]
public string para3Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Max")]
public string para3Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_State")]
public string para3State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Reserve")]
public string para3Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4")]
public string para4 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Min")]
public string para4Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Max")]
public string para4Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_State")]
public string para4State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Reserve")]
public string para4Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5")]
public string para5 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Min")]
public string para5Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Max")]
public string para5Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_State")]
public string para5State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Reserve")]
public string para5Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para6")]
public string para6 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para6_Min")]
public string para6Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para6_Max")]
public string para6Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para6_State")]
public string para6State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para6_Reserve")]
public string para6Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para7")]
public string para7 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para7_Min")]
public string para7Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para7_Max")]
public string para7Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para7_State")]
public string para7State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para7_Reserve")]
public string para7Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para8")]
public string para8 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para8_Min")]
public string para8Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para8_Max")]
public string para8Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para8_State")]
public string para8State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para8_Reserve")]
public string para8Reserve {get;set;}
}
}

@ -0,0 +1,323 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace SlnMesnac.Repository
{
///<summary>
///
///</summary>
[SugarTable("T_RP_StationPara_110_2"), TenantAttribute("mes")]
public partial class T_RP_StationPara_110_2
{
public T_RP_StationPara_110_2(){
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="ID")]
public int id {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Barcode")]
public string barcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="SemiBarcode")]
public string semibarcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ScanBarcode")]
public string scanbarcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="RFIDNO")]
public string rfidno {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ShiftNo")]
public string shiftno {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="StationID")]
public string stationid {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="MachineID")]
public string machineid {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="MaskID")]
public string maskid {get;set;}
/// <summary>
/// Desc:
/// Default:DateTime.Now
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="InsertTime")]
public DateTime? inserttime {get;set;}
/// <summary>
/// Desc:
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="UploadFlag")]
public string uploadflag {get;set;}
/// <summary>
/// Desc:
/// Default:1
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="FinalFlag")]
public string finalflag {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="State")]
public string state {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1")]
public string para1 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Min")]
public string para1Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Max")]
public string para1Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_State")]
public string para1State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para1_Reserve")]
public string para1Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2")]
public string para2 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Min")]
public string para2Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Max")]
public string para2Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_State")]
public string para2State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para2_Reserve")]
public string para2Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3")]
public string para3 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Min")]
public string para3Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Max")]
public string para3Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_State")]
public string para3State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para3_Reserve")]
public string para3Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4")]
public string para4 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Min")]
public string para4Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Max")]
public string para4Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_State")]
public string para4State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para4_Reserve")]
public string para4Reserve {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5")]
public string para5 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Min")]
public string para5Min {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Max")]
public string para5Max {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_State")]
public string para5State {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Para5_Reserve")]
public string para5Reserve {get;set;}
}
}

@ -0,0 +1,155 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace SlnMesnac.Repository
{
///<summary>
///
///</summary>
[SugarTable("data1_Table"), TenantAttribute("Local")]
public partial class data1_Table
{
public data1_Table(){
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="ID")]
public int? id {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Time")]
public string time {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Productname")]
public string productname {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="DPQRcode")]
public string dpqrcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="JPQRcode")]
public string jpqrcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ETotalJudge")]
public string etotaljudge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="EValue")]
public string evalue {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="EJudge")]
public string ejudge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ERangeValue")]
public string erangevalue {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ERangeJudge")]
public string erangejudge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="ERank")]
public string erank {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="BPRank")]
public string bprank {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="E1Value")]
public string e1value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="E2Value")]
public string e2value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="E3Value")]
public string e3value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="E4Value")]
public string e4value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Flag")]
public string flag {get;set;}
}
}

@ -0,0 +1,147 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace SlnMesnac.Repository
{
///<summary>
///
///</summary>
[SugarTable("data1_Table"), TenantAttribute("Local")]
public partial class data2_Table
{
public data2_Table(){
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="ID")]
public int? id {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Time")]
public DateTime time {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Productname")]
public string productname {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="QRcode")]
public string qrcode {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="TotalJudge")]
public string totaljudge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="FRangeValue")]
public string frangevalue {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="FRange")]
public string frange {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F1Value")]
public string f1value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F1Judge")]
public string f1judge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F2Value")]
public string f2value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F2Judge")]
public string f2judge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F3Value")]
public string f3value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F3Judge")]
public string f3judge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F4Value")]
public string f4value {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="F4Judge")]
public string f4judge {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="Flag")]
public string flag {get;set;}
}
}

@ -1,27 +0,0 @@
using Microsoft.Extensions.Logging;
using Quartz;
using System;
using System.Threading.Tasks;
namespace SlnMesnac.Quartz.Job
{
/// <summary>
/// 定时获取设备状态
/// </summary>
public class GetAgvState_Job : IJob
{
private readonly ILogger<GetAgvState_Job> _logger;
public GetAgvState_Job(ILogger<GetAgvState_Job> logger)
{
_logger = logger;
}
public Task Execute(IJobExecutionContext context)
{
_logger.LogInformation($"获取AGV状态{DateTime.Now.ToString("HH:mm:ss")}");
return Task.CompletedTask;
}
}
}

@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Quartz;
using SlnMesnac.Business.@base;
using SlnMesnac.Common;
using SlnMesnac.Config;
using SlnMesnac.Repository;
using SlnMesnac.Repository.service;
@ -12,32 +15,142 @@ namespace SlnMesnac.Quartz.Job
public class GetTaskInfo_Job : IJob
{
private readonly ILogger<GetTaskInfo_Job> _logger;
private IAirportTaskService _service;
private BaseTaskInfoBusiness _taskInfoBusiness;
public GetTaskInfo_Job(ILogger<GetTaskInfo_Job> logger, IAirportTaskService service)
private Idata1_TableService _data1TableService;
private Idata2_TableService _data2TableService;
private IT_RP_StationPara_110_1Service _tr_stationPara_110_1Service;
private IT_RP_StationPara_110_2Service _tr_stationPara_110_2Service;
private readonly AppConfig _appConfig;
public GetTaskInfo_Job(AppConfig appConfig, ILogger<GetTaskInfo_Job> logger, Idata1_TableService service,Idata2_TableService idata2_TableService, IT_RP_StationPara_110_1Service tr_stationPara_110_1Service, IT_RP_StationPara_110_2Service tr_stationPara_110_2Service)
{
_appConfig = appConfig;
_logger = logger;
_service = service;
_data1TableService = service;
_tr_stationPara_110_1Service = tr_stationPara_110_1Service;
_data2TableService = idata2_TableService;
_tr_stationPara_110_2Service = tr_stationPara_110_2Service;
}
public Task Execute(IJobExecutionContext context)
{
var flag = _appConfig.sqlConfig.Find(x => x.configId == "Local");
if (flag.connStr.Contains("EData"))
{
LoadTaskInfo();
}
else if(flag.connStr.Contains("FData"))
{
LoadEDataInfo();
}
else if (flag.connStr.Contains("HData"))
{
}
else if (flag.connStr.Contains("LSHData"))
{
}
return Task.CompletedTask;
}
/// <summary>
/// 获取任务列表
/// </summary>
private void GetAGVTaskInfo()
private async void LoadTaskInfo()
{
try
{
List<AirportTask> Task = _service.GetTaskInfos();
List<data1_Table> _data1Tables = _data1TableService.Getdata1TableListAsync().Result;
if (_data1Tables != null && _data1Tables.Count > 0)
{
List<T_RP_StationPara_110_1> newList = new List<T_RP_StationPara_110_1>();
foreach (var data1Table in _data1Tables)
{
newList.Add(new T_RP_StationPara_110_1()
{
semibarcode = data1Table.dpqrcode,
scanbarcode = data1Table.jpqrcode,
state = data1Table.etotaljudge == "OK" ? "1" : "2",
para1 = data1Table.evalue,
para2 = data1Table.erangevalue,
para3 = data1Table.erank,
para4 = data1Table.bprank,
para5 = data1Table.e1value,
para6 = data1Table.e2value,
para7 = data1Table.e3value,
para8 = data1Table.e4value,
inserttime = DateTime.Parse(data1Table.time)
});
data1Table.flag = "F";
var iflag = _data1TableService.UpdateAsync(data1Table).Result;
if (iflag)
{
Console.WriteLine(StringChange.ModeToJson(data1Table));
_logger.LogDebug(StringChange.ModeToJson(data1Table));
}
}
if (newList != null && newList.Count != 0)
{
bool insertflag = await _tr_stationPara_110_1Service.AddTaskAsync(newList);
}
}
}
catch (Exception ex)
{
_logger.LogError($"异常:{ex.Message}");
}
}
private async void LoadEDataInfo()
{
try
{
DateTime start = Convert.ToDateTime(DateTime.Now.ToString("D").ToString());
DateTime end = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("D").ToString()).AddSeconds(-1);
List<data2_Table> _data1Tables = _data2TableService.Getdata2TableListAsync(start,end).Result;
if (_data1Tables != null && _data1Tables.Count > 0)
{
for (global::System.Int32 i = 0; i < _data1Tables.Count; i++)
{
T_RP_StationPara_110_2 t_RP_StationPara_110_2 = new T_RP_StationPara_110_2()
{
scanbarcode = _data1Tables[i].qrcode,
state = _data1Tables[i].totaljudge == "OK" ? "1" : "2",
para1 = _data1Tables[i].f1value,
para1State = _data1Tables[i].f1judge == "OK" ? "1" : "2",
para2 = _data1Tables[i].f2value,
para2State = _data1Tables[i].f2judge == "OK" ? "1" : "2",
para3 = _data1Tables[i].f3value,
para3State = _data1Tables[i].f3judge == "OK" ? "1" : "2",
para4 = _data1Tables[i].f4value,
para4State = _data1Tables[i].f4judge == "OK" ? "1" : "2",
para5 = _data1Tables[i].frangevalue,
para5State = _data1Tables[i].frange == "OK" ? "1" : "2",
inserttime = _data1Tables[i].time
};
bool insertflag = await _tr_stationPara_110_2Service.AddTaskAsync(t_RP_StationPara_110_2);
if (insertflag)
{
_data1Tables[i].flag = "F";
var iflag = _data2TableService.UpdateAsync(_data1Tables[i]).Result;
if (iflag)
{
Console.WriteLine("》》》更新前数量:" + _data1Tables.Count);
//_data1Tables.Remove(_data1Tables[i]);
if (_data1Tables.Count > 0)
{
Console.WriteLine("》》》更新后数量:" + _data1Tables.Count);
}
Console.WriteLine(StringChange.ModeToJson(_data1Tables[i]));
_logger.LogDebug(StringChange.ModeToJson(_data1Tables[i]));
}
}
}
}
}
catch (Exception ex)
{
_logger.LogError($"异常:{ex.Message}");
}
}
}
}

@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Quartz;
using SlnMesnac.Config;
using SlnMesnac.Quartz.Job;
using System;
@ -35,7 +36,12 @@ namespace SlnMesnac.Quartz
services.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();
//q.ScheduleJob<GetTaskInfo_Job>(trigger =>
// trigger.WithCronSchedule("*/5 * * * * ?").WithIdentity("GetTaskInfo_Job", "MyJobGroup") // 示例每5s执行一次
//);
q.ScheduleJob<GetTaskInfo_Job>(trigger =>
trigger.WithCronSchedule("* * 0/2 * * ? *").WithIdentity("GetTaskInfo_Job", "MyJobGroup") // 示例每5s执行一次
);
//q.ScheduleJob<MyJob>(trigger =>
// trigger.WithCronSchedule("*/3 * * * * ?").WithIdentity("MyJob", "MyJobGroup") // 示例每3s执行一次
//);

@ -0,0 +1,17 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service
{
public interface Idata1_TableService: IBaseService<data1_Table>
{
Task<List<data1_Table>> Getdata1TableListAsync();
Task<bool> UpdateAsync(data1_Table record);
}
}

@ -0,0 +1,15 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service
{
public interface Idata2_TableService: IBaseService<data2_Table>
{
Task<List<data2_Table>> Getdata2TableListAsync(DateTime start,DateTime end);
Task<bool> UpdateAsync(data2_Table record);
}
}

@ -0,0 +1,14 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service
{
public interface IT_RP_StationPara_110_1Service: IBaseService<T_RP_StationPara_110_1>
{
Task<bool> AddTaskAsync(List<T_RP_StationPara_110_1> record);
}
}

@ -0,0 +1,14 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service
{
public interface IT_RP_StationPara_110_2Service: IBaseService<T_RP_StationPara_110_2>
{
Task<bool> AddTaskAsync(T_RP_StationPara_110_2 record);
}
}

@ -104,6 +104,12 @@ namespace SlnMesnac.Repository.service.Impl
bool iFlag = await _rep.DeleteAsync(record);
return iFlag;
}
public async Task<bool> GetState()
{
return true;
}
}
}

@ -0,0 +1,59 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Model.Enum;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using SlnMesnac.Common;
using static Dm.net.buffer.ByteArrayBuffer;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class data1_TableServiceImpl : BaseServiceImpl<data1_Table>, Idata1_TableService
{
private Repository<data1_Table> _repository;
private ILogger<data1_TableServiceImpl> _logger;
public data1_TableServiceImpl(Repository<data1_Table> repository, ILogger<data1_TableServiceImpl> logger) :base(repository)
{
_repository = repository;
_logger = logger;
}
public async Task<List<data1_Table>> Getdata1TableListAsync()
{
List<data1_Table> list = null;
try
{
Expression<Func<data1_Table, bool>> exp = x => true;
exp = exp.And(x =>
(x.flag != "F")
);
list = _repository.GetList(exp);
}
catch (Exception ex)
{
_logger.LogError($"量仪数据获取错误:{ex.Message}");
}
return list;
}
public async Task<bool> UpdateAsync(data1_Table record)
{
try
{
bool result = await _rep.UpdateAsync(record);
return result;
}
catch (Exception ex)
{
_logger.LogError($"量仪数据获取错误:{ex.Message}");
return false;
}
}
}
}

@ -0,0 +1,53 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Common;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class data2_TableServiceImpl : BaseServiceImpl<data2_Table>, Idata2_TableService
{
private Repository<data2_Table> _repository2;
private ILogger<data2_TableServiceImpl> _logger;
public data2_TableServiceImpl(Repository<data2_Table> repository, ILogger<data2_TableServiceImpl> logger) :base(repository)
{
_logger = logger;
_repository2 = repository;
}
public async Task<bool> UpdateAsync(data2_Table record)
{
try
{
bool result = await _rep.UpdateAsync(record);
return result;
}
catch (Exception ex)
{
_logger.LogError($"量仪数据获取错误:{ex.Message}");
return false;
}
}
public async Task<List<data2_Table>> Getdata2TableListAsync(DateTime start, DateTime end)
{
List<data2_Table> list = null;
try
{
Expression<Func<data2_Table, bool>> exp = x => true;
exp = exp.And(x =>
(x.flag != "F" && x.time >= start && x.time < end)
);
list = _repository2.GetList(exp);
}
catch (Exception ex)
{
_logger.LogError($"量仪数据获取错误:{ex.Message}");
}
return list;
}
}
}

@ -0,0 +1,35 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class T_RP_StationPara_110_1ServiceImpl : BaseServiceImpl<T_RP_StationPara_110_1>, IT_RP_StationPara_110_1Service
{
private Repository<T_RP_StationPara_110_1> _repository;
private ILogger<T_RP_StationPara_110_1ServiceImpl> _logger;
public T_RP_StationPara_110_1ServiceImpl(Repository<T_RP_StationPara_110_1> repository, ILogger<T_RP_StationPara_110_1ServiceImpl> logger) :base(repository)
{
_repository = repository;
_logger = logger;
}
public async Task<bool> AddTaskAsync(List<T_RP_StationPara_110_1> record)
{
try
{
bool result = await _repository.InsertRangeAsync(record);
return result;
}
catch (Exception ex)
{
return false;
}
}
}
}

@ -0,0 +1,33 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class T_RP_StationPara_110_2ServiceImpl : BaseServiceImpl<T_RP_StationPara_110_2>, IT_RP_StationPara_110_2Service
{
private Repository<T_RP_StationPara_110_2> _repository;
private ILogger<T_RP_StationPara_110_2ServiceImpl> _logger;
public T_RP_StationPara_110_2ServiceImpl(Repository<T_RP_StationPara_110_2> repository, ILogger<T_RP_StationPara_110_2ServiceImpl> logger) :base(repository)
{
_logger = logger;
_repository = repository;
}
public async Task<bool> AddTaskAsync(T_RP_StationPara_110_2 record)
{
try
{
bool result = await _repository.InsertAsync(record);
return result;
}
catch (Exception ex)
{
return false;
}
}
}
}

@ -46,6 +46,7 @@ namespace SlnMesnac.Serilog
#endregion
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.Console()
.WriteTo.File(Path.Combine(logPath, "Debug.log"), LogEventLevel.Debug)
.WriteTo.File(Path.Combine(logPath, "Info.log"), LogEventLevel.Information)
.WriteTo.File(Path.Combine(logPath, "Error.log"), LogEventLevel.Error)
.WriteTo.File(Path.Combine(logPath, "data.log"), LogEventLevel.Warning)

@ -42,10 +42,8 @@ namespace SlnMesnac.TouchSocket
var _server = app.ApplicationServices.GetService<TcpServer>();
var _httpclient = app.ApplicationServices.GetService<AirPorthttpClient>();
_server.Init(6001);
_httpclient.init();
// var _apiServer = app.ApplicationServices.GetService<WebApiServer>();
// _apiServer.Init();
//_server.Init(6001);
//_httpclient.init();
return app;
}
}

@ -25,26 +25,35 @@ namespace SlnMesnac.WPF
// Startup事件
protected override async void OnStartup(StartupEventArgs e)
{
bool ret;
mutex = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out ret);
if (!ret)
try
{
MessageBox.Show("应用程序已开启,禁止重复运行");
Environment.Exit(0);
}
bool ret;
mutex = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out ret);
if (!ret)
{
MessageBox.Show("应用程序已开启,禁止重复运行");
Environment.Exit(0);
}
cracker.Cracker(100); //设置GC回收间隔
cracker.Cracker(100); //设置GC回收间隔
base.OnStartup(e);
var host = CreateHostBuilder(e.Args).Build();//生成宿主。
base.OnStartup(e);
var host = CreateHostBuilder(e.Args).Build();//生成宿主。
ServiceProvider = host.Services;
ServiceProvider = host.Services;
await host.StartAsync();
await host.StartAsync();
var appConfig = host.Services.GetService<AppConfig>();
var logPath = $"{appConfig.logPath}/Logs/{DateTime.UtcNow:yyyy-MM-dd}/";
Log.Information($"系统初始化完成,日志存放路径:{appConfig.logPath}");
var appConfig = host.Services.GetService<AppConfig>();
var logPath = $"{appConfig.logPath}/Logs/{DateTime.UtcNow:yyyy-MM-dd}/";
Log.Information($"系统初始化完成,日志存放路径:{appConfig.logPath}");
}
catch (Exception exception)
{
Console.WriteLine(exception);
throw;
}
}

@ -5,8 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF"
mc:Ignorable="d"
Title="MainWindow" Height="1080" Width="1920"
WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" Topmost="False">
Title="MainWindow" WindowStartupLocation="CenterScreen" Height="1080" Width="1920" Topmost="False" Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Background>
<ImageBrush ImageSource="/Templates/image/background.jpg" />
</Window.Background>
@ -31,7 +30,7 @@
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="行李空框调度系统" FontSize="50" Foreground="White" FontWeight="Bold"/>
<TextBlock Text="581数据采集系统" FontSize="50" Foreground="White" FontWeight="Bold"/>
</StackPanel>
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
@ -89,9 +88,7 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1">
<TextBlock Text="连接状态" FontSize="15" Foreground="Black" Margin="2,0,10,0"/>
</StackPanel>
<StackPanel Grid.Column="1"/>
<StackPanel Grid.Column="0">
<Ellipse Width="20" Height="20">
<Ellipse.Style>
@ -128,9 +125,7 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1">
<TextBlock Text="连接状态" FontSize="15" Foreground="Black" Margin="2,0,10,0"/>
</StackPanel>
<StackPanel Grid.Column="1"/>
<StackPanel Grid.Column="0">
<Ellipse Width="20" Height="20">
<Ellipse.Style>
@ -190,7 +185,7 @@
</Ellipse>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="机械臂" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
<TextBlock Text="SQLServer" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
</StackPanel>
</Grid>
</StackPanel>
@ -221,7 +216,7 @@
</Ellipse>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="AGV" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
<TextBlock Text="SQLlite" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
</StackPanel>
</Grid>
</StackPanel>

@ -15,6 +15,9 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows;
using System.Windows.Forms;
namespace SlnMesnac.WPF
{
@ -23,6 +26,20 @@ namespace SlnMesnac.WPF
/// </summary>
public partial class MainWindow : Window
{
//托盘
NotifyIcon trayIcon;
//注册AreaIcon属性用于托盘的图标
public static readonly DependencyProperty AreaIconProperty =
DependencyProperty.Register("AreaIcon", typeof(ImageSource), typeof(MainWindow));
//注册AreaText属性用于鼠标滑到托盘图标时显示的文字
public static readonly DependencyProperty AreaTextProperty =
DependencyProperty.Register("AreaText", typeof(string), typeof(MainWindow));
//注册AreaVisibility属性用于显示隐藏托盘图标
public static readonly DependencyProperty AreaVisibilityProperty =
DependencyProperty.Register("AreaVisibility", typeof(bool), typeof(MainWindow));
//注册AreaMenuItems属性用于托盘右键在单的列表
public static readonly DependencyProperty AreaMenuItemsProperty =
DependencyProperty.Register("AreaMenuItems", typeof(List<MenuItem>), typeof(MainWindow), new PropertyMetadata(new List<MenuItem>()));
public MainWindow()
{
InitializeComponent();
@ -30,14 +47,29 @@ namespace SlnMesnac.WPF
this.DataContext = new MainWindowViewModel();
}
private void Button_Click(object sender, RoutedEventArgs e)
private void AddTrayIcon()
{
if (trayIcon != null)
{
return;
}
trayIcon = new NotifyIcon
{
};
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
return;
}
}
}

@ -5,6 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>

@ -43,7 +43,7 @@ namespace SlnMesnac.WPF
services.AddSqlSugarSetup();
//注册PLC工厂
services.AddPlcFactorySetup();
//services.AddPlcFactorySetup();
//注册httpClient
//services.AddHostedService<AirPorthttpClient>();
@ -55,7 +55,7 @@ namespace SlnMesnac.WPF
//services.AddRfidFactorySetup();
//注册任务调度
//services.AddQuartzSetUp();
services.AddQuartzSetUp();
}

@ -21,6 +21,7 @@ using SlnMesnac.TouchSocket;
using HslCommunication.Enthernet;
using SlnMesnac.Config;
using System.Threading;
using SlnMesnac.Common;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -50,14 +51,19 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
{
private ILogger<IndexContentViewModel> _logger;
private ILogger<BaseTaskInfoBusiness> _taskBusinessLogger;
private ILogger<BaseStateRefreshBusiness> _stateBusinessLogger;
//private ILogger<BaseStateRefreshBusiness> _stateBusinessLogger;
private IAirportTaskService _taskservice;
private IAGVStateService _agvstateService;
private BaseTaskInfoBusiness _taskInfoBusiness;
private BaseStateRefreshBusiness _StateRefreshBusiness;
private DispatcherTimer _timer;
private TcpServer _tcpServer;
private AppConfig _appConfig;
private AirPorthttpClient _airPorthttpClient;
private Idata1_TableService _data1TableService;
private Idata2_TableService _data2TableService;
private IT_RP_StationPara_110_1Service _tr_stationPara_110_1Service;
private IT_RP_StationPara_110_2Service _tr_stationPara_110_2Service;
public IndexContentViewModel()
{
@ -67,48 +73,90 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
_agvstateService = App.ServiceProvider.GetService<IAGVStateService>();
_tcpServer = App.ServiceProvider.GetService<TcpServer>();
_appConfig = App.ServiceProvider.GetService<AppConfig>();
_taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger, _taskservice, _agvstateService, _tcpServer);
_taskInfoBusiness._RefreshLogMessageAction += RefreshLogMessage;
_taskInfoBusiness._Taskaction += task =>
{
if (task != null)
{
var x = TaskItems.ToList().Find(x => x.conveyorno == task.conveyorno);
if (x != null)
{
x.id = task.id;
x.taskno = task.taskno;
x.flightno = task.flightno;
x.manipulatorno = task.manipulatorno;
x.agvno = task.agvno;
x.taskstate = task.taskstate;
TaskItems = new ObservableCollection<AirportTask>(TaskItems);
}
}
};
_airPorthttpClient = App.ServiceProvider.GetService<AirPorthttpClient>();
_data1TableService = App.ServiceProvider.GetService<Idata1_TableService>();
_data2TableService = App.ServiceProvider.GetService<Idata2_TableService>();
_tr_stationPara_110_1Service = App.ServiceProvider.GetService<IT_RP_StationPara_110_1Service>();
_tr_stationPara_110_2Service = App.ServiceProvider.GetService<IT_RP_StationPara_110_2Service>();
_logger = App.ServiceProvider.GetService<ILogger<IndexContentViewModel>>();
//_taskInfoBusiness = BaseTaskInfoBusiness.GetInstance(_taskBusinessLogger, _taskservice, _agvstateService, _tcpServer, _airPorthttpClient);
//_taskInfoBusiness._RefreshLogMessageAction += RefreshLogMessage;
//_taskInfoBusiness._Taskaction += task =>
//{
// if (task != null)
// {
// var x = TaskItems.ToList().Find(x => x.conveyorno == task.conveyorno);
// if (x != null)
// {
// x.id = task.id;
// x.taskno = task.taskno;
// x.flightno = task.flightno;
// x.manipulatorno = task.manipulatorno;
// x.agvno = task.agvno;
// x.taskstate = task.taskstate;
// TaskItems = new ObservableCollection<AirportTask>(TaskItems);
// }
// }
//};
this.Init();
}
private void LoadTaskInfo()
private async void LoadTaskInfo()
{
try
{
List<AirportTask> AirportTaskItem = _taskservice.GetTaskInfos();
TaskItems = new ObservableCollection<AirportTask>(AirportTaskItem);
List<data1_Table> _data1Tables = _data1TableService.Getdata1TableListAsync().Result;
if (_data1Tables != null && _data1Tables.Count > 0)
{
List<T_RP_StationPara_110_1> newList = new List<T_RP_StationPara_110_1>();
foreach (var data1Table in _data1Tables)
{
newList.Add(new T_RP_StationPara_110_1()
{
semibarcode = data1Table.dpqrcode,
scanbarcode = data1Table.jpqrcode,
state = data1Table.etotaljudge == "OK" ? "1" : "2",
para1 = data1Table.evalue,
para2 = data1Table.erangevalue,
para3 = data1Table.erank,
para4 = data1Table.bprank,
para5 = data1Table.e1value,
para6 = data1Table.e2value,
para7 = data1Table.e3value,
para8 = data1Table.e4value,
inserttime = DateTime.Parse(data1Table.time)
});
data1Table.flag = "F";
var iflag = _data1TableService.UpdateAsync(data1Table).Result;
if (iflag)
{
Console.WriteLine(StringChange.ModeToJson(data1Table));
}
}
if (newList != null && newList.Count != 0)
{
bool insertflag = await _tr_stationPara_110_1Service.AddTaskAsync(newList);
}
}
}
catch (Exception ex)
{
_logger.LogError($"异常:{ex.Message}");
}
}
private async void LoadEDataInfo()
{
}
private void Init()
{
#region 测试数据
LoadTaskInfo();
//LoadEDataInfo();
//LoadTaskInfo();
//Thread.Sleep(5000);
//_tcpServer.SendReplyGetManualException(
@ -144,16 +192,16 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
//RefreshLogMessage($"6#站台任务下发");
//RefreshLogMessage($"7#站台任务下发");
FlightItems = new ObservableCollection<FlightItem>
{
new FlightItem { flightNumber = "航班号CZ3021", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3022", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3023", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3024", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3025", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3026", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
new FlightItem { flightNumber = "航班号CZ3027", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
};
//FlightItems = new ObservableCollection<FlightItem>
//{
// new FlightItem { flightNumber = "航班号CZ3021", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3022", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3023", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3024", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3025", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3026", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
// new FlightItem { flightNumber = "航班号CZ3027", scheduledTime = "计划/变更11:28", destination = "经停/目的:深圳",flightStatus="状态:到达",baggageClaim="转盘1" },
//};
#endregion
#region 更新时间显示
@ -374,7 +422,7 @@ namespace SlnMesnac.WPF.ViewModel.IndexPage
//清表
_taskservice.DeleteTaskAsync(task);
//TaskItems = new ObservableCollection<AirportTask>(TaskItems);
LoadTaskInfo();
//LoadTaskInfo();
}
}

@ -25,6 +25,7 @@ namespace SlnMesnac.WPF.ViewModel
private readonly GenerateControl generateControl = new GenerateControl();
private IndexContent indexContent = new IndexContent();
private AppConfig _appConfig;
private AirPorthttpClient _airPorthttpClient;
#region 参数定义
/// <summary>
@ -95,7 +96,8 @@ namespace SlnMesnac.WPF.ViewModel
_AGVStateService = App.ServiceProvider.GetService<IAGVStateService>();
_BaseTaskInfoBusinesslogger = App.ServiceProvider.GetService<ILogger<BaseTaskInfoBusiness>>();
_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));
FormControlCommand = new RelayCommand<object>(x => FormControl(x));
_tcpServer.RefreshStateAction+= (_clientIP, _state) =>
@ -105,7 +107,7 @@ namespace SlnMesnac.WPF.ViewModel
ShellScannerStatus = _state ? 1 : 2;
}
};
UserContent = indexContent;
// UserContent = indexContent;
}
/// <summary>

@ -8,22 +8,22 @@
},
"AllowedHosts": "*",
"AppConfig": {
"logPath": "F:\\Mesnac\\2023部门项目\\机场AGV调度\\HightWay_AirPot_WCS\\SlnMesnac.WPF\\bin\\Debug\\net6.0-windows\\log",
"logPath": "F:\\Mesnac\\2023部门项目\\奥特佳-滁州3期\\源码\\HightWay_Middle_Ware\\SlnMesnac.WPF\\bin\\Debug\\net6.0-windows\\log",
"SqlConfig": [
//{
// "configId": "mes",
// "dbType": 1,
// "connStr": "server=.;uid=sa;pwd=123456;database=JiangYinMENS"
//},
{
"configId": "mes",
"dbType": 1,
"connStr": "server=192.168.1.120;uid=sa;pwd=123456;database=ATJ_581_DB"
},
//{
// "configId": "mcs",
// "dbType": 3,
// "connStr": "Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma"
//},
{
"configId": "AGV",
"configId": "Local",
"dbType": 2,
"connStr": "Data Source=D:\\WorkCode\\AirPortWCS\\SlnMesnac.WPF\\bin\\Debug\\net6.0-windows\\data\\Airport_db.sqlite"
"connStr": "Data Source=F:\\Mesnac\\2023部门项目\\奥特佳-滁州3期\\源码\\HightWay_Middle_Ware\\SlnMesnac.WPF\\bin\\Debug\\net6.0-windows\\data\\FData.db3"
}
],
"PlcConfig": [

@ -33,9 +33,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlnMesnac.Ioc", "SlnMesnac.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlnMesnac.Generate", "SlnMesnac.Generate\SlnMesnac.Generate.csproj", "{00FC9358-2381-4C1B-BD45-6D31DD1DB7D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.Extensions", "SlnMesnac.Extensions\SlnMesnac.Extensions.csproj", "{6D929802-24AA-42A7-92C5-303C3D59A990}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlnMesnac.Extensions", "SlnMesnac.Extensions\SlnMesnac.Extensions.csproj", "{6D929802-24AA-42A7-92C5-303C3D59A990}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.Redis", "SlnMesnac.Redis\SlnMesnac.Redis.csproj", "{0E041719-E755-43CD-8A0E-DF62E0B2E463}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlnMesnac.Redis", "SlnMesnac.Redis\SlnMesnac.Redis.csproj", "{0E041719-E755-43CD-8A0E-DF62E0B2E463}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -4,7 +4,7 @@ using SlnMesnac.Quartz;
using SlnMesnac.Serilog;
using SlnMesnac.Extensions;
using System.Runtime.Serialization;
using SlnMesnac.Business.Airport;
namespace SlnMesnac
{

Loading…
Cancel
Save