测试现有接口更改

master
lxw 6 months ago
parent 09993a89f2
commit ff7961545a

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

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

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

Loading…
Cancel
Save