|
|
@ -1,4 +1,5 @@
|
|
|
|
using SlnMesnac.Business.@base;
|
|
|
|
using SlnMesnac.Business.@base;
|
|
|
|
|
|
|
|
using SlnMesnac.Config;
|
|
|
|
using SlnMesnac.Model.dto;
|
|
|
|
using SlnMesnac.Model.dto;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Repository;
|
|
|
|
using SlnMesnac.Repository;
|
|
|
@ -6,6 +7,7 @@ using SlnMesnac.Repository.service;
|
|
|
|
using SlnMesnac.Serilog;
|
|
|
|
using SlnMesnac.Serilog;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
@ -47,27 +49,66 @@ namespace SlnMesnac.Business
|
|
|
|
public delegate void GimbaRotationControl(string wPanPos, string wTiltPos, string wZoomPos);
|
|
|
|
public delegate void GimbaRotationControl(string wPanPos, string wTiltPos, string wZoomPos);
|
|
|
|
public event GimbaRotationControl GimbaRotationControlEvent;
|
|
|
|
public event GimbaRotationControl GimbaRotationControlEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly AppConfig _appConfig;
|
|
|
|
|
|
|
|
|
|
|
|
public InspModeBusiness( Irecord_inspection_cabinetServices service,
|
|
|
|
public InspModeBusiness( Irecord_inspection_cabinetServices service,
|
|
|
|
Irecord_busbar_tempServices irecord_Busbar_TempServices,IServiceProvider serviceProvider) : base(serviceProvider)
|
|
|
|
Irecord_busbar_tempServices irecord_Busbar_TempServices,IServiceProvider serviceProvider,AppConfig appConfig) : base(serviceProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_record_busbar_TempServices = irecord_Busbar_TempServices;
|
|
|
|
_record_busbar_TempServices = irecord_Busbar_TempServices;
|
|
|
|
_service = service;
|
|
|
|
_service = service;
|
|
|
|
|
|
|
|
_appConfig = appConfig;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Start(string taskCode,string filePath)
|
|
|
|
public void Start(string taskCode,string filePath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isFlag)
|
|
|
|
//if (isFlag)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// _log.Info($"自动模式运行中,请勿重复开启");
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//InspModeEvent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_log.Info($"自动模式运行中,请勿重复开启");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InspModeEvent();
|
|
|
|
if (isFlag)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_log.Info($"巡检模式运行中,请勿重复开启");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lock (string.Empty)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isFlag = true;
|
|
|
|
|
|
|
|
while (isFlag)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_log.Info($"巡检模式初始化成功");
|
|
|
|
|
|
|
|
this.InspModeEvent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isFlag)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Task.Delay(1000 * 60 * _appConfig.checkCycle).Wait();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_log.Info($"巡检模式初始化异常:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
public void Stop()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
isFlag = false;
|
|
|
|
isFlag = false;
|
|
|
|
|
|
|
|
_log.Info($"巡检模式关闭成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void InspModeEvent()
|
|
|
|
private void InspModeEvent()
|
|
|
@ -209,6 +250,18 @@ namespace SlnMesnac.Business
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int rewrite = _plc.readInt32ByAddress("VD1554");
|
|
|
|
|
|
|
|
if (rewrite == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_plc.writeInt32ByAddress("VD1554", 0);
|
|
|
|
|
|
|
|
if (!_plc.writeInt32ByAddress("VD1536", 2)) //工作模式:1-自动;2-巡检;3-手动
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentException($"VD1554为1重新写入工作模式:自动模式;写入PLC失败;VD1536写2");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_log.Info($"VD1554为1重新写入工作模式:自动模式;写入PLC成功;VD1536写2");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号
|
|
|
|
int is_arrive_flag = _plc.readInt32ByAddress(signal); //读取PLC轨道电机到位信号
|
|
|
|
if (is_arrive_flag == 1)
|
|
|
|
if (is_arrive_flag == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|