diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs
index 06b00b0..6029802 100644
--- a/Service/Plc/Client/PlcMgr.cs
+++ b/Service/Plc/Client/PlcMgr.cs
@@ -54,6 +54,18 @@ public class PlcMgr
return false;
}
+
+ public static bool AirBlowerControl(ushort value)
+ {
+ if (PlcClient != null)
+ {
+ HostToPlcData.ExhaustFanControl.Value = value;
+ return PlcClient.WriteValue(HostToPlcData.ExhaustFanControl);
+ }
+
+ return false;
+ }
+
///
/// 是否远程模式
///
@@ -63,19 +75,18 @@ public class PlcMgr
if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds)
{
return PlcToHostData.RemoteLocalControlState.Value == 1010;
-
}
else
{
return false;
}
}
+
public static bool IsAuto()
{
if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds)
{
return PlcToHostData.ModeControl.Value == 1010;
-
}
else
{
@@ -203,7 +214,7 @@ public class PlcMgr
}
//需要将数据转换成byte数组
- OperateResult operateResult = PlcClient.Write("x=16;111",encode);
+ OperateResult operateResult = PlcClient.Write("x=16;111", encode);
return operateResult.IsSuccess;
}
@@ -317,8 +328,10 @@ public class PlcMgr
writeHostToPlc.LightingControl.Value = 1000;
bResult = PlcClient.WriteValue(writeHostToPlc.LightIn);
}
+
return bResult;
}
+
///
/// 获取当前灯光状态
///
@@ -329,6 +342,7 @@ public class PlcMgr
{
return PlcToHostData.LightStatus.Value;
}
+
return default;
}
@@ -345,8 +359,7 @@ public class PlcMgr
writeHostToPlc.LightingControl.Value = 1010;
bResult = PlcClient.WriteValue(writeHostToPlc.LightIn);
}
+
return bResult;
}
-
-
}
\ No newline at end of file
diff --git a/WebStarter/Controllers/BinInfoController.cs b/WebStarter/Controllers/BinInfoController.cs
index a86e712..14a35a1 100644
--- a/WebStarter/Controllers/BinInfoController.cs
+++ b/WebStarter/Controllers/BinInfoController.cs
@@ -19,9 +19,9 @@ namespace WebStarter.Controllers;
[Route("api/[controller]")]
public class BinInfoController : ControllerBase
{
-
private readonly BinInfoRepository _BinInfoRepository;
- public BinInfoController(BinInfoRepository infoRepository)
+
+ public BinInfoController(BinInfoRepository infoRepository)
{
_BinInfoRepository = infoRepository;
}
@@ -35,24 +35,24 @@ public class BinInfoController : ControllerBase
///
///
[HttpGet("UpdateCanChargeFlag/{id}/{flag}")]
- public Result UpdateCanChargeFlag(int id, int flag)
+ public Result UpdateCanChargeFlag(int id, int flag)
{
- _BinInfoRepository.Update(it=>it.CanChargeFlag==flag,it=>it.Id==id);
+ _BinInfoRepository.Update(it => it.CanChargeFlag == flag, it => it.Id == id);
return Result.Success();
}
-
+
[HttpGet("insert")]
- public Result insert()
+ public Result insert()
{
_BinInfoRepository.Insert(new BinInfo()
{
No = "10"
});
- BinInfo queryByClause = _BinInfoRepository.QueryByClause(i=>i.Id==16);
+ BinInfo queryByClause = _BinInfoRepository.QueryByClause(i => i.Id == 16);
return Result.Success();
}
-
-
+
+
///
/// 启用禁用换电 :
/// id:仓位id
@@ -64,10 +64,19 @@ public class BinInfoController : ControllerBase
[HttpGet("UpdateCanSwapFlag/{id}/{flag}")]
public async Task> UpdateCanSwapFlag(int id, int flag)
{
-
- _BinInfoRepository.Update(it=>it.CanSwapFlag==flag,it=>it.Id==id);
+ _BinInfoRepository.Update(it => it.CanSwapFlag == flag, it => it.Id == id);
return Result.Success();
}
-
-
+
+
+ ///
+ /// 风机控制 1000:全部打开
+ ///1010:全部关闭
+ ///
+ ///
+ [HttpGet("AirBlowerControl/{cmd}")]
+ public Result AirBlower(ushort cmd)
+ {
+ return PlcMgr.AirBlowerControl(cmd) ? Result.Success() : Result.Fail();
+ }
}
\ No newline at end of file