提交代码

This commit is contained in:
hehaibing-1996
2024-07-16 16:45:18 +08:00
parent ed3673db03
commit 7b8a885669
64 changed files with 1389 additions and 176 deletions

View File

@ -75,20 +75,33 @@ namespace WCS.BLL.HardWare
/// </summary>
public byte[] VoltageSingleData = { 0x17, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/// <summary>
/// 电压偏移值
/// 查询电压偏移值
/// </summary>
public byte[] OffsetSingleData = { 0x18, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/// <summary>
/// 电压标准值
/// 查询电压标准值
/// </summary>
public byte[] StandardSingleData = { 0x19, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/// <summary>
/// 标定
/// </summary>
public byte[] CalibrationData = { 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/// <summary>
/// 设置偏移量 01 F4 = 500
/// </summary>
public byte[] SetOffsetData = { 0x0E, 0x0A, 0x01, 0xF4, 0x00, 0x00, 0x00, 0x00 };
#endregion
public int ModuleId { get; set; }
public string ModuleCode { get; set; }
public int BoardId { get; set; }
public bool IsEnable { get; set; }
public Mode CurrentMode { get; set; }
/// <summary>
/// 是否已发送自检命令
/// </summary>
public bool IsSelfCheck { get; set; } = false;
public List<string> CurrentOutSns { get; set; }
public List<string> CurrentStockTakingSns { get; set; }
@ -197,7 +210,7 @@ namespace WCS.BLL.HardWare
/// <param name="tcpClient"></param>
public void GoInOutStoreMode(TCPClient tcpClient, List<string> outSns)
{
Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",",outSns)}", LogsType.Outstore);
Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",", outSns)}", LogsType.Outstore);
CurrentOutSns = outSns;
var storeInfos = DbHelp.db.Queryable<StoreInfo>().Where(t => t.ModuleId == ModuleId)
.Where(t => t.BoardId == BoardId)
@ -408,5 +421,25 @@ namespace WCS.BLL.HardWare
tcpClient.Send(tcpClient.GenerateMessage(BoardId, OffsetSingleData));
});
}
public void CalibrationSetOffset(int offSet, TCPClient tcpClient)
{
var offSetData = BitConverter.GetBytes(unchecked((short)offSet));
// 检查是否需要交换字节
if (BitConverter.IsLittleEndian)
{
// 如果是小端序系统,则交换字节
byte temp = offSetData[0];
offSetData[0] = offSetData[1];
offSetData[1] = temp;
}
SetOffsetData[2] = offSetData[0];
SetOffsetData[3] = offSetData[1];
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CalibrationData));
Thread.Sleep(100);
tcpClient.Send(tcpClient.GenerateMessage(BoardId, SetOffsetData));
}
}
}