diff --git a/WCS.BLL/DbModels/StoreInfoHistoryVoltage.cs b/WCS.BLL/DbModels/StoreInfoHistoryVoltage.cs
new file mode 100644
index 0000000..b556495
--- /dev/null
+++ b/WCS.BLL/DbModels/StoreInfoHistoryVoltage.cs
@@ -0,0 +1,141 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WCS.DAL.DbModels
+{
+ [SugarTable("wcs_store_info_history_voltage")]
+ public partial class StoreInfoHistoryVoltage
+ {
+ ///
+ /// Id
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ [SugarColumn(ColumnName = "store_id")]
+ public int StoreId { get; set; }
+ ///
+ /// 入库的库位编码
+ ///
+ [SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
+ public string StoreCode { get; set; }
+ ///
+ /// 货架类型Id
+ ///
+ [SugarColumn(ColumnName = "shelf_type_id", IsNullable = false, DefaultValue = "0", ColumnDescription = "货架类型Id")]
+ public int ShelfTypeId { get; set; }
+ ///
+ /// 模组Id
+ ///
+ [SugarColumn(ColumnName = "module_id", IsNullable = false, ColumnDescription = "模组Id")]
+ public int ModuleId { get; set; }
+
+ ///
+ /// 模组编号
+ ///
+ [SugarColumn(ColumnName = "module_code", Length = 50, IsNullable = false, ColumnDescription = "模组编码")]
+ public string ModuleCode { get; set; }
+
+ ///
+ /// 货架Id
+ ///
+ [SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架Id")]
+ public int ShelfId { get; set; }
+
+ ///
+ /// 货架号
+ ///
+ [SugarColumn(ColumnName = "shelf_code", Length = 50, IsNullable = false, ColumnDescription = "货架编码;货架一般按照报警灯来区分 一个报警灯指示的是一个货架")]
+ public string ShelfCode { get; set; }
+
+ ///
+ /// 板子的Id
+ ///
+ [SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "模组pcb板id")]
+ public int BoardId { get; set; }
+
+ ///
+ /// 板子上第几个灯
+ ///
+ [SugarColumn(ColumnName = "light_number", IsNullable = true, ColumnDescription = "板子上第几个灯")]
+ public int LightNumber { get; set; }
+
+ ///
+ /// 优先级;为钢网柜推荐库位预留
+ ///
+ [SugarColumn(ColumnName = "priority", IsNullable = true, ColumnDescription = "板子上第几个灯")]
+ public int Priority { get; set; }
+
+ ///
+ /// 记录一下查询时的历史是否有物料
+ ///
+ [SugarColumn(ColumnName = "current_mat_sn", Length = 200, IsNullable = true, ColumnDescription = "当前物料")]
+ public string CurrentMatSn { get; set; }
+
+ ///
+ /// 当前电压;当前电压,调试排查问题用
+ ///
+ [SugarColumn(ColumnName = "current_voltage", IsNullable = true, ColumnDescription = "当前电压值")]
+ public decimal CurrentVoltage { get; set; }
+
+ ///
+ /// 标准电压;标准电压,调试排查问题用
+ ///
+ [SugarColumn(ColumnName = "standard_voltage", IsNullable = true, ColumnDescription = "标准电压值")]
+ public decimal StandardVoltage { get; set; }
+
+ ///
+ /// 偏差电压;偏差电压,调试排查问题用
+ ///
+ [SugarColumn(ColumnName = "offset_voltage", IsNullable = true, ColumnDescription = "电压偏移值")]
+ public decimal OffsetVoltage { get; set; }
+
+ ///
+ /// 串联绑定后的大货架编码
+ ///
+ [SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
+ public string? BigShelfCode { get; set; } = string.Empty;
+ ///
+ /// Row 行
+ ///
+ [SugarColumn(ColumnName = "R", Length = 10, IsNullable = true, ColumnDescription = "库位 行")]
+ public string R { get; set; }
+ ///
+ /// Column 列
+ ///
+ [SugarColumn(ColumnName = "C", Length = 10, IsNullable = true, ColumnDescription = "库位 列")]
+ public string C { get; set; }
+ ///
+ /// Column 位
+ ///
+ [SugarColumn(ColumnName = "Wei", Length = 10, IsNullable = true, ColumnDescription = "库位 位 第几个库位灯")]
+ public string Wei { get; set; }
+
+ ///
+ /// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
+ ///
+ [SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
+ public string GroupName { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
+ public DateTime CreateTime { get; set; } = DateTime.Now;
+
+ ///
+ /// 序号
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int RowNumber { get; set; }
+ ///
+ /// 是否已经选择
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public bool IsSelected { get; set; }
+ }
+}
diff --git a/WCS.BLL/Manager/DbInit.cs b/WCS.BLL/Manager/DbInit.cs
index 065e18b..1f7efba 100644
--- a/WCS.BLL/Manager/DbInit.cs
+++ b/WCS.BLL/Manager/DbInit.cs
@@ -70,7 +70,7 @@ namespace WCS.BLL.Manager
DbHelp.dbLog.DbMaintenance.CreateDatabase();
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
- DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo)
+ DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo),typeof(StoreInfoHistoryVoltage)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
diff --git a/WCS.BLL/Services/IService/IStoreInfoService.cs b/WCS.BLL/Services/IService/IStoreInfoService.cs
index a3f6141..fc9633e 100644
--- a/WCS.BLL/Services/IService/IStoreInfoService.cs
+++ b/WCS.BLL/Services/IService/IStoreInfoService.cs
@@ -52,6 +52,13 @@ namespace WCS.BLL.Services.IService
///
public Task queryModuleVoltage(QueryModuleVoltageRequest request);
+
+ ///
+ /// 查询库位历史电压值-非硬件查询 仅查询软件记录的历史电压
+ ///
+ ///
+ ///
+ public Task queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request);
///
/// 标定+设置偏移量
///
diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs
index d43389e..619e965 100644
--- a/WCS.BLL/Services/Service/StoreInfoService.cs
+++ b/WCS.BLL/Services/Service/StoreInfoService.cs
@@ -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
}
}
+
+ ///
+ /// 发送指令获取模组的电压值
+ ///
+ ///
+ ///
+ ///
+ public async Task queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
+ {
+ try
+ {
+ //获取数据
+ var list = await DbHelp.db.Queryable()
+ .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 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();
+ var storeInfos = DbHelp.db.Queryable()
+ .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 { "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
}
}
diff --git a/WCS.Model/ApiModel/StoreInfo/QueryStoreInfoHistoryVoltageRequest.cs b/WCS.Model/ApiModel/StoreInfo/QueryStoreInfoHistoryVoltageRequest.cs
new file mode 100644
index 0000000..c8af222
--- /dev/null
+++ b/WCS.Model/ApiModel/StoreInfo/QueryStoreInfoHistoryVoltageRequest.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WCS.Model.ApiModel.StoreInfo
+{
+ public class QueryStoreInfoHistoryVoltageRequest : RequestBase
+ {
+ public List StoreIds { get; set; }
+ }
+}
diff --git a/WCS.Model/ApiModel/StoreInfo/StoreInfoHistoryVoltageModel.cs b/WCS.Model/ApiModel/StoreInfo/StoreInfoHistoryVoltageModel.cs
new file mode 100644
index 0000000..6c5c071
--- /dev/null
+++ b/WCS.Model/ApiModel/StoreInfo/StoreInfoHistoryVoltageModel.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WCS.Model.ApiModel.StoreInfo
+{
+ public partial class StoreInfoHistoryVoltageModel
+ {
+ public int Id { get; set; }
+
+ public string StoreCode { get; set; }
+ public int ShelfTypeId { get; set; }
+ public int ModuleId { get; set; }
+
+ public string ModuleCode { get; set; }
+
+ public int ShelfId { get; set; }
+
+ public string ShelfCode { get; set; }
+
+ public int BoardId { get; set; }
+
+ public int LightNumber { get; set; }
+
+ public int Priority { get; set; }
+
+ public string CurrentMatSn { get; set; }
+
+ public decimal CurrentVoltage { get; set; }
+
+ public decimal StandardVoltage { get; set; }
+
+ public decimal OffsetVoltage { get; set; }
+
+ public string BigShelfCode { get; set; }
+ public string R { get; set; }
+ public string C { get; set; }
+ public string Wei { get; set; }
+ public string GroupName { get; set; }
+ public DateTime CreateTime { get; set; }
+ public int RowNumber { get; set; }
+ public bool IsSelected { get; set; }
+ }
+}
diff --git a/WCS.WebApi/Controllers/StoreInfoController.cs b/WCS.WebApi/Controllers/StoreInfoController.cs
index f4a8fa1..4c95616 100644
--- a/WCS.WebApi/Controllers/StoreInfoController.cs
+++ b/WCS.WebApi/Controllers/StoreInfoController.cs
@@ -44,7 +44,6 @@ namespace WCS.WebApi.Controllers
}
#endregion
-
#region 模组管理
[Route("getModules")]
[HttpPost(Name = "getModules")]
@@ -67,6 +66,13 @@ namespace WCS.WebApi.Controllers
return await _storeInfoService.queryModuleVoltage(request);
}
+ [Route("queryStoreInfoHistoryVoltage")]
+ [HttpPost(Name = "queryStoreInfoHistoryVoltage")]
+ public async Task queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
+ {
+ return await _storeInfoService.queryStoreInfoHistoryVoltage(request);
+ }
+
[Route("calibrationSetOffset")]
[HttpPost(Name = "calibrationSetOffset")]
public async Task calibrationSetOffset(CalibrationSetOffsetRequest request)
diff --git a/货架标准上位机/Views/StoreInfoView.xaml b/货架标准上位机/Views/StoreInfoView.xaml
index 68eb77b..6ee5984 100644
--- a/货架标准上位机/Views/StoreInfoView.xaml
+++ b/货架标准上位机/Views/StoreInfoView.xaml
@@ -90,6 +90,11 @@
SelectionChanged="dataGrid_SelectionChanged"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
+
+
+
+
+
diff --git a/货架标准上位机/Views/StoreInfoView.xaml.cs b/货架标准上位机/Views/StoreInfoView.xaml.cs
index c0f83e6..e427a65 100644
--- a/货架标准上位机/Views/StoreInfoView.xaml.cs
+++ b/货架标准上位机/Views/StoreInfoView.xaml.cs
@@ -1,4 +1,5 @@
-using Ping9719.WpfEx;
+using HandyControl.Controls;
+using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -14,7 +15,10 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
+using WCS.Model.ApiModel.StoreInfo;
+using WCS.Model;
using 智能仓储WCS管理系统.ViewModel;
+using 智能仓储WCS管理系统.Api;
namespace 智能仓储WCS管理系统
{
@@ -86,5 +90,50 @@ namespace 智能仓储WCS管理系统
{
;
}
+
+ private void MenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ //先获取选中的模组
+ var storeInfo = viewModel.SelectedataGridItem;
+ #region 调用接口 发送指令进行查询
+ try
+ {
+ var body = new QueryStoreInfoHistoryVoltageRequest()
+ {
+ StoreIds = new List() { storeInfo.Id },
+ UserName = LocalStatic.CurrentUser,
+ DeviceType = LocalFile.Config.DeviceType,
+ };
+ var Result = ApiHelp.GetDataFromHttp>>(LocalFile.Config.ApiIpHost + "storeInfo/queryStoreInfoHistoryVoltage", body, "POST");
+ if (Result != null && Result.Code == 200)
+ {
+ if (Result.Data == null || Result.Data.Count == 0)
+ {
+ Growl.Success("查询成功!该库位没有历史电压值数据!");
+ return;
+ }
+ else
+ {
+ Growl.Success("查询成功!请查看弹窗内数据!");
+ var window = new StoreInfoHistoryVoltageWindow(Result.Data, storeInfo.StoreCode);
+ window.ShowDialog();
+ }
+
+ }
+ else if (Result != null)
+ {
+ Growl.Success(Result.Message);
+ }
+ }
+ catch (Exception ex)
+ {
+ Growl.Warning("查询失败:" + ex.Message);
+ }
+ finally
+ {
+
+ }
+ #endregion
+ }
}
}
diff --git a/货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs b/货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs
index 7fa96ff..6d7ebcf 100644
--- a/货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs
+++ b/货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs
@@ -133,7 +133,7 @@ namespace 智能仓储WCS管理系统
Growl.Success("发送标定指令成功!");
this.Close();
}
- else if (Result != null)
+ else if (Result1 != null)
{
Growl.Error(Result1.Message);
}
diff --git a/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml b/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml
new file mode 100644
index 0000000..2df9399
--- /dev/null
+++ b/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml.cs b/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml.cs
new file mode 100644
index 0000000..c7da3a4
--- /dev/null
+++ b/货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml.cs
@@ -0,0 +1,44 @@
+using HandyControl.Controls;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using WCS.Model;
+using WCS.Model.ApiModel;
+using WCS.Model.ApiModel.StoreInfo;
+using WCS.Model.ApiModel.User;
+using 智能仓储WCS管理系统.Api;
+
+namespace 智能仓储WCS管理系统
+{
+ ///
+ /// CalibrationWindow.xaml 的交互逻辑
+ ///
+ public partial class StoreInfoHistoryVoltageWindow : System.Windows.Window
+ {
+ public StoreInfoHistoryVoltageWindow(List list,string storeCode)
+ {
+ InitializeComponent();
+ dataGrid.ItemsSource = list;
+ this.storeCodeTxt.Text = storeCode;
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
diff --git a/货架标准上位机/货架标准上位机.csproj b/货架标准上位机/货架标准上位机.csproj
index eb2d627..aaa8a8d 100644
--- a/货架标准上位机/货架标准上位机.csproj
+++ b/货架标准上位机/货架标准上位机.csproj
@@ -8,8 +8,8 @@
latest
重庆盟讯电子科技有限公司
Copyright © 2024
- 1.0.0
- 1.0.0
+ 1.0.1
+ 1.0.1
Resources\Logo.ico
重庆盟讯电子科技有限公司
智能仓储WCS管理系统