1.移植查询电压值功能
This commit is contained in:
@ -626,6 +626,15 @@ namespace WCS.BLL.HardWare
|
||||
this.CurrentMode = Mode.待机模式;
|
||||
}
|
||||
|
||||
public void QueryVoltage(int moduleId)
|
||||
{
|
||||
var moudle = Modules.Where(t => t.ModuleId == moduleId).First();
|
||||
if (moudle != null)
|
||||
{
|
||||
moudle.QueryVoltage(TcpCleint);
|
||||
}
|
||||
}
|
||||
|
||||
void IShelfBase.SetCurrentMode()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@ -684,6 +693,15 @@ namespace WCS.BLL.HardWare
|
||||
case 0x13://复位的返回信号
|
||||
ResetReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x17://电压值1
|
||||
QueryVoltageProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x18://电压值2
|
||||
QueryVoltageProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x19://电压值3
|
||||
QueryVoltageProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
@ -1789,6 +1807,71 @@ namespace WCS.BLL.HardWare
|
||||
module.CurrentMode = Mode.待机模式;
|
||||
}
|
||||
}
|
||||
|
||||
public void QueryVoltageProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
//第n帧
|
||||
var n = (int)data[TcpCleint.PreFixLength + 3];
|
||||
|
||||
var voltage1 = (data[TcpCleint.PreFixLength + 4] << 8) + data[TcpCleint.PreFixLength + 5];
|
||||
var voltage2 = (data[TcpCleint.PreFixLength + 6] << 8) + data[TcpCleint.PreFixLength + 7];
|
||||
var voltage3 = (data[TcpCleint.PreFixLength + 8] << 8) + data[TcpCleint.PreFixLength + 9];
|
||||
|
||||
var number1 = (n - 1) * 3 + 1;
|
||||
var number2 = (n - 1) * 3 + 2;
|
||||
var number3 = (n - 1) * 3 + 3;
|
||||
|
||||
if (number1 <= 16)
|
||||
{
|
||||
var storeInfo1 = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == number1 && t.ShelfId == ShelfId)
|
||||
.First();
|
||||
if (storeInfo1 != null)
|
||||
{
|
||||
if (data[TcpCleint.PreFixLength + 2] == 0x17)
|
||||
storeInfo1.CurrentVoltage = voltage1;
|
||||
else if (data[TcpCleint.PreFixLength + 2] == 0x18)
|
||||
storeInfo1.OffsetVoltage = voltage1;
|
||||
else
|
||||
storeInfo1.StandardVoltage = voltage1;
|
||||
DbHelp.db.Updateable(storeInfo1).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
|
||||
if (number2 <= 16)
|
||||
{
|
||||
var storeInfo2 = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == number2 && t.ShelfId == ShelfId)
|
||||
.First();
|
||||
if (storeInfo2 != null)
|
||||
{
|
||||
if (data[TcpCleint.PreFixLength + 2] == 0x17)
|
||||
storeInfo2.CurrentVoltage = voltage2;
|
||||
else if (data[TcpCleint.PreFixLength + 2] == 0x18)
|
||||
storeInfo2.OffsetVoltage = voltage2;
|
||||
else
|
||||
storeInfo2.StandardVoltage = voltage2;
|
||||
DbHelp.db.Updateable(storeInfo2).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
|
||||
if (number1 <= 16)
|
||||
{
|
||||
var storeInfo3 = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == number3 && t.ShelfId == ShelfId)
|
||||
.First();
|
||||
if (storeInfo3 != null)
|
||||
{
|
||||
if (data[TcpCleint.PreFixLength + 2] == 0x17)
|
||||
storeInfo3.CurrentVoltage = voltage3;
|
||||
else if (data[TcpCleint.PreFixLength + 2] == 0x18)
|
||||
storeInfo3.OffsetVoltage = voltage3;
|
||||
else
|
||||
storeInfo3.StandardVoltage = voltage3;
|
||||
DbHelp.db.Updateable(storeInfo3).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -65,11 +65,22 @@ namespace WCS.BLL.HardWare
|
||||
/// </summary>
|
||||
public byte[] GoOutStockTakingModeData = { 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 复位命令
|
||||
/// </summary>
|
||||
public byte[] ResetData = { 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
/// <summary>
|
||||
/// 查询当前电压值
|
||||
/// </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 };
|
||||
#endregion
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleCode { get; set; }
|
||||
@ -370,5 +381,21 @@ namespace WCS.BLL.HardWare
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ComfirmOutstoreData));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询电压值
|
||||
/// </summary>
|
||||
/// <param name="tcpClient"></param>
|
||||
public void QueryVoltage(TCPClient tcpClient)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
Task.Run(() =>
|
||||
{
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, VoltageSingleData));
|
||||
Thread.Sleep(50);
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, StandardSingleData));
|
||||
Thread.Sleep(50);
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, OffsetSingleData));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,13 @@ namespace WCS.BLL.Services.IService
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> disableOrEnableModule(DisableOrEnableModuleRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 查询模组电压值
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询库位列表
|
||||
|
@ -691,6 +691,12 @@ namespace WCS.BLL.Services.Service
|
||||
outOrderMatDetails = outOrderMatDetails.Where(t => t.MatCode == matCode)
|
||||
.ToList();
|
||||
Logs.Write($"出库单{order.OrderNumber},本次亮灯物料{matCode}!",LogsType.Outstore);
|
||||
|
||||
//分批次亮灯再计算一次出哪些货架 以免亮大灯不亮小灯
|
||||
shelfIds = outOrderMatDetails.Select(t => t.StoreInfo.ShelfId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
shelfs = ShelfManager.Shelves.Where(t => shelfIds.Contains(t.ShelfId)).ToList();
|
||||
}
|
||||
//相同物料不存在盘数超过n的情况,剩余物料全部亮灯
|
||||
else
|
||||
@ -698,6 +704,8 @@ namespace WCS.BLL.Services.Service
|
||||
//剩余物料全出
|
||||
Logs.Write($"出库单{order.OrderNumber},剩余物料灯全亮!", LogsType.Outstore);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//对应的货架对应位置 进入出库模式 亮灯
|
||||
|
@ -397,6 +397,53 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送指令获取模组的电压值
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<ResponseCommon> queryModuleVoltage(QueryModuleVoltageRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var modules = await DbHelp.db.Queryable<ModuleInfo>().Where(t => request.MouduleIds.Contains(t.Id)).ToListAsync();
|
||||
var isSend = false;
|
||||
foreach (var module in modules)
|
||||
{
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ShelfId == module.ShelfId).FirstOrDefault();
|
||||
if (shelf != null && shelf is SmartShelf)
|
||||
{
|
||||
var smartShelf = (SmartShelf)shelf;
|
||||
smartShelf.QueryVoltage(module.Id);
|
||||
isSend = true;
|
||||
}
|
||||
}
|
||||
if (isSend)
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success"
|
||||
};
|
||||
else
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:未找到对应模组"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "操作失败:" + ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 库位管理
|
||||
@ -534,6 +581,7 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user