Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
ddc0b13813 | |||
05a66dc2d3 | |||
dfe65e806d | |||
9e16a001c0 | |||
963ffc4ad2 | |||
15ccafbd5e | |||
9f5fdc24e9 | |||
6fbc90dac3 | |||
40024b339d | |||
6282ecc0c1 | |||
d64dbe4c33 |
@ -103,6 +103,18 @@ namespace WCS.DAL.DbModels
|
|||||||
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
|
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
|
||||||
public string? BigShelfCode { get; set; } = string.Empty;
|
public string? BigShelfCode { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每块板子的灯数量
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "light_count", IsNullable = true, ColumnDescription = "每块板子的灯数量")]
|
||||||
|
public int LightCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每块板子的灯数量
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "first_board_id", IsNullable = true, ColumnDescription = "左上角的板子id")]
|
||||||
|
public int FirtstBoardId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序号
|
/// 序号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
141
WCS.BLL/DbModels/StoreInfoHistoryVoltage.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "store_id")]
|
||||||
|
public int StoreId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 入库的库位编码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
|
||||||
|
public string StoreCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 货架类型Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "shelf_type_id", IsNullable = false, DefaultValue = "0", ColumnDescription = "货架类型Id")]
|
||||||
|
public int ShelfTypeId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 模组Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "module_id", IsNullable = false, ColumnDescription = "模组Id")]
|
||||||
|
public int ModuleId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模组编号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "module_code", Length = 50, IsNullable = false, ColumnDescription = "模组编码")]
|
||||||
|
public string ModuleCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "shelf_id", IsNullable = false, ColumnDescription = "货架Id")]
|
||||||
|
public int ShelfId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "shelf_code", Length = 50, IsNullable = false, ColumnDescription = "货架编码;货架一般按照报警灯来区分 一个报警灯指示的是一个货架")]
|
||||||
|
public string ShelfCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 板子的Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "board_id", IsNullable = false, ColumnDescription = "模组pcb板id")]
|
||||||
|
public int BoardId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 板子上第几个灯
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "light_number", IsNullable = true, ColumnDescription = "板子上第几个灯")]
|
||||||
|
public int LightNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级;为钢网柜推荐库位预留
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "priority", IsNullable = true, ColumnDescription = "板子上第几个灯")]
|
||||||
|
public int Priority { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录一下查询时的历史是否有物料
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "current_mat_sn", Length = 200, IsNullable = true, ColumnDescription = "当前物料")]
|
||||||
|
public string CurrentMatSn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前电压;当前电压,调试排查问题用
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "current_voltage", IsNullable = true, ColumnDescription = "当前电压值")]
|
||||||
|
public decimal CurrentVoltage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标准电压;标准电压,调试排查问题用
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "standard_voltage", IsNullable = true, ColumnDescription = "标准电压值")]
|
||||||
|
public decimal StandardVoltage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 偏差电压;偏差电压,调试排查问题用
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "offset_voltage", IsNullable = true, ColumnDescription = "电压偏移值")]
|
||||||
|
public decimal OffsetVoltage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 串联绑定后的大货架编码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Bind_shelf_code", IsNullable = true, ColumnDescription = "串联绑定后的大货架编码")]
|
||||||
|
public string? BigShelfCode { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// Row 行
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "R", Length = 10, IsNullable = true, ColumnDescription = "库位 行")]
|
||||||
|
public string R { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Column 列
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "C", Length = 10, IsNullable = true, ColumnDescription = "库位 列")]
|
||||||
|
public string C { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Column 位
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Wei", Length = 10, IsNullable = true, ColumnDescription = "库位 位 第几个库位灯")]
|
||||||
|
public string Wei { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
|
||||||
|
public string GroupName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public int RowNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否已经选择
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public bool IsSelected { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1697,12 +1697,53 @@ namespace WCS.BLL.HardWare
|
|||||||
}
|
}
|
||||||
//当前库位未记录MatSn
|
//当前库位未记录MatSn
|
||||||
if (string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
if (string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||||
|
{
|
||||||
|
if (data[TcpCleint.PreFixLength + 6] == 0x0D &&
|
||||||
|
data[TcpCleint.PreFixLength + 7] == 0x0D &&
|
||||||
|
data[TcpCleint.PreFixLength + 8] == 0x0D &&
|
||||||
|
data[TcpCleint.PreFixLength + 9] == 0x0D)
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
var historyVoltage = new StoreInfoHistoryVoltage()
|
||||||
|
{
|
||||||
|
StoreId = storeInfo.Id,
|
||||||
|
StoreCode = storeInfo.StoreCode,
|
||||||
|
ShelfTypeId = storeInfo.ShelfTypeId,
|
||||||
|
ModuleId = storeInfo.ModuleId,
|
||||||
|
ModuleCode = storeInfo.ModuleCode,
|
||||||
|
ShelfId = storeInfo.ShelfId,
|
||||||
|
ShelfCode = storeInfo.ShelfCode,
|
||||||
|
BoardId = storeInfo.BoardId,
|
||||||
|
LightNumber = storeInfo.LightNumber,
|
||||||
|
Priority = storeInfo.Priority,
|
||||||
|
CurrentMatSn = storeInfo.CurrentMatSn,
|
||||||
|
CurrentVoltage = storeInfo.CurrentVoltage,
|
||||||
|
StandardVoltage = storeInfo.StandardVoltage,
|
||||||
|
OffsetVoltage = storeInfo.OffsetVoltage,
|
||||||
|
BigShelfCode = storeInfo.BigShelfCode,
|
||||||
|
R = storeInfo.R,
|
||||||
|
C = storeInfo.C,
|
||||||
|
Wei = storeInfo.Wei,
|
||||||
|
GroupName = "出库自动标定记录历史电压",
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
//自动保存最新的电压值
|
||||||
|
storeInfo.CurrentVoltage = (data[TcpCleint.PreFixLength + 4] << 8) + data[TcpCleint.PreFixLength + 5];
|
||||||
|
DbHelp.db.Insertable(historyVoltage).ExecuteCommand();
|
||||||
|
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
|
||||||
|
});
|
||||||
|
Thread.Sleep(10);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//该库位是需要出库的库位,物料被多次取出or给了多个正常出库信号
|
//该库位是需要出库的库位,物料被多次取出or给了多个正常出库信号
|
||||||
Logs.Write($"该库位是需要出库的库位,物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}", LogsType.Outstore);
|
Logs.Write($"该库位是需要出库的库位,物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}", LogsType.Outstore);
|
||||||
//暂不进行处理
|
//暂不进行处理
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//不是本次出库需要出的物料
|
//不是本次出库需要出的物料
|
||||||
if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn))
|
if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn))
|
||||||
|
@ -122,12 +122,22 @@ namespace WCS.BLL.HardWare
|
|||||||
.OrderBy(t => t.LightNumber)
|
.OrderBy(t => t.LightNumber)
|
||||||
.ToList();
|
.ToList();
|
||||||
char[] data = "0000000000000000".ToCharArray();
|
char[] data = "0000000000000000".ToCharArray();
|
||||||
|
|
||||||
|
//禁用
|
||||||
|
char[] dataBan = "0000000000000000".ToCharArray();
|
||||||
|
|
||||||
var boardStoreNumber = storeInfos.Count();
|
var boardStoreNumber = storeInfos.Count();
|
||||||
foreach (var storeInfo in storeInfos)
|
foreach (var storeInfo in storeInfos)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
|
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
|
||||||
{
|
{
|
||||||
data[storeInfo.LightNumber - 1] = '1';
|
data[storeInfo.LightNumber - 1] = '1';
|
||||||
|
|
||||||
|
//禁用
|
||||||
|
if (storeInfo.CurrentMatSn == "禁用")
|
||||||
|
{
|
||||||
|
dataBan[storeInfo.LightNumber - 1] = '1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dataStr = string.Join("", data.Reverse());
|
var dataStr = string.Join("", data.Reverse());
|
||||||
@ -136,6 +146,13 @@ namespace WCS.BLL.HardWare
|
|||||||
GoInInstoreData[1] = Convert.ToByte(data1, 2);
|
GoInInstoreData[1] = Convert.ToByte(data1, 2);
|
||||||
GoInInstoreData[2] = Convert.ToByte(data2, 2);
|
GoInInstoreData[2] = Convert.ToByte(data2, 2);
|
||||||
|
|
||||||
|
//禁用
|
||||||
|
var dataBanStr = string.Join("", dataBan.Reverse());
|
||||||
|
var data1Ban = dataBanStr.Substring(8, 8);
|
||||||
|
var data2Ban = dataBanStr.Substring(0, 8);
|
||||||
|
GoInInstoreData[6] = Convert.ToByte(data1Ban, 2);
|
||||||
|
GoInInstoreData[7] = Convert.ToByte(data2Ban, 2);
|
||||||
|
|
||||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInInstoreData));
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInInstoreData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,12 +204,21 @@ namespace WCS.BLL.HardWare
|
|||||||
.OrderBy(t => t.LightNumber)
|
.OrderBy(t => t.LightNumber)
|
||||||
.ToList();
|
.ToList();
|
||||||
char[] data = "0000000000000000".ToCharArray();
|
char[] data = "0000000000000000".ToCharArray();
|
||||||
|
//禁用功能
|
||||||
|
char[] dataBan = "0000000000000000".ToCharArray();
|
||||||
|
|
||||||
var boardStoreNumber = storeInfos.Count();
|
var boardStoreNumber = storeInfos.Count();
|
||||||
foreach (var storeInfo in storeInfos)
|
foreach (var storeInfo in storeInfos)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
|
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
|
||||||
{
|
{
|
||||||
data[storeInfo.LightNumber - 1] = '1';
|
data[storeInfo.LightNumber - 1] = '1';
|
||||||
|
|
||||||
|
//禁用功能
|
||||||
|
if (storeInfo.CurrentMatSn == "禁用")
|
||||||
|
{
|
||||||
|
dataBan[storeInfo.LightNumber - 1] = '1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dataStr = string.Join("", data.Reverse());
|
var dataStr = string.Join("", data.Reverse());
|
||||||
@ -201,6 +227,13 @@ namespace WCS.BLL.HardWare
|
|||||||
CheckModeData[1] = Convert.ToByte(data1, 2);
|
CheckModeData[1] = Convert.ToByte(data1, 2);
|
||||||
CheckModeData[2] = Convert.ToByte(data2, 2);
|
CheckModeData[2] = Convert.ToByte(data2, 2);
|
||||||
|
|
||||||
|
//禁用功能
|
||||||
|
var dataBanStr = string.Join("", dataBan.Reverse());
|
||||||
|
var data1Ban = dataBanStr.Substring(8, 8);
|
||||||
|
var data2Ban = dataBanStr.Substring(0, 8);
|
||||||
|
CheckModeData[6] = Convert.ToByte(data1Ban, 2);
|
||||||
|
CheckModeData[7] = Convert.ToByte(data2Ban, 2);
|
||||||
|
|
||||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
|
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,12 +251,21 @@ namespace WCS.BLL.HardWare
|
|||||||
.ToList();
|
.ToList();
|
||||||
//计算物料在库的库位
|
//计算物料在库的库位
|
||||||
char[] data = "0000000000000000".ToCharArray();
|
char[] data = "0000000000000000".ToCharArray();
|
||||||
|
|
||||||
|
//计算禁用的库位
|
||||||
|
char[] dataBan = "0000000000000000".ToCharArray();
|
||||||
|
|
||||||
var storeNumber = storeInfos.Count();
|
var storeNumber = storeInfos.Count();
|
||||||
foreach (var storeInfo in storeInfos)
|
foreach (var storeInfo in storeInfos)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= storeNumber)
|
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= storeNumber)
|
||||||
{
|
{
|
||||||
data[storeInfo.LightNumber - 1] = '1';
|
data[storeInfo.LightNumber - 1] = '1';
|
||||||
|
//禁用
|
||||||
|
if (storeInfo.CurrentMatSn == "禁用")
|
||||||
|
{
|
||||||
|
dataBan[storeInfo.LightNumber - 1] = '1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dataStr = string.Join("", data.Reverse());
|
var dataStr = string.Join("", data.Reverse());
|
||||||
@ -232,6 +274,13 @@ namespace WCS.BLL.HardWare
|
|||||||
GoInOutstoreModeData[1] = Convert.ToByte(data1, 2);
|
GoInOutstoreModeData[1] = Convert.ToByte(data1, 2);
|
||||||
GoInOutstoreModeData[2] = Convert.ToByte(data2, 2);
|
GoInOutstoreModeData[2] = Convert.ToByte(data2, 2);
|
||||||
|
|
||||||
|
//禁用
|
||||||
|
var dataBanStr = string.Join("", dataBan.Reverse());
|
||||||
|
var data1Ban = dataBanStr.Substring(8, 8);
|
||||||
|
var data2Ban = dataBanStr.Substring(0, 8);
|
||||||
|
GoInOutstoreModeData[6] = Convert.ToByte(data1Ban, 2);
|
||||||
|
GoInOutstoreModeData[7] = Convert.ToByte(data2Ban, 2);
|
||||||
|
|
||||||
//出库位置亮灯
|
//出库位置亮灯
|
||||||
if (outSns != null && outSns.Count > 0)
|
if (outSns != null && outSns.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ namespace WCS.BLL.Manager
|
|||||||
DbHelp.dbLog.DbMaintenance.CreateDatabase();
|
DbHelp.dbLog.DbMaintenance.CreateDatabase();
|
||||||
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
|
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(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
|
||||||
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
|
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
|
||||||
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
||||||
|
@ -136,6 +136,14 @@ namespace WCS.BLL.Manager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (warning.WarningType == WarningTypeEnum.入库中未扫描上架 ||
|
||||||
|
warning.WarningType == WarningTypeEnum.入库中异常取出 ||
|
||||||
|
warning.WarningType == WarningTypeEnum.出库中丢失 ||
|
||||||
|
warning.WarningType == WarningTypeEnum.出库中未扫描上架)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#region 重新发指令进入对应模式
|
#region 重新发指令进入对应模式
|
||||||
Logs.Write($"GoInRightMode", LogsType.WebSocket);
|
Logs.Write($"GoInRightMode", LogsType.WebSocket);
|
||||||
GoInRightMode(warning);
|
GoInRightMode(warning);
|
||||||
|
@ -52,6 +52,13 @@ namespace WCS.BLL.Services.IService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
|
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询库位历史电压值-非硬件查询 仅查询软件记录的历史电压
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<ResponseCommon> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标定+设置偏移量
|
/// 标定+设置偏移量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
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)
|
public async Task<ResponseCommon> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -503,23 +537,68 @@ namespace WCS.BLL.Services.Service
|
|||||||
if (shelf != null && shelf is SmartShelf)
|
if (shelf != null && shelf is SmartShelf)
|
||||||
{
|
{
|
||||||
var smartShelf = (SmartShelf)shelf;
|
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);
|
smartShelf.CalibrationSetOffset(module.Id, request.OffSet);
|
||||||
isSend = true;
|
isSend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isSend)
|
if (isSend)
|
||||||
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 200,
|
Code = 200,
|
||||||
Message = "Success"
|
Message = "Success"
|
||||||
};
|
};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
{
|
{
|
||||||
Code = 201,
|
Code = 201,
|
||||||
Message = "操作失败:未找到对应模组"
|
Message = "操作失败:未找到对应模组"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return new ResponseCommon()
|
return new ResponseCommon()
|
||||||
@ -783,6 +862,7 @@ namespace WCS.BLL.Services.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,8 @@ namespace WCS.BLL
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logs.Write("【发送指令时发生异常】" + ex.Message, LogsType.Instructions);
|
var clientIpHost = tcpClient.IP + ":" + tcpClient.Port;
|
||||||
|
Logs.Write($"【发送指令时发生异常{clientIpHost}】" + ex.Message, LogsType.Instructions);
|
||||||
//因异常断连时(网线已经被断了) 手动重连一次
|
//因异常断连时(网线已经被断了) 手动重连一次
|
||||||
if (ex is NotConnectedException)
|
if (ex is NotConnectedException)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,11 @@ namespace WCS.Model.ApiModel.MXL4
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string MatBatch { get; set; }
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料SN
|
||||||
|
/// </summary>
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量
|
/// 数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.StoreInfo
|
||||||
|
{
|
||||||
|
public class QueryStoreInfoHistoryVoltageRequest : RequestBase
|
||||||
|
{
|
||||||
|
public List<int> StoreIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
44
WCS.Model/ApiModel/StoreInfo/StoreInfoHistoryVoltageModel.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,8 @@ using WCS.Model.ApiModel.StoreInfo;
|
|||||||
using WCS.BLL.DbModels;
|
using WCS.BLL.DbModels;
|
||||||
using WCS.Model.ApiModel.MatBaseInfo;
|
using WCS.Model.ApiModel.MatBaseInfo;
|
||||||
using WCS.DAL.DbModels;
|
using WCS.DAL.DbModels;
|
||||||
|
using WCS.DAL.Db;
|
||||||
|
using WCS.BLL.Config;
|
||||||
|
|
||||||
namespace WCS.WebApi.Controllers
|
namespace WCS.WebApi.Controllers
|
||||||
{
|
{
|
||||||
@ -44,7 +46,6 @@ namespace WCS.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 模组管理
|
#region 模组管理
|
||||||
[Route("getModules")]
|
[Route("getModules")]
|
||||||
[HttpPost(Name = "getModules")]
|
[HttpPost(Name = "getModules")]
|
||||||
@ -67,6 +68,13 @@ namespace WCS.WebApi.Controllers
|
|||||||
return await _storeInfoService.queryModuleVoltage(request);
|
return await _storeInfoService.queryModuleVoltage(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("queryStoreInfoHistoryVoltage")]
|
||||||
|
[HttpPost(Name = "queryStoreInfoHistoryVoltage")]
|
||||||
|
public async Task<ResponseBase> queryStoreInfoHistoryVoltage(QueryStoreInfoHistoryVoltageRequest request)
|
||||||
|
{
|
||||||
|
return await _storeInfoService.queryStoreInfoHistoryVoltage(request);
|
||||||
|
}
|
||||||
|
|
||||||
[Route("calibrationSetOffset")]
|
[Route("calibrationSetOffset")]
|
||||||
[HttpPost(Name = "calibrationSetOffset")]
|
[HttpPost(Name = "calibrationSetOffset")]
|
||||||
public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||||
@ -96,6 +104,125 @@ namespace WCS.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
return await _storeInfoService.getDisablePercent();
|
return await _storeInfoService.getDisablePercent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Route("genModuleStoreInfos")]
|
||||||
|
[HttpPost(Name = "genModuleStoreInfos")]
|
||||||
|
public async Task<ResponseBase> genModuleStoreInfos(RequestBase request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request.UserName != "aaa")
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "用户名不对头!无法生成模组库位"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//获取货架 此组后端管的货架
|
||||||
|
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>()
|
||||||
|
.Where(t => t.GroupName == LocalFile.Config.GroupName)
|
||||||
|
.OrderBy(t => t.BigShelfCode)
|
||||||
|
.OrderBy(t => t.ShelfCode)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var lastBindBigShelfCode = string.Empty;
|
||||||
|
var lastColumnCount = 1;
|
||||||
|
|
||||||
|
List<ModuleInfo> moduleInfos = new List<ModuleInfo>();
|
||||||
|
//生成模组
|
||||||
|
foreach (var shelfInfo in shelfInfos)
|
||||||
|
{
|
||||||
|
var modulePreFix = shelfInfo.IsBind ? shelfInfo.BigShelfCode : shelfInfo.ShelfCode;
|
||||||
|
//不绑定或者绑定换了面 重新从1开始计数
|
||||||
|
if (shelfInfo.BigShelfCode != lastBindBigShelfCode)
|
||||||
|
{
|
||||||
|
lastColumnCount = 1;
|
||||||
|
}
|
||||||
|
lastBindBigShelfCode = shelfInfo.BigShelfCode;
|
||||||
|
for (int rowIndex = 0; rowIndex < shelfInfo.Rowcounts; rowIndex++)
|
||||||
|
{
|
||||||
|
for (int columnIndex = 0; columnIndex < shelfInfo.Columncounts; columnIndex++)
|
||||||
|
{
|
||||||
|
var moduleCode = modulePreFix + "-R" + (rowIndex + 1).ToString() + "C" + (lastColumnCount + columnIndex).ToString();
|
||||||
|
var moduleInfo = new ModuleInfo()
|
||||||
|
{
|
||||||
|
ModuleCode = moduleCode,
|
||||||
|
ShelfTypeId = shelfInfo.ShelfTypeId,
|
||||||
|
ShelfId = shelfInfo.Id,
|
||||||
|
ShelfCode = shelfInfo.ShelfCode,
|
||||||
|
BoardId = shelfInfo.FirtstBoardId++,
|
||||||
|
LightCount = shelfInfo.LightCount,
|
||||||
|
CleintIp = shelfInfo.ClientIp,
|
||||||
|
GroupName = shelfInfo.GroupName,
|
||||||
|
R = (rowIndex + 1).ToString(),
|
||||||
|
C = (lastColumnCount + columnIndex).ToString(),
|
||||||
|
Bigshelfcode = shelfInfo.BigShelfCode,
|
||||||
|
IsEnable = true,
|
||||||
|
CurrentMode = BLL.HardWare.Mode.待机模式,
|
||||||
|
};
|
||||||
|
moduleInfos.Add(moduleInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastColumnCount = lastColumnCount + shelfInfo.Columncounts;
|
||||||
|
}
|
||||||
|
DbHelp.db.Insertable(moduleInfos).ExecuteCommand();
|
||||||
|
//生成库位
|
||||||
|
moduleInfos = DbHelp.db.Queryable<ModuleInfo>()
|
||||||
|
.Where(t => t.GroupName == LocalFile.Config.GroupName)
|
||||||
|
.OrderBy(t => t.Id)
|
||||||
|
.ToList();
|
||||||
|
List<StoreInfo> storeInfos = new List<StoreInfo>();
|
||||||
|
|
||||||
|
foreach (var moduleInfo in moduleInfos)
|
||||||
|
{
|
||||||
|
for (int wei = 0; wei < moduleInfo.LightCount; wei++)
|
||||||
|
{
|
||||||
|
var storeCode = moduleInfo.ModuleCode + "-" + (wei + 1).ToString();
|
||||||
|
var stroreInfo = new StoreInfo()
|
||||||
|
{
|
||||||
|
StoreCode = storeCode,
|
||||||
|
ShelfTypeId = moduleInfo.ShelfTypeId,
|
||||||
|
ModuleId = moduleInfo.Id,
|
||||||
|
ModuleCode = moduleInfo.ModuleCode,
|
||||||
|
ShelfId = moduleInfo.ShelfId,
|
||||||
|
ShelfCode = moduleInfo.ShelfCode,
|
||||||
|
BoardId = moduleInfo.BoardId,
|
||||||
|
LightNumber = wei + 1,
|
||||||
|
Priority = 0,
|
||||||
|
CurrentMatSn = string.Empty,
|
||||||
|
CurrentVoltage = 0,
|
||||||
|
StandardVoltage = 0,
|
||||||
|
OffsetVoltage = 0,
|
||||||
|
BigShelfCode = moduleInfo.Bigshelfcode,
|
||||||
|
R = moduleInfo.R,
|
||||||
|
C = moduleInfo.C,
|
||||||
|
Wei = (wei + 1).ToString(),
|
||||||
|
GroupName = moduleInfo.GroupName
|
||||||
|
};
|
||||||
|
storeInfos.Add(stroreInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DbHelp.db.Insertable(storeInfos).ExecuteCommand();
|
||||||
|
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "生成库位成功"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseBase()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = ex.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
版本履历表.xlsx
Normal file
@ -21,8 +21,8 @@
|
|||||||
<!--字体-->
|
<!--字体-->
|
||||||
<FontFamily x:Key="IconFont">pack://application,,,/智能仓储WCS管理系统;component/Fonts/#iconfont</FontFamily>
|
<FontFamily x:Key="IconFont">pack://application,,,/智能仓储WCS管理系统;component/Fonts/#iconfont</FontFamily>
|
||||||
<!--字符串-->
|
<!--字符串-->
|
||||||
<!--<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>-->
|
<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>
|
||||||
<sys:String x:Key="AboutInfo1">金川数智</sys:String>
|
<!--<sys:String x:Key="AboutInfo1">金川数智</sys:String>-->
|
||||||
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 18 KiB |
BIN
货架标准上位机/Resources/LogoJC.ico
Normal file
After Width: | Height: | Size: 264 KiB |
BIN
货架标准上位机/Resources/LogoJC.png
Normal file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
@ -4,7 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO.Ports;
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.SerialPorts;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
using 智能仓储WCS管理系统.Views.Controls;
|
using 智能仓储WCS管理系统.Views.Controls;
|
||||||
|
|
||||||
namespace 智能仓储WCS管理系统
|
namespace 智能仓储WCS管理系统
|
||||||
@ -22,29 +24,33 @@ namespace 智能仓储WCS管理系统
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var _serialPort = new SerialPort();
|
var client = new SerialPortClient();
|
||||||
|
//成功连接到端口
|
||||||
// 初始化串口配置
|
client.Connected = (client, e) =>
|
||||||
_serialPort = new SerialPort
|
|
||||||
{
|
{
|
||||||
PortName = COM,
|
Logs.Write($"扫码枪{client.MainSerialPort.PortName},已成功连接!", LogsType.Scanner);
|
||||||
BaudRate = 9600,
|
//初始化扫码枪对象
|
||||||
Parity = Parity.None,
|
|
||||||
DataBits = 8,
|
|
||||||
StopBits = StopBits.One,
|
|
||||||
Handshake = Handshake.None,
|
|
||||||
Encoding = Encoding.UTF8 // 根据设备要求选择编码
|
|
||||||
};
|
|
||||||
_serialPort.Open();
|
|
||||||
|
|
||||||
var Scanner = new Scanner()
|
var Scanner = new Scanner()
|
||||||
{
|
{
|
||||||
SerialPort = _serialPort,
|
SerialPortClient = (SerialPortClient)client,
|
||||||
//ScannerDisplayControl = new ScannerDisplayControl(client.MainSerialPort.PortName),
|
//ScannerDisplayControl = new ScannerDisplayControl(client.MainSerialPort.PortName),
|
||||||
COM = COM,
|
COM = client.MainSerialPort.PortName,
|
||||||
TempCode = string.Empty,
|
TempCode = string.Empty,
|
||||||
};
|
};
|
||||||
Scanners.Add(Scanner);
|
Scanners.Add(Scanner);
|
||||||
|
return EasyTask.CompletedTask;
|
||||||
|
};
|
||||||
|
client.Setup(new TouchSocket.Core.TouchSocketConfig()
|
||||||
|
.SetSerialPortOption(new SerialPortOption()
|
||||||
|
{
|
||||||
|
BaudRate = 9600,//波特率
|
||||||
|
DataBits = 8,//数据位
|
||||||
|
Parity = System.IO.Ports.Parity.None,//校验位
|
||||||
|
PortName = COM,
|
||||||
|
StopBits = System.IO.Ports.StopBits.One//停止位
|
||||||
|
}));
|
||||||
|
|
||||||
|
client.Connect(LocalFile.Config.ScannerTimeOut, new CancellationToken());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -57,7 +63,7 @@ namespace 智能仓储WCS管理系统
|
|||||||
|
|
||||||
public class Scanner
|
public class Scanner
|
||||||
{
|
{
|
||||||
public SerialPort SerialPort { get; set; }
|
public SerialPortClient SerialPortClient { get; set; }
|
||||||
|
|
||||||
public ScannerDisplayControl ScannerDisplayControl { get; set; }
|
public ScannerDisplayControl ScannerDisplayControl { get; set; }
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ using WCS.Model.ApiModel.MatBaseInfo;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using Ping9719.WpfEx;
|
using Ping9719.WpfEx;
|
||||||
using System.Diagnostics.Eventing.Reader;
|
using System.Diagnostics.Eventing.Reader;
|
||||||
using System.IO.Ports;
|
|
||||||
|
|
||||||
namespace 智能仓储WCS管理系统.ViewModel
|
namespace 智能仓储WCS管理系统.ViewModel
|
||||||
{
|
{
|
||||||
@ -42,42 +41,28 @@ namespace 智能仓储WCS管理系统.ViewModel
|
|||||||
var scanners = ScannerManager.Scanners;
|
var scanners = ScannerManager.Scanners;
|
||||||
foreach (var scanner in scanners)
|
foreach (var scanner in scanners)
|
||||||
{
|
{
|
||||||
scanner.SerialPort.DataReceived += SerialPort_DataReceived;
|
scanner.SerialPortClient.Received = (client, e) =>
|
||||||
}
|
|
||||||
RevertScannerStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
var _serialPort = sender as SerialPort;
|
|
||||||
if (_serialPort == null)
|
|
||||||
return;
|
|
||||||
//// 读取所有可用数据
|
|
||||||
string receivedData = _serialPort.ReadExisting();
|
|
||||||
//获取串口号
|
//获取串口号
|
||||||
var COM = _serialPort.PortName;
|
var COM = client.MainSerialPort.PortName;
|
||||||
//获取扫码枪对象
|
//获取扫码枪对象
|
||||||
var scanner = ScannerManager.Scanners.Where(t => t.COM == COM).FirstOrDefault();
|
var scanner = ScannerManager.Scanners.Where(t => t.COM == COM).FirstOrDefault();
|
||||||
if (scanner == null)
|
if (scanner == null)
|
||||||
return;
|
return EasyTask.CompletedTask;
|
||||||
//int newBytes = e.ByteBlock.Len;
|
int newBytes = e.ByteBlock.Len;
|
||||||
if (receivedData.Length > 0)
|
if (newBytes > 0)
|
||||||
{
|
{
|
||||||
var currentScanedCode = receivedData;
|
var currentScanedCode = Encoding.UTF8.GetString(e.ByteBlock, 0, e.ByteBlock.Len);
|
||||||
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
|
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
|
||||||
scanner.TempCode += currentScanedCode;
|
scanner.TempCode += currentScanedCode;
|
||||||
//校验末尾码
|
//校验末尾码
|
||||||
CheckDataCompleteness(scanner);
|
CheckDataCompleteness(scanner);
|
||||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||||
}
|
}
|
||||||
|
return EasyTask.CompletedTask;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
RevertScannerStatus();
|
||||||
{
|
|
||||||
Console.WriteLine($"接收数据错误: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Property
|
#region Property
|
||||||
|
@ -168,7 +168,7 @@
|
|||||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding OriginalQty}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" MaxWidth="300" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" MaxWidth="300" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||||
|
@ -90,6 +90,11 @@
|
|||||||
SelectionChanged="dataGrid_SelectionChanged"
|
SelectionChanged="dataGrid_SelectionChanged"
|
||||||
RowHeight="39"
|
RowHeight="39"
|
||||||
AutoGenerateColumns="False" FontSize="13">
|
AutoGenerateColumns="False" FontSize="13">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu Name="dgmenu1" StaysOpen="true">
|
||||||
|
<MenuItem Header="查询历史电压" Click="MenuItem_Click"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
|
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Ping9719.WpfEx;
|
using HandyControl.Controls;
|
||||||
|
using Ping9719.WpfEx;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -14,7 +15,10 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using WCS.Model.ApiModel.StoreInfo;
|
||||||
|
using WCS.Model;
|
||||||
using 智能仓储WCS管理系统.ViewModel;
|
using 智能仓储WCS管理系统.ViewModel;
|
||||||
|
using 智能仓储WCS管理系统.Api;
|
||||||
|
|
||||||
namespace 智能仓储WCS管理系统
|
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<int>() { storeInfo.Id },
|
||||||
|
UserName = LocalStatic.CurrentUser,
|
||||||
|
DeviceType = LocalFile.Config.DeviceType,
|
||||||
|
};
|
||||||
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<StoreInfoHistoryVoltageModel>>>(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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ namespace 智能仓储WCS管理系统
|
|||||||
Growl.Success("发送标定指令成功!");
|
Growl.Success("发送标定指令成功!");
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
else if (Result != null)
|
else if (Result1 != null)
|
||||||
{
|
{
|
||||||
Growl.Error(Result1.Message);
|
Growl.Error(Result1.Message);
|
||||||
}
|
}
|
||||||
|
27
货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<Window x:Class="智能仓储WCS管理系统.StoreInfoHistoryVoltageWindow"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="电压历史数据(标定时记录上一次数据)" Height="650" Width="660" ResizeMode="NoResize" FontSize="25"
|
||||||
|
Icon="/Resources/Logo.ico" WindowStartupLocation="CenterScreen" >
|
||||||
|
<Grid Background="AliceBlue">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="库位编码" Name="storeCodeTxt" FontSize="40" HorizontalAlignment="Center"></TextBlock>
|
||||||
|
<DataGrid Grid.Row="1" Name="dataGrid" FontSize="15" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="电压标准值" Binding="{Binding StandardVoltage}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="电压偏移值" Binding="{Binding OffsetVoltage}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="电压当前值" Binding="{Binding CurrentVoltage}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="记录时间" Binding="{Binding CreateTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" Width="1.5*"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Button Content="关闭" Height="45" FontSize="28" Grid.Row="2" Click="Button_Click"></Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
44
货架标准上位机/Views/Windows/StoreInfoHistoryVoltageWindow.xaml.cs
Normal file
@ -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管理系统
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CalibrationWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class StoreInfoHistoryVoltageWindow : System.Windows.Window
|
||||||
|
{
|
||||||
|
public StoreInfoHistoryVoltageWindow(List<StoreInfoHistoryVoltageModel> list,string storeCode)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
dataGrid.ItemsSource = list;
|
||||||
|
this.storeCodeTxt.Text = storeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,8 +8,8 @@
|
|||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Company>重庆盟讯电子科技有限公司</Company>
|
<Company>重庆盟讯电子科技有限公司</Company>
|
||||||
<Copyright>Copyright © 2024</Copyright>
|
<Copyright>Copyright © 2024</Copyright>
|
||||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.4</AssemblyVersion>
|
||||||
<FileVersion>1.0.0</FileVersion>
|
<FileVersion>1.0.4</FileVersion>
|
||||||
<ApplicationIcon>Resources\Logo.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\Logo.ico</ApplicationIcon>
|
||||||
<Authors>重庆盟讯电子科技有限公司</Authors>
|
<Authors>重庆盟讯电子科技有限公司</Authors>
|
||||||
<Product>智能仓储WCS管理系统</Product>
|
<Product>智能仓储WCS管理系统</Product>
|
||||||
@ -60,8 +60,8 @@
|
|||||||
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
||||||
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
||||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
||||||
<PackageReference Include="System.IO.Ports" Version="9.0.0" />
|
|
||||||
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
||||||
|
<PackageReference Include="TouchSocket.SerialPorts" Version="2.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|