软件增加功能:标定时记录上一次的历史电压

This commit is contained in:
hehaibing-1996
2024-11-12 08:33:28 +08:00
parent 6282ecc0c1
commit 40024b339d
13 changed files with 422 additions and 8 deletions

View File

@ -52,6 +52,13 @@ namespace WCS.BLL.Services.IService
/// <returns></returns>
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
/// <summary>
/// 查询库位历史电压值-非硬件查询 仅查询软件记录的历史电压
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request);
/// <summary>
/// 标定+设置偏移量
/// </summary>

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -491,6 +492,39 @@ namespace WCS.BLL.Services.Service
}
}
/// <summary>
/// 发送指令获取模组的电压值
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<ResponseCommon> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
{
try
{
//获取数据
var list = await DbHelp.db.Queryable<StoreInfoHistoryVoltage>()
.Where(t => request.StoreIds.Contains(t.StoreId))
.OrderByDescending(t => t.Id)
.ToListAsync();
return new ResponseCommon()
{
Code = 200,
Message = "Success",
Data = list
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 300,
Message = "操作失败:" + ex.Message
};
}
}
public async Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request)
{
try
@ -503,22 +537,67 @@ namespace WCS.BLL.Services.Service
if (shelf != null && shelf is SmartShelf)
{
var smartShelf = (SmartShelf)shelf;
#region
//2024/11/11 程心怡说刘一科长喊加的
//需求来源:微信
//软件加光衰标定值,观察光衰数据
//相当于就是你那边软件要记录一下上一次标定的值
//相当于,到时候我们这边板子上完了,我会手动用你的软件标定一次,你那边就记录数据。
var time = DateTime.Now;
var historyList = new List<StoreInfoHistoryVoltage>();
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
.Where(t => t.ModuleId == module.Id)
.Where(t => t.BoardId == module.BoardId)
.OrderBy(t => t.LightNumber)
.ToList();
storeInfos.ForEach(t =>
{
historyList.Add(new StoreInfoHistoryVoltage()
{
StoreId = t.Id,
StoreCode = t.StoreCode,
ShelfTypeId = t.ShelfTypeId,
ModuleId = module.Id,
ModuleCode = t.ModuleCode,
ShelfId = t.ShelfId,
ShelfCode = t.ShelfCode,
BoardId = t.BoardId,
LightNumber = t.LightNumber,
Priority = t.Priority,
CurrentMatSn = t.CurrentMatSn,
CurrentVoltage = t.CurrentVoltage,
StandardVoltage = t.StandardVoltage,
OffsetVoltage = t.OffsetVoltage,
BigShelfCode = t.BigShelfCode,
R = t.R,
C = t.C,
Wei = t.Wei,
GroupName = t.GroupName,
CreateTime = time,
});
});
DbHelp.db.Insertable(historyList).ExecuteCommand();
#endregion
smartShelf.CalibrationSetOffset(module.Id, request.OffSet);
isSend = true;
}
}
if (isSend)
{
return new ResponseCommon()
{
Code = 200,
Message = "Success"
};
}
else
{
return new ResponseCommon()
{
Code = 201,
Message = "操作失败:未找到对应模组"
};
}
}
catch (Exception ex)
{
@ -602,7 +681,7 @@ namespace WCS.BLL.Services.Service
var DingDing = string.Empty;
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
Logs.Write($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!");
#region
Task.Run(() =>
{
@ -769,7 +848,7 @@ namespace WCS.BLL.Services.Service
{
Code = 200,
Message = $"Success",
Data = message ,
Data = message,
};
}
catch (Exception ex)
@ -783,6 +862,7 @@ namespace WCS.BLL.Services.Service
}
}
#endregion
}
}