测试现有接口更改

zw
lxw 6 months ago
parent 09993a89f2
commit ff7961545a

@ -6,7 +6,9 @@ using Entity.DbModel.System;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Configuration;
using Microsoft.AspNetCore.Http;
using Npgsql.TypeHandlers;
using Repository.System;
using Yitter.IdGenerator;
namespace Service.Mgr
{
@ -86,11 +88,12 @@ namespace Service.Mgr
throw new ArgumentException($"文件超过允许大小");
// 获取文件后缀
var suffix = Path.GetExtension(file.FileName).ToLower(); // 后缀
suffix ="."+ file.ContentType.Split("/")[1];
if (string.IsNullOrWhiteSpace(suffix))
throw new ArgumentException($"文件后缀错误");
var newFile = new SysFile
{
//Id = YitIdHelper.NextId(),
Id = DateTime.Now.Millisecond,
FileName = Path.GetFileNameWithoutExtension(file.FileName),
Suffix = suffix,

@ -21,12 +21,12 @@ namespace Service.Station;
[Scope("SingleInstance")]
public class MonitorService
{
private static readonly ILog Log = LogManager.GetLogger(typeof(MonitorService));
public BinInfoRepository BinInfoRepository { get; set; }
public SwapOrderRepository SwapOrderRepository { get; set; }
public ChargeOrderRepository ChargeOrderRepository { get; set; }
public PlcTaskMgr PlcTaskMgr { get; set; }
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
{
var configBinInfo =
@ -102,14 +102,14 @@ public class MonitorService
/// 连接状态类
/// </summary>
/// <returns></returns>
public Result<DeviceStateResp> GetDeviceState()
public async Task<Result<DeviceStateResp>> GetDeviceState()
{
var isConnected = TBoxApi.IsConnected();
var isConnected = await TBoxApi.IsConnected();
DeviceStateResp resp = new()
{
BoxConnectFlag = isConnected.Result != null ? isConnected.Result : false,
CloudConnectFlag = CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = PlcMgr.PlcClient.Connected
BoxConnectFlag = isConnected != null ? isConnected : false,
CloudConnectFlag = CloudClientMgr.CloudClient==null? false:CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = PlcMgr.PlcClient==null? false:PlcMgr.PlcClient.Connected
};
return Result<DeviceStateResp>.Success(resp);
@ -175,9 +175,9 @@ public class MonitorService
result = PlcMgr.HoldOn();
if (!result)
{
return Result<bool>.Fail();
}
Log.Info($"battery move task Manual removeBinNo={removeBinNo}, putBinNo={putBinNo} ");
var queryPlcTask = PlcTaskMgr.QueryPlcTask(2, 1200, 1201);
@ -206,8 +206,8 @@ public class MonitorService
removeBin.Soh = -1;
BinInfoRepository.Update(removeBin);
}
return Result<bool>.Success();
return Result<bool>.Success();
return Result<bool>.Success();

@ -34,7 +34,7 @@ public class SwapMonitorController : ControllerBase
[HttpPost("GetDeviceState")]
public async Task<Result<DeviceStateResp>> GetDeviceState()
{
return _swapMonitorService.GetDeviceState();
return await _swapMonitorService.GetDeviceState();
}
/// <summary>

Loading…
Cancel
Save