PlcInfo添加:有料检测、舱位状态、灯光控制、消防移仓

master
lch 6 months ago
parent e008fe6040
commit 44e2907ddc

@ -102,6 +102,31 @@ namespace Service
plcInfo.BatteryInstallationComplete = plcInfo.plcToHost.TaskStates.Value == 1006 ? true : false;
plcInfo.SetExitLightGreen = (plcInfo.plcToHost.LightOut.Value == 1000 || plcInfo.plcToHost.LightOut.Value == 1010) ? true : false;
plcInfo.ExitRadarSensingTrigger = plcInfo.plcToHost.RadarStatesOut.Value == 1000 ? true : false;
#region 有料检测
plcInfo.MaterialDetec01 = plcInfo.plcToHost.MaterialDetecSwitchFault01.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec01.Value == true ? 1 : 0);
plcInfo.MaterialDetec02 = plcInfo.plcToHost.MaterialDetecSwitchFault02.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec02.Value == true ? 1 : 0);
plcInfo.MaterialDetec03 = plcInfo.plcToHost.MaterialDetecSwitchFault03.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec03.Value == true ? 1 : 0);
plcInfo.MaterialDetec04 = plcInfo.plcToHost.MaterialDetecSwitchFault04.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec04.Value == true ? 1 : 0);
plcInfo.MaterialDetec05 = plcInfo.plcToHost.MaterialDetecSwitchFault05.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec05.Value == true ? 1 : 0);
plcInfo.MaterialDetec06 = plcInfo.plcToHost.MaterialDetecSwitchFault06.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec06.Value == true ? 1 : 0);
plcInfo.MaterialDetec07 = plcInfo.plcToHost.MaterialDetecSwitchFault07.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec07.Value == true ? 1 : 0);
plcInfo.MaterialDetec08 = plcInfo.plcToHost.MaterialDetecSwitchFault08.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec08.Value == true ? 1 : 0);
plcInfo.MaterialDetec09 = plcInfo.plcToHost.MaterialDetecSwitchFault09.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec09.Value == true ? 1 : 0);
plcInfo.MaterialDetec10 = plcInfo.plcToHost.MaterialDetecSwitchFault10.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec10.Value == true ? 1 : 0);
plcInfo.MaterialDetec11 = plcInfo.plcToHost.MaterialDetecSwitchFault11.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec11.Value == true ? 1 : 0);
plcInfo.MaterialDetec12 = plcInfo.plcToHost.MaterialDetecSwitchFault12.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec12.Value == true ? 1 : 0);
plcInfo.MaterialDetec13 = plcInfo.plcToHost.MaterialDetecSwitchFault13.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec13.Value == true ? 1 : 0);
plcInfo.MaterialDetec14 = plcInfo.plcToHost.MaterialDetecSwitchFault14.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec14.Value == true ? 1 : 0);
plcInfo.MaterialDetec15 = plcInfo.plcToHost.MaterialDetecSwitchFault15.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec15.Value == true ? 1 : 0);
plcInfo.MaterialDetec16 = plcInfo.plcToHost.MaterialDetecSwitchFault16.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec16.Value == true ? 1 : 0);
plcInfo.MaterialDetec17 = plcInfo.plcToHost.MaterialDetecSwitchFault17.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec17.Value == true ? 1 : 0);
plcInfo.MaterialDetec18 = plcInfo.plcToHost.MaterialDetecSwitchFault18.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec18.Value == true ? 1 : 0);
plcInfo.MaterialDetec19 = plcInfo.plcToHost.MaterialDetecSwitchFault19.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec19.Value == true ? 1 : 0);
plcInfo.MaterialDetec20 = plcInfo.plcToHost.MaterialDetecSwitchFault20.Value == true ? (byte)2 : (byte)(plcInfo.plcToHost.MaterialDetec20.Value == true ? 1 : 0);
#endregion
}
var bytes03 = master.BatchRead(701, 10);

@ -3,6 +3,8 @@ using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkDriver.Session;
using HybirdFrameworkServices.Plc;
using Newtonsoft.Json.Linq;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Pipelines.Sockets.Unofficial.Arenas;
using System.Net.NetworkInformation;
namespace Service.Init.Entity
@ -394,6 +396,106 @@ namespace Service.Init.Entity
}
#endregion
#region 有料检测
/// <summary>
/// 有料检测 1-20仓
/// </summary>
public byte MaterialDetec01 { get; set; }
public byte MaterialDetec02 { get; set; }
public byte MaterialDetec03 { get; set; }
public byte MaterialDetec04 { get; set; }
public byte MaterialDetec05 { get; set; }
public byte MaterialDetec06 { get; set; }
public byte MaterialDetec07 { get; set; }
public byte MaterialDetec08 { get; set; }
public byte MaterialDetec09 { get; set; }
public byte MaterialDetec10 { get; set; }
public byte MaterialDetec11 { get; set; }
public byte MaterialDetec12 { get; set; }
public byte MaterialDetec13 { get; set; }
public byte MaterialDetec14 { get; set; }
public byte MaterialDetec15 { get; set; }
public byte MaterialDetec16 { get; set; }
public byte MaterialDetec17 { get; set; }
public byte MaterialDetec18 { get; set; }
public byte MaterialDetec19 { get; set; }
public byte MaterialDetec20 { get; set; }
#endregion 有料检测
/// <summary>
/// 舱位状态 在位状态0-不在位1-在位2-无效
/// </summary>
/// <returns></returns>
public List<byte> ReturnMaterialDetec()
{
List<byte> ret = new List<byte>
{
MaterialDetec01,MaterialDetec02 ,MaterialDetec03 ,MaterialDetec04 ,MaterialDetec05 ,
MaterialDetec06 ,MaterialDetec07 ,MaterialDetec08 ,MaterialDetec09 ,MaterialDetec10 ,
MaterialDetec11 ,MaterialDetec12 ,MaterialDetec13 ,MaterialDetec14 ,MaterialDetec15 ,
MaterialDetec16 ,MaterialDetec17 ,MaterialDetec18 ,MaterialDetec19 ,MaterialDetec20 ,
};
return ret;
}
/// <summary>
/// 灯光控制:全部打开
/// </summary>
/// <returns></returns>
public bool AllLightsOn()
{
bool bResult = false;
if (Connected)
{
hostToPlc.LightingControl.Value = 1000;
bResult = WriteUint16(hostToPlc.LightIn);
}
return bResult;
}
/// <summary>
/// 灯光控制:全部关闭
/// </summary>
/// <returns></returns>
public bool AllLightsOff()
{
bool bResult = false;
if (Connected)
{
hostToPlc.LightingControl.Value = 1010;
bResult = WriteUint16(hostToPlc.LightIn);
}
return bResult;
}
/// <summary>
/// 消防移仓
/// </summary>
/// <param name="entrySelection">入仓位选择0-无操作、1-缓存位舱位号、2-20电池存储仓位</param>
/// <returns></returns>
public bool FireProtectionRelocation(ushort entrySelection)
{
bool bResult = false;
if (Connected)
{
hostToPlc.TaskType.Value = 5;
hostToPlc.EntrySelection.Value = entrySelection;
hostToPlc.ExitSelection.Value = 5;
hostToPlc.BatteryPackType.Value = 0;
//TODO:: 连续写多个寄存器 是否影响速度
bool bResultTaskType = WriteUint16(hostToPlc.TaskType);
bool bResultEntrySelection = WriteUint16(hostToPlc.EntrySelection);
bool bResultExitSelection = WriteUint16(hostToPlc.ExitSelection);
bool bResultBatteryPackType = WriteUint16(hostToPlc.BatteryPackType);
if (bResultTaskType && bResultEntrySelection && bResultExitSelection && bResultBatteryPackType)
{
bResult = true;
}
}
return bResult;
}
public PlcInfo(string channelId, int eqmSn)
{
ChannelId = channelId;

@ -73,130 +73,53 @@ namespace HybirdFrameworkServices.Plc
/// 备用
/// </summary>
public ModbusProperty<string> value09 { get; set; } = new(40211, length: 30);
/// <summary>
/// 在位状态
/// </summary>
public ModbusProperty<string> InPosition { get; set; } = new(40241, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition01 { get; set; } = new(40241, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition02 { get; set; } = new(40242, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition03 { get; set; } = new(40243, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition04 { get; set; } = new(40244, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition05 { get; set; } = new(40245, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition06 { get; set; } = new(40246, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition07 { get; set; } = new(40247, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition08 { get; set; } = new(40248, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition09 { get; set; } = new(40249, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition10 { get; set; } = new(40250, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition11 { get; set; } = new(40251, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition12 { get; set; } = new(40252, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition13 { get; set; } = new(40253, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition14 { get; set; } = new(40254, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition15 { get; set; } = new(40255, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition16 { get; set; } = new(40256, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition17 { get; set; } = new(40257, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition18 { get; set; } = new(40258, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition19 { get; set; } = new(40259, length: 40);
/// <summary>
/// 在位状态
/// Bit0:有料检测
/// Bit1:有料检测开关故障"
/// </summary>
public ModbusProperty<ushort> InPosition20 { get; set; } = new(40260, length: 40);
#region 舱位状态 bit0:有料检测 Bit1有料检测开关故障
public ModbusProperty<bool> MaterialDetec01 { get; set; } = new(40241,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec02 { get; set; } = new(40242,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec03 { get; set; } = new(40243,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec04 { get; set; } = new(40244,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec05 { get; set; } = new(40245,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec06 { get; set; } = new(40246,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec07 { get; set; } = new(40247,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec08 { get; set; } = new(40248,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec09 { get; set; } = new(40249,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec10 { get; set; } = new(40250,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec11 { get; set; } = new(40251,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec12 { get; set; } = new(40252,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec13 { get; set; } = new(40253,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec14 { get; set; } = new(40254,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec15 { get; set; } = new(40255,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec16 { get; set; } = new(40256,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec17 { get; set; } = new(40257,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec18 { get; set; } = new(40258,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec19 { get; set; } = new(40259,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec20 { get; set; } = new(40260,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault01 { get; set; } = new(40241, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault02 { get; set; } = new(40242, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault03 { get; set; } = new(40243, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault04 { get; set; } = new(40244, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault05 { get; set; } = new(40245, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault06 { get; set; } = new(40246, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault07 { get; set; } = new(40247, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault08 { get; set; } = new(40248, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault09 { get; set; } = new(40249, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault10 { get; set; } = new(40250, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault11 { get; set; } = new(40251, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault12 { get; set; } = new(40252, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault13 { get; set; } = new(40253, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault14 { get; set; } = new(40254, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault15 { get; set; } = new(40255, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault16 { get; set; } = new(40256, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault17 { get; set; } = new(40257, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault18 { get; set; } = new(40258, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault19 { get; set; } = new(40259, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault20 { get; set; } = new(40260, 0, 0, ModbusDataType.Bit);
#endregion 舱位状态
/// <summary>
/// 备用
/// </summary>

@ -23,10 +23,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj"/>
<ProjectReference Include="..\HybirdFrameworkDriver\HybirdFrameworkDriver.csproj"/>
<ProjectReference Include="..\Entity\Entity.csproj"/>
<ProjectReference Include="..\Repository\Repository.csproj"/>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj" />
<ProjectReference Include="..\HybirdFrameworkDriver\HybirdFrameworkDriver.csproj" />
<ProjectReference Include="..\Entity\Entity.csproj" />
<ProjectReference Include="..\Repository\Repository.csproj" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Mvc;
namespace WebStarter.Controllers.BasicConfig
{
/// <summary>
/// 基础配置 RFID读写
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class RfidReadWriteController
{
/// <summary>
/// 预览
/// 车型 的ASCLL、解析后信息
/// </summary>
[HttpGet("UploadCloud/{id}")]
public void Preview()
{
}
/// <summary>
/// RFID写值
/// </summary>
[HttpGet("UploadCloud/{id}")]
public void RfidWriteValue()
{
}
/// <summary>
/// RFID 识别
/// </summary>
[HttpGet("UploadCloud/{id}")]
public void RfidRecognition()
{
}
/// <summary>
/// 车型号返回
/// </summary>
[HttpGet("UploadCloud/{id}")]
public void ChargePositionDisable()
{
}
}
}

@ -0,0 +1,42 @@
using Entity.DbModel.System.SysBaseObject;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Service.System;
using System.ComponentModel.DataAnnotations;
namespace WebStarter.Controllers.BasicConfig
{
/// <summary>
/// 基础配置 站点基础信息
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class StationBasicInfoController
{
/// <summary>
/// 站点基础信息
/// </summary>
[HttpPost("StationBaseInfo")]
public void StationBaseInfo()
{
}
/// <summary>
/// 站点编辑
/// </summary>
[HttpPost("StationBaseInfo")]
public void StationInfoEditor()
{
}
[HttpPost]
[Route("/api/sysFile/uploadAvatar")]
public async Task<Result<SysFile>> UploadAvatar([Required] IFormFile file)
{
return Result<SysFile>.Success();
}
}
}

@ -10,8 +10,18 @@ namespace WebStarter.Controllers;
[Route("api/[controller]")]
public class ChargeMonitorController
{
/// <summary>
/// 充电仓查询:条件:仓位编号 仓位名称
/// </summary>
[HttpGet("UploadCloud/{id}")]
public void ChargePositionQuery()
{
}
/// <summary>
/// 充电仓 0禁用 1启用
/// </summary>

@ -464,7 +464,7 @@ namespace WinFormStarter
lblValue06.Text = plcInfo.plcToHost.LightStatus.Value.ToString();
lblValue07.Text = plcInfo.plcToHost.ExhaustFanStatus.Value.ToString();
lblValue08.Text = plcInfo.plcToHost.WaterStatusStation.Value.ToString();
lblValue09.Text = plcInfo.plcToHost.InPosition.Value.ToString();
lblValue10.Text = plcInfo.plcToHost.CarStatus.Value.ToString();
lblValue11.Text = plcInfo.plcToHost.PercentageTorqueX.Value.ToString();
lblValue12.Text = plcInfo.plcToHost.PercentageTorqueY.Value.ToString();

Loading…
Cancel
Save