添加单灯调试
This commit is contained in:
@ -136,11 +136,17 @@ namespace WCS.BLL.HardWare
|
||||
//清空错误
|
||||
ExceptionMessages.Clear();
|
||||
ProcessingExceptions.Clear();
|
||||
this.IsWarning = false; //清空报警状态以免报警后 处理了异常后续无法亮灯
|
||||
//货架所有模组发送指令进入入库模式
|
||||
Logs.Write($"货架{ShelfCode}开始发送指令进入入库模式", LogsType.Instore);
|
||||
|
||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||
{
|
||||
Logs.Write($"货架{ShelfCode}模组【{module.ModuleCode}】发送指令进入入库模式", LogsType.Instore);
|
||||
module.GoInInstoreMode(TcpCleint);
|
||||
}
|
||||
|
||||
Logs.Write($"货架{ShelfCode}指令发送完毕", LogsType.Instore);
|
||||
//延时获取异常
|
||||
var timeOut = 3000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
@ -178,7 +184,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
if (notInstoreList.Count > 0)
|
||||
{
|
||||
|
||||
Logs.Write($"货架{ShelfCode}存在模组未进入入库模式", LogsType.Instore);
|
||||
foreach (var item in notInstoreList)
|
||||
{
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未进入入库模式!");
|
||||
@ -205,6 +211,7 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
|
||||
//没有报警才亮蓝灯
|
||||
Logs.Write($"货架{ShelfCode},IsWarning现在为{IsWarning}", LogsType.Instore);
|
||||
if (!IsWarning)
|
||||
WarningLight.BlueLight(TcpCleint);
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
@ -399,7 +406,7 @@ namespace WCS.BLL.HardWare
|
||||
else
|
||||
{
|
||||
//剩余物料全出
|
||||
Logs.Write($"GoInOutstoreByModule发料单{OrderNumber},剩余物料灯全亮!", LogsType.Outstore);
|
||||
Logs.Write($"GoInOutstoreByModule发料单{OrderNumber},剩余所有物料灯全亮(发送命令)!", LogsType.Outstore);
|
||||
}
|
||||
|
||||
var shelfIds = outOrderMatDetails.Select(t => t.StoreInfo.ShelfId)
|
||||
@ -1117,9 +1124,11 @@ namespace WCS.BLL.HardWare
|
||||
ClientIp = WebSocketIpAddress
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
this.IsWarning = true;
|
||||
#endregion
|
||||
|
||||
Logs.Write($"货架【{ShelfCode},模组{module}发现物料丢失,开始发送红灯】", LogsType.Instore);
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
Logs.Write($"货架【{ShelfCode},模组{module}发现物料丢失,发送红灯完成】", LogsType.Instore);
|
||||
}
|
||||
//库位未配置、返回数据异常
|
||||
else
|
||||
@ -1151,9 +1160,11 @@ namespace WCS.BLL.HardWare
|
||||
ClientIp = WebSocketIpAddress
|
||||
};
|
||||
WarningManager.SendWarning(warningModel);
|
||||
this.IsWarning = true;
|
||||
#endregion
|
||||
|
||||
Logs.Write($"货架【{ShelfCode},模组{module}发现物料未扫描上架,开始发送红灯】", LogsType.Instore);
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
Logs.Write($"货架【{ShelfCode},模组{module}发现物料未扫描上架,发送红灯完成】", LogsType.Instore);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1809,7 +1820,7 @@ namespace WCS.BLL.HardWare
|
||||
else
|
||||
{
|
||||
//剩余物料全出
|
||||
Logs.Write($"发料单{OrderNumber},剩余物料灯全亮!", LogsType.Outstore);
|
||||
Logs.Write($"发料单{OrderNumber},剩余所有物料灯全亮(发送命令)!", LogsType.Outstore);
|
||||
}
|
||||
|
||||
var shelfIds = outOrderMatDetails.Select(t => t.StoreInfo.ShelfId)
|
||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.InStore;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
@ -15,5 +16,8 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseBase> queryByMatSnOut(QueryByMatSnRequest request);
|
||||
public Task<ResponseBase> queryInstoreStatus(QueryByMatSnRequest request);
|
||||
public Task<ResponseBase> queryInstoreStatusSingle(QueryByMatSnRequestSingle request);
|
||||
|
||||
public Task<ResponseBase> debugStoreinfoSingle(DebugStoreinfoSingleRequest request);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OracleInternal.SqlAndPlsqlParser.LocalParsing;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
@ -13,6 +14,7 @@ using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.InOutRecord;
|
||||
using WCS.Model.ApiModel.InStore;
|
||||
using WCS.Model.ApiModel.MXBackgroundThread;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
@ -22,6 +24,8 @@ namespace WCS.BLL.Services.Service
|
||||
public InstoreService() { }
|
||||
|
||||
public ResponseBase shelfGoInInStore(ShelfGoInInstoreRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
//校验货架编码规则
|
||||
//取配置文件中得货架编码规则
|
||||
@ -83,7 +87,16 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"货架进入入库模式失败:{string.Join(",", shelf.ExceptionMessages)}",
|
||||
Data = null
|
||||
};
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ShelfGoInInstoreResponse()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"货架进入入库模式发生异常:{ex.Message}",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public ResponseBase shelfGoOutInStore(ShelfGoOutInStoreRequest request)
|
||||
@ -537,5 +550,31 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> debugStoreinfoSingle(DebugStoreinfoSingleRequest request)
|
||||
{
|
||||
//找到模组
|
||||
var module = await DbHelp.db.Queryable<ModuleInfo>().Where(it => it.ModuleCode == request.ShelfCode).FirstAsync();
|
||||
if (module == null)
|
||||
{
|
||||
return new ResponseBase()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"模组[{request.ShelfCode}]不存在!",
|
||||
};
|
||||
}
|
||||
string sendIP = module.CleintIp; //单灯IP
|
||||
int PCBId = module.BoardId; //单灯PCB板ID
|
||||
|
||||
TCPClient tcpClient = TCPClientManager.GetTCPClientByIPHost(sendIP);
|
||||
byte[] senddata = Tool.Helper.StoreLightOnOff(PCBId, "绿", request.OnOff == true ? 0x01 : 0x00);
|
||||
tcpClient.Send(senddata); //库位灯短亮一次
|
||||
|
||||
return new ResponseBase()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"Success",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,10 +245,10 @@ namespace WCS.BLL.Services.Service
|
||||
/// <returns></returns>
|
||||
public async Task<ResponseCommon<object>> GenerateStoreInfo()
|
||||
{
|
||||
var shelfInfos = DbHelp.db.Queryable<ShelfInfo>().ToList();
|
||||
foreach (var shelfInfo in shelfInfos)
|
||||
{
|
||||
var ModuleInfos = await DbHelp.db.Queryable<ModuleInfo>().Where(t => t.ShelfId == shelfInfo.Id).ToListAsync();
|
||||
//var shelfInfos = DbHelp.db.Queryable<ShelfInfo>().ToList();
|
||||
//foreach (var shelfInfo in shelfInfos)
|
||||
//{
|
||||
var ModuleInfos = await DbHelp.db.Queryable<ModuleInfo>().ToListAsync();
|
||||
ModuleInfos.ForEach(moduleInfo =>
|
||||
{
|
||||
for (int i = 1; i <= moduleInfo.LightCount; i++)
|
||||
@ -259,8 +259,8 @@ namespace WCS.BLL.Services.Service
|
||||
ShelfTypeId = 1,
|
||||
ModuleId = moduleInfo.Id,
|
||||
ModuleCode = moduleInfo.ModuleCode,
|
||||
ShelfId = shelfInfo.Id,
|
||||
ShelfCode = shelfInfo.ShelfCode,
|
||||
ShelfId = moduleInfo.ShelfId,
|
||||
ShelfCode = moduleInfo.ShelfCode,
|
||||
BoardId = moduleInfo.BoardId,
|
||||
LightNumber = i,
|
||||
Priority = 1,
|
||||
@ -274,7 +274,7 @@ namespace WCS.BLL.Services.Service
|
||||
DbHelp.db.Insertable(storeInfo).ExecuteCommand();
|
||||
}
|
||||
});
|
||||
}
|
||||
//}
|
||||
return new ResponseCommon<object>() { Message = "111" };
|
||||
}
|
||||
|
||||
|
@ -230,5 +230,59 @@ namespace WCS.BLL.Tool
|
||||
byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||
return senddata1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 库位灯常亮/关闭
|
||||
/// </summary>
|
||||
/// <param name="board_id"></param>
|
||||
/// <param name="lightcolor"></param>
|
||||
/// <param name="status">0X00 关闭 0X01 常亮 0X02 闪烁 0X03 短亮一次</param>
|
||||
/// <returns></returns>
|
||||
public static byte[] StoreLightOnOff(int board_id, string lightcolor, int status)
|
||||
{
|
||||
byte color = 0x00;
|
||||
switch (lightcolor)
|
||||
{
|
||||
case "红":
|
||||
color = 0x01;
|
||||
break;
|
||||
case "绿":
|
||||
color = 0x02;
|
||||
break;
|
||||
case "黄":
|
||||
color = 0x03;
|
||||
break;
|
||||
case "蓝":
|
||||
color = 0x04;
|
||||
break;
|
||||
case "紫":
|
||||
color = 0x05;
|
||||
break;
|
||||
case "青":
|
||||
color = 0x06;
|
||||
break;
|
||||
case "白":
|
||||
color = 0x07;
|
||||
break;
|
||||
case "无":
|
||||
color = 0x00;
|
||||
break;
|
||||
}
|
||||
byte[] data1 = new byte[3 + 5];
|
||||
data1[0] = 0xff;
|
||||
data1[1] = 0x01;
|
||||
byte[] length_base = BitConverter.GetBytes(data1.Length + 2);
|
||||
data1[2] = length_base[1];
|
||||
data1[3] = length_base[0];
|
||||
data1[4] = 0x01;
|
||||
|
||||
data1[5] = (byte)board_id;
|
||||
data1[5 + 1] = (byte)status;
|
||||
data1[5 + 2] = color;
|
||||
|
||||
byte[] data = Crc16(data1, data1.Length, true);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ namespace WCS.BLL
|
||||
/// 出库流程日志
|
||||
/// </summary>
|
||||
Outstore,
|
||||
/// <summary>
|
||||
/// 入库流程日志
|
||||
/// </summary>
|
||||
Instore,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
13
WCS.Model/ApiModel/InStore/DebugStoreinfoSingleRequest.cs
Normal file
13
WCS.Model/ApiModel/InStore/DebugStoreinfoSingleRequest.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.InStore
|
||||
{
|
||||
public class DebugStoreinfoSingleRequest : RequestBase
|
||||
{
|
||||
public string ShelfCode { get; set; }
|
||||
|
||||
public bool OnOff { get; set; } = false;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Tool;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.InStore;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
@ -147,7 +148,24 @@ namespace WebApi.Controllers
|
||||
return await _instoreService.queryInstoreStatusSingle(request);
|
||||
//ShelfManager.
|
||||
//
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>:{ex.Message}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[Route("debugStoreinfoSingle")]
|
||||
[HttpPost(Name = "debugStoreinfoSingle")]
|
||||
public async Task<ResponseBase> debugStoreinfoSingle(DebugStoreinfoSingleRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _instoreService.debugStoreinfoSingle(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user