diff --git a/WCS.BLL/Config/JsConfig.cs b/WCS.BLL/Config/JsConfig.cs
index 83b67ab..b5905a9 100644
--- a/WCS.BLL/Config/JsConfig.cs
+++ b/WCS.BLL/Config/JsConfig.cs
@@ -39,6 +39,8 @@ namespace WCS.BLL.Config
public string? WMSUrl { get; set; }
public bool IsResetDBOrTable { get; set; }
+
+ public int InstoreTimeOut { get; set; } = 5000;
#region 盟讯公司后台配置
public bool IsMx { get; set; }
///
diff --git a/WCS.BLL/DbModels/AppVersion.cs b/WCS.BLL/DbModels/AppVersion.cs
new file mode 100644
index 0000000..e062c6b
--- /dev/null
+++ b/WCS.BLL/DbModels/AppVersion.cs
@@ -0,0 +1,46 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WCS.Model.ApiModel.OutStore;
+
+namespace WCS.BLL.DbModels
+{
+ [SugarTable("wcs_app_version")]
+ public class AppVersion
+ {
+ ///
+ /// 主键 自增Id
+ ///
+ [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// APP文件名称
+ ///
+ [SugarColumn(ColumnName = "app_name", Length = 100, IsNullable = false, ColumnDescription = "APP文件名称")]
+ public string AppName { get; set; }
+
+ ///
+ /// 版本号
+ ///
+ [SugarColumn(ColumnName = "version", Length = 100, IsNullable = false, ColumnDescription = "版本号")]
+ public string Version { get; set; }
+
+
+ ///
+ /// 更新内容
+ ///
+ [SugarColumn(ColumnName = "content", Length = 250, IsNullable = true, ColumnDescription = "更新内容")]
+ public string Content { get; set; }
+
+
+ ///
+ /// 操作时间
+ ///
+ [SugarColumn(ColumnName = "operate_time", IsNullable = false, ColumnDescription = "操作时间")]
+ public DateTime OperateTime { get; set; } = DateTime.Now;
+ }
+}
diff --git a/WCS.BLL/DbModels/ShelfInfo.cs b/WCS.BLL/DbModels/ShelfInfo.cs
index 8448f0b..9753562 100644
--- a/WCS.BLL/DbModels/ShelfInfo.cs
+++ b/WCS.BLL/DbModels/ShelfInfo.cs
@@ -72,6 +72,18 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "client_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应Can模块的Ip")]
public string ClientIp { get; set; }
+ ///
+ /// 连接Can模块的端口号
+ ///
+ [SugarColumn(ColumnName = "port", Length = 50, IsNullable = true, ColumnDescription = "连接Can模块的端口号")]
+ public string Port { get; set; }
+
+ ///
+ /// 货架对应后端的Ip
+ ///
+ [SugarColumn(ColumnName = "server_ip", Length = 50, IsNullable = false, ColumnDescription = "货架对应后端服务的Ip")]
+ public string ServerIp { get; set; }
+
///
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
///
diff --git a/WCS.BLL/HardWare/IShelfBase.cs b/WCS.BLL/HardWare/IShelfBase.cs
index 5be1182..af7a266 100644
--- a/WCS.BLL/HardWare/IShelfBase.cs
+++ b/WCS.BLL/HardWare/IShelfBase.cs
@@ -66,6 +66,8 @@ namespace WCS.BLL.HardWare
public string GroupName { get; set; }
public string WebSocketIpAddress { get; set; }
+
+ public string? CurrentCom { get; set; }
///
/// 模组
///
diff --git a/WCS.BLL/HardWare/SingleLightShelf.cs b/WCS.BLL/HardWare/SingleLightShelf.cs
index 3e72e0c..ae8ea0e 100644
--- a/WCS.BLL/HardWare/SingleLightShelf.cs
+++ b/WCS.BLL/HardWare/SingleLightShelf.cs
@@ -4,6 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels;
+using WCS.BLL.Manager;
+using WCS.DAL.Db;
+using WCS.DAL.DbModels;
using WCS.Model;
using static WCS.BLL.HardWare.WarningLight;
@@ -11,26 +14,40 @@ namespace WCS.BLL.HardWare
{
public class SingleLightShelf : IShelfBase
{
- public int ShelfId { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string ShelfCode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public int RowCounts { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public int ColumnCounts { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public Mode CurrentMode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string ModulesStr { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string GroupName { get; set; }
- public MatInfoResponse InStoreData { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+ public SingleLightShelf(ShelfInfo shelfInfo)
+ {
+ ShelfId = shelfInfo.Id;
+ ShelfCode = shelfInfo.ShelfCode;
+ RowCounts = shelfInfo.Rowcounts;
+ ColumnCounts = shelfInfo.Columncounts;
+ SetCurrentMode(Mode.待机模式);
+ ClientIp = shelfInfo.ClientIp;
+ LightId = shelfInfo.LightId;
+ }
+ public int ShelfId { get; set; }
+ public string ShelfCode { get; set; }
+ public int RowCounts { get; set; }
+ public int ColumnCounts { get; set; }
+ public Mode CurrentMode { get; set; }
+ public string ModulesStr { get; set; }
+ public string GroupName { get; set; }
+ public MatInfoResponse InStoreData { get; set; }
+ public string? CurrentCom { get; set; } = string.Empty;
public string OrderNumber { get; set; }
public int LightId { get; set; }
public LightColorEnum LightColor { get; set; }
- public List ModuleIds { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string ClientIp { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public List ExceptionMessages { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public bool IsWarning { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string WebSocketIpAddress { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public List Modules { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+ public List ModuleIds { get; set; }
+ public string ClientIp { get; set; }
+ public List ExceptionMessages { get; set; }
+ public bool IsWarning { get; set; }
+ public string WebSocketIpAddress { get; set; }
+
+ public List Modules { get; set; } = new List();
public DateTime SetCurrentModeTime { get; set; }
+ public TCPClient TcpCleint { get { return TCPClientManager.GetTCPClientByIPHost(ClientIp); } }
+
public bool ConfirmStocktakingSingle(int BoardId, int LightNumber)
{
throw new NotImplementedException();
diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs
index 664e485..4c02971 100644
--- a/WCS.BLL/HardWare/SmartShelf.cs
+++ b/WCS.BLL/HardWare/SmartShelf.cs
@@ -56,6 +56,7 @@ namespace WCS.BLL.HardWare
public int RowCounts { get; set; }
public int ColumnCounts { get; set; }
public Mode CurrentMode { get; set; }
+
public DateTime SetCurrentModeTime { get; set; }
public string ModulesStr { get; set; }//当前货架所有模组的Str
public string GroupName { get; set; }
@@ -95,7 +96,6 @@ namespace WCS.BLL.HardWare
///
public List ProcessingExceptions { get; set; } = new List();
public string? CurrentCom { get; set; } = string.Empty;
- //TODO 退出入库清除
public MatInfoResponse InStoreData { get; set; }
@@ -119,6 +119,7 @@ namespace WCS.BLL.HardWare
{
try
{
+ Logs.Write($"[GoInInstore IPAddress]{IPAddress}", LogsType.Instore);
if (this.CurrentMode == Mode.入库模式)
{
CurrentCom = IPAddress;
@@ -217,6 +218,7 @@ namespace WCS.BLL.HardWare
WarningLight.BlueLight(TcpCleint);
//绑定当前进入入库PDA/WCS前端的IP
CurrentCom = IPAddress;
+ Logs.Write($"[GoInInstore CurrentCom]{CurrentCom}", LogsType.Instore);
//返回成功
return;
}
@@ -866,6 +868,15 @@ namespace WCS.BLL.HardWare
}
}
+ public void CalibrationSetOffset(int moduleId, int offSet)
+ {
+ var moudle = Modules.Where(t => t.ModuleId == moduleId).First();
+ if (moudle != null)
+ {
+ moudle.CalibrationSetOffset(offSet, TcpCleint);
+ }
+ }
+
public void SetCurrentMode(Mode mode)
{
this.CurrentMode = mode;
@@ -891,11 +902,62 @@ namespace WCS.BLL.HardWare
{
try
{
- OrderNumber = "自检中...";
+ if (CurrentMode == Mode.待机模式)
+ OrderNumber = "自检中...";
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
{
+ module.IsSelfCheck = true;
module.ShelfCheck(TcpCleint);
}
+
+ //状态校验 自检模式未响应
+ Task.Run(() =>
+ {
+ var timeOut = 3000;
+ var timeSpan = TimeSpan.FromMilliseconds(0);
+ var beginTime = DateTime.Now;
+ while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
+ {
+ timeSpan = DateTime.Now - beginTime;
+ //所有板子成功进入入库模式 表示进入入库模式成功,跳出循环
+ var isSelfChecking = Modules.Where(t => t.IsSelfCheck)
+ .Where(t => t.IsEnable)
+ .Any();
+ if (!isSelfChecking)
+ {
+ break;
+ }
+ //循环延时处理
+ Thread.Sleep(50);
+ }
+
+ var notReturnList = Modules.Where(t => t.IsSelfCheck)
+ .Where(t => t.IsEnable).ToList();
+
+ if (notReturnList.Count > 0)
+ {
+ Logs.Write($"货架{ShelfCode}存在模组自检未响应:", LogsType.Instore);
+ foreach (var item in notReturnList)
+ {
+ ExceptionMessages.Add($"模组{item.ModuleCode}未响应自检!");
+ }
+ //通信校验
+ var messages = notReturnList.Select(t => $"模组{t.ModuleCode}未响应自检!").ToList();
+ var exceptionMessage = string.Join("\r\n", messages);
+ var warningModel = new WebSocketMessageModel()
+ {
+ IsWarning = false,
+ WarningType = WarningTypeEnum.自检未响应,
+ StoreId = 0,
+ StoreCode = "",
+ ShelfCode = ShelfCode,
+ ShelfId = ShelfId,
+ WarningMessage = exceptionMessage,
+ ClientIp = WebSocketIpAddress,
+ };
+ WarningManager.SendWarning(warningModel);
+ }
+ });
}
catch (Exception ex)
{
@@ -903,7 +965,8 @@ namespace WCS.BLL.HardWare
}
finally
{
- OrderNumber = string.Empty;
+ if (CurrentMode == Mode.待机模式)
+ OrderNumber = string.Empty;
}
}
#endregion
@@ -1211,7 +1274,6 @@ namespace WCS.BLL.HardWare
if (storeInfo == null)
{
- //TODO 报错
return;
}
@@ -1219,7 +1281,6 @@ namespace WCS.BLL.HardWare
.FirstOrDefault();
if (module == null)
{
- //TODO 报错
return;
}
@@ -1261,7 +1322,7 @@ namespace WCS.BLL.HardWare
{
module.ComfirmErrInstore(TcpCleint);
WarningLight.WaringLightBlueEnd(TcpCleint);
- //TO DO Logs.Write($"[{guid}]该位置已放置物料!");
+ Logs.Write($"{storeInfo.StoreCode}该位置已放置物料!", LogsType.Instore);
return;
}
#endregion
@@ -1293,7 +1354,7 @@ namespace WCS.BLL.HardWare
MatSupplier = this.InStoreData.supplier,
InstoreTime = DateTime.Now,
- InstoreUser = ""
+ InstoreUser = this.InStoreData.InstoreUser,
};
//出入库记录表
@@ -1367,9 +1428,10 @@ namespace WCS.BLL.HardWare
.Where(t => t.ShelfId == ShelfId)
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
.First();
+ //库位未找到
if (storeInfo == null)
{
- //TO DO 库位未找到
+ Logs.Write($"【InStoreExceptionReturnProcess】boardId:{boardId},lightNumber{lightNumber},库位未找到 ", LogsType.Instore);
return;
}
//已放物料丢失了 物料多放了 储位恢复正常
@@ -1421,6 +1483,8 @@ namespace WCS.BLL.HardWare
};
WarningManager.SendWarning(warningModel);
+ WarningLight.WaringLightAlwaysRed(TcpCleint);
+
ProcessingExceptions.Add(new ProcessingExceptionType()
{
BoardId = boardId,
@@ -1446,6 +1510,8 @@ namespace WCS.BLL.HardWare
};
WarningManager.SendWarning(warningModel);
+ WarningLight.WaringLightAlwaysRed(TcpCleint);
+
ProcessingExceptions.Add(new ProcessingExceptionType()
{
BoardId = boardId,
@@ -1651,6 +1717,7 @@ namespace WCS.BLL.HardWare
var orderMatDetails = DbHelp.db.Queryable()
.Where(t => t.OrderId == CurrentOutOrder.Id)
.Where(t => t.MatSN == inventoryDetail.MatSN)
+ .Where(t => t.IsSended == false)
.First();
if (orderMatDetails == null)
@@ -2030,7 +2097,9 @@ namespace WCS.BLL.HardWare
WarningMessage = exceptionMessage,
ClientIp = WebSocketIpAddress,
};
+
WarningManager.SendWarning(warningModel);
+ WarningLight.WaringLightAlwaysRed(TcpCleint);
ProcessingExceptions.Add(new ProcessingExceptionType()
{
@@ -2055,7 +2124,9 @@ namespace WCS.BLL.HardWare
WarningMessage = exceptionMessage,
ClientIp = WebSocketIpAddress
};
+
WarningManager.SendWarning(warningModel);
+ WarningLight.WaringLightAlwaysRed(TcpCleint);
ProcessingExceptions.Add(new ProcessingExceptionType()
{
@@ -2182,6 +2253,16 @@ namespace WCS.BLL.HardWare
public void SelfCheckProcess(byte[] data, int boardId, int lightNumber)
{
+ var module = this.Modules.Where(t => t.BoardId == boardId).FirstOrDefault();
+ if (module == null)
+ {
+ return;
+ }
+ else
+ {
+ module.IsSelfCheck = false;
+ }
+
if (data[TcpCleint.PreFixLength + 3] == 0x01)
{
//比对结果相同
diff --git a/WCS.BLL/HardWare/SmartShelfModule.cs b/WCS.BLL/HardWare/SmartShelfModule.cs
index 8f2e73d..5720228 100644
--- a/WCS.BLL/HardWare/SmartShelfModule.cs
+++ b/WCS.BLL/HardWare/SmartShelfModule.cs
@@ -75,20 +75,33 @@ namespace WCS.BLL.HardWare
///
public byte[] VoltageSingleData = { 0x17, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
///
- /// 电压偏移值
+ /// 查询电压偏移值
///
public byte[] OffsetSingleData = { 0x18, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
///
- /// 电压标准值
+ /// 查询电压标准值
///
public byte[] StandardSingleData = { 0x19, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ ///
+ /// 标定
+ ///
+ public byte[] CalibrationData = { 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ ///
+ /// 设置偏移量 01 F4 = 500
+ ///
+ 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; }
-
+ ///
+ /// 是否已发送自检命令
+ ///
+ public bool IsSelfCheck { get; set; } = false;
public List CurrentOutSns { get; set; }
public List CurrentStockTakingSns { get; set; }
@@ -197,7 +210,7 @@ namespace WCS.BLL.HardWare
///
public void GoInOutStoreMode(TCPClient tcpClient, List outSns)
{
- Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",",outSns)}", LogsType.Outstore);
+ Logs.Write($"模组{ModuleCode},本次亮灯物料{string.Join(",", outSns)}", LogsType.Outstore);
CurrentOutSns = outSns;
var storeInfos = DbHelp.db.Queryable().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));
+ }
}
}
diff --git a/WCS.BLL/Manager/DbInit.cs b/WCS.BLL/Manager/DbInit.cs
index ccba627..065e18b 100644
--- a/WCS.BLL/Manager/DbInit.cs
+++ b/WCS.BLL/Manager/DbInit.cs
@@ -61,10 +61,12 @@ namespace WCS.BLL.Manager
Logs.Write("【初始化数据库】MX", LogsType.StartBoot);
}
//手动修改后台配置后再进行CodeFirst 数据库的生成、表的生成
+ //如果不配置此参数 每次启动都会持续几十秒才能成功启动后端
if (LocalFile.Config.IsResetDBOrTable)
{
#region 建库建表 只在表有变动时运行
DbHelp.db.DbMaintenance.CreateDatabase();
+ //新部署时 日志需要建表 不然没得接口记录
DbHelp.dbLog.DbMaintenance.CreateDatabase();
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
@@ -72,12 +74,13 @@ namespace WCS.BLL.Manager
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
- , typeof(DocumentSerialNumber),typeof(OrderLight),typeof(MatInfoLog)
+ , typeof(DocumentSerialNumber), typeof(OrderLight), typeof(MatInfoLog)
+ , typeof(AppVersion)
);
- Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
+ Logs.Write("【初始化数据库】db(业务数据库)建表", LogsType.StartBoot);
DbHelp.dbLog.CodeFirst.InitTables(typeof(SystemApiLogRecord));
- Logs.Write("【初始化数据库】logdb建表", LogsType.StartBoot);
+ Logs.Write("【初始化数据库】dblog(日志数据库)建表", LogsType.StartBoot);
//初始化单据序列号数据
if (!DbHelp.db.Queryable().Any())
@@ -88,14 +91,12 @@ namespace WCS.BLL.Manager
UpdateDate = DateTime.Now,
CurrentSerialNumber = 0
};
-
var stockTakingDocumentSerialNumber = new DocumentSerialNumber()
{
DocumentType = DocumentTypeEnum.盘点单据,
UpdateDate = DateTime.Now,
CurrentSerialNumber = 0
};
-
DbHelp.db.Insertable(outDocumentSerialNumber).ExecuteCommand();
DbHelp.db.Insertable(stockTakingDocumentSerialNumber).ExecuteCommand();
}
diff --git a/WCS.BLL/Manager/ShelfManager.cs b/WCS.BLL/Manager/ShelfManager.cs
index 347222e..7d42a2b 100644
--- a/WCS.BLL/Manager/ShelfManager.cs
+++ b/WCS.BLL/Manager/ShelfManager.cs
@@ -47,7 +47,7 @@ namespace WCS.BLL.Manager
GroupName = shelfInDb.GroupName,
};
case 2:
- return new SmartShelf(shelfInDb)
+ return new SingleLightShelf(shelfInDb)
{
ShelfId = shelfInDb.Id,
ShelfCode = shelfInDb.ShelfCode,
diff --git a/WCS.BLL/Manager/TCPClientManager.cs b/WCS.BLL/Manager/TCPClientManager.cs
index cfbd4fa..f20200f 100644
--- a/WCS.BLL/Manager/TCPClientManager.cs
+++ b/WCS.BLL/Manager/TCPClientManager.cs
@@ -29,7 +29,12 @@ namespace WCS.BLL.Manager
var clientsInDB = DbHelp.db.Queryable()
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
- .Select(t => new { IP = t.ClientIp, ShelfTypeName = t.ShelfTypeName })
+ .Select(t => new
+ {
+ IP = t.ClientIp,
+ ShelfTypeName = t.ShelfTypeName,
+ Port = t.Port,
+ })
.Distinct()
.ToList();
Logs.Write($"【InitTcpClient】需要连接的服务端地址如下:\r\n{string.Join(";", clientsInDB)}", LogsType.StartBoot);
@@ -37,7 +42,7 @@ namespace WCS.BLL.Manager
{
Task.Run(() =>
{
- var tcpCleint = new TCPClient(cleientInDB.IP, "",cleientInDB.ShelfTypeName);
+ var tcpCleint = new TCPClient(cleientInDB.IP, cleientInDB.Port, cleientInDB.ShelfTypeName);
tcpCleint.tcpClient.Received += (client, e) =>
{
var clientIpHost = client.IP + ":" + client.Port;
@@ -123,7 +128,7 @@ namespace WCS.BLL.Manager
if (TcpCleint.IsFirstConnected == false)
{
Logs.Write($"【InitTcpClient】{clientIpHost}完成首次连接", LogsType.StartBoot);
-
+
Console.WriteLine($"【InitTcpClient】{clientIpHost}完成首次连接");
@@ -138,8 +143,8 @@ namespace WCS.BLL.Manager
return EasyTask.CompletedTask;
};
- lock(TCPClients)//避免添加失败的情况
- {
+ lock (TCPClients)//避免添加失败的情况
+ {
TCPClients.Add(tcpCleint);
}
diff --git a/WCS.BLL/Manager/WarningManager.cs b/WCS.BLL/Manager/WarningManager.cs
index baa6d26..e364b98 100644
--- a/WCS.BLL/Manager/WarningManager.cs
+++ b/WCS.BLL/Manager/WarningManager.cs
@@ -50,10 +50,12 @@ namespace WCS.BLL.Manager
lock (flag)
{
Warnings.Add(warning);
+ //发送WebSocket记录
+ Logs.Write(JsonConvert.SerializeObject(warning),LogsType.WebSocket);
+
WebSoceketManager.TrySendMessage(warning.ClientIp, JsonConvert.SerializeObject(warning));
warning.LastSendTime = DateTime.Now;
}
-
}
public static void ClearWarning(WebSocketMessageModel warning, SolveTypeEnum solveType)
@@ -66,7 +68,6 @@ namespace WCS.BLL.Manager
{
if (solveType == SolveTypeEnum.处理)
{
- //TODO 对应报警处理对应的数据
switch (warningInManager.WarningType)
{
case WarningTypeEnum.入库自检丢失:
diff --git a/WCS.BLL/Manager/WebSocketServicePlugin.cs b/WCS.BLL/Manager/WebSocketServicePlugin.cs
index 4560201..4ec5ff3 100644
--- a/WCS.BLL/Manager/WebSocketServicePlugin.cs
+++ b/WCS.BLL/Manager/WebSocketServicePlugin.cs
@@ -48,7 +48,6 @@ namespace WCS.BLL.Manager
var warningInManager = WarningManager.Warnings.Where(t => t.Guid == warning.Guid).FirstOrDefault();
if (warningInManager != null)
{
-
warningInManager.ClientIsReceived = true;
}
}
diff --git a/WCS.BLL/Services/IService/IHomerService.cs b/WCS.BLL/Services/IService/IHomerService.cs
index 3e254b8..3c04517 100644
--- a/WCS.BLL/Services/IService/IHomerService.cs
+++ b/WCS.BLL/Services/IService/IHomerService.cs
@@ -1,8 +1,10 @@
+using WCS.Model;
+
namespace WCS.BLL.Services.IService
{
public interface IHomerService
{
-
+ public Task GetShelfServer(RequestBase request);
}
}
diff --git a/WCS.BLL/Services/IService/ISelfCheckService.cs b/WCS.BLL/Services/IService/ISelfCheckService.cs
index 12793a6..378f5c1 100644
--- a/WCS.BLL/Services/IService/ISelfCheckService.cs
+++ b/WCS.BLL/Services/IService/ISelfCheckService.cs
@@ -14,5 +14,7 @@ namespace WCS.BLL.Services.IService
public Task StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
public Task StartSelfCheckByGroupName(List GroupNames);
+
+
}
}
diff --git a/WCS.BLL/Services/IService/IStoreInfoService.cs b/WCS.BLL/Services/IService/IStoreInfoService.cs
index 73e869b..c61631f 100644
--- a/WCS.BLL/Services/IService/IStoreInfoService.cs
+++ b/WCS.BLL/Services/IService/IStoreInfoService.cs
@@ -52,7 +52,13 @@ namespace WCS.BLL.Services.IService
///
public Task queryModuleVoltage(QueryModuleVoltageRequest request);
-
+ ///
+ /// 标定+设置偏移量
+ ///
+ ///
+ ///
+ public Task calibrationSetOffset(CalibrationSetOffsetRequest request);
+
///
/// 查询库位列表
///
diff --git a/WCS.BLL/Services/Service/HomerService.cs b/WCS.BLL/Services/Service/HomerService.cs
index 2f12a50..100bc83 100644
--- a/WCS.BLL/Services/Service/HomerService.cs
+++ b/WCS.BLL/Services/Service/HomerService.cs
@@ -4,11 +4,35 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.Services.IService;
+using WCS.DAL.Db;
+using WCS.DAL.DbModels;
+using WCS.Model;
+using WCS.Model.ApiModel.Home;
namespace WCS.BLL.Services.Service
{
- public class HomerService: IHomerService
+ public class HomerService : IHomerService
{
public HomerService() { }
+
+ public async Task GetShelfServer(RequestBase request)
+ {
+ //直接获取数据库数据 分组进行返回
+ var data = await DbHelp.db.Queryable()
+ .Where(t => !string.IsNullOrEmpty(t.BigShelfCode))
+ .Select(t => new GetShelfServerResponseItem()
+ {
+ BigShelfCode = t.BigShelfCode,
+ ServerIp = t.ServerIp,
+ })
+ .Distinct()
+ .ToListAsync();
+ return new GetShelfServerResponse()
+ {
+ Code = 200,
+ Message = "success",
+ Data = data
+ };
+ }
}
}
diff --git a/WCS.BLL/Services/Service/InstoreService.cs b/WCS.BLL/Services/Service/InstoreService.cs
index 8d832b6..1c0c630 100644
--- a/WCS.BLL/Services/Service/InstoreService.cs
+++ b/WCS.BLL/Services/Service/InstoreService.cs
@@ -220,7 +220,7 @@ namespace WCS.BLL.Services.Service
Message = "success"
};
}
- else if (Result != null && Result.Code == 200 && Result.Data == null)
+ else if (Result != null && Result.Code == 200 && (Result.Data == null || Result.Data.Count == 0))
{
//Mes系统中未获取到物料信息
@@ -295,7 +295,6 @@ namespace WCS.BLL.Services.Service
var matInfo = await DbHelp.db.Queryable().Where(t => t.MatSn == request.MatSn).FirstAsync();
if (matInfo != null)
{
- //TODO 改成wcs的实体
if (!request.SingleLightIn && shelf != null)
shelf.InStoreData = new MatInfoResponse()
{
@@ -391,8 +390,8 @@ namespace WCS.BLL.Services.Service
};
}
- //TODO 配置这个时间相当于需要入库扫码后需要等待的时间
- var timeOut = 5000;
+ //配置这个时间相当于需要入库扫码后需要等待的时间
+ var timeOut = LocalFile.Config.InstoreTimeOut;
var timeSpan = TimeSpan.FromMilliseconds(0);
var beginTime = DateTime.Now;
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
diff --git a/WCS.BLL/Services/Service/MXL4Service.cs b/WCS.BLL/Services/Service/MXL4Service.cs
index 7bc3678..2834501 100644
--- a/WCS.BLL/Services/Service/MXL4Service.cs
+++ b/WCS.BLL/Services/Service/MXL4Service.cs
@@ -52,7 +52,8 @@ namespace WCS.BLL.Services.Service
Message = $"操作失败:库位【{string.Join(",", storeCodeList)}】不存在!",
};
}
- //第二步 获取当前所有库位任务
+
+ //第二步 获取库位正在进行的任务
//模式相同视为可以继续发送任务
var currenTasks = DbHelp.db.Queryable()
.Where(t => storeCodeList.Contains(t.StoreCode))
diff --git a/WCS.BLL/Services/Service/SelfCheckService.cs b/WCS.BLL/Services/Service/SelfCheckService.cs
index 01b476d..d802053 100644
--- a/WCS.BLL/Services/Service/SelfCheckService.cs
+++ b/WCS.BLL/Services/Service/SelfCheckService.cs
@@ -5,7 +5,10 @@ using System.Text;
using System.Threading.Tasks;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
+using WCS.DAL.Db;
+using WCS.DAL.DbModels;
using WCS.Model;
+using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.SelfCheck;
using WCS.Model.WebSocketModel;
@@ -63,10 +66,11 @@ namespace WCS.BLL.Services.Service
foreach (var ip in cleintIps)
{
var currentIdShelfs = shelfs.Where(t => t.ClientIp == ip)
+ .Where(t => t.CurrentMode == HardWare.Mode.待机模式)
.ToList();
Task.Run(() =>
{
- foreach(var shelf in currentIdShelfs)
+ foreach (var shelf in currentIdShelfs)
{
Task.Run(() =>
@@ -116,5 +120,7 @@ namespace WCS.BLL.Services.Service
Message = $"已成功开始自检!",
};
}
+
+
}
}
diff --git a/WCS.BLL/Services/Service/StoreInfoService.cs b/WCS.BLL/Services/Service/StoreInfoService.cs
index 2c4ce36..ec21070 100644
--- a/WCS.BLL/Services/Service/StoreInfoService.cs
+++ b/WCS.BLL/Services/Service/StoreInfoService.cs
@@ -240,7 +240,7 @@ namespace WCS.BLL.Services.Service
}
///
- /// TODO HardCode 根据模组信息生成库位
+ ///
///
///
public async Task> GenerateStoreInfo()
@@ -248,32 +248,32 @@ namespace WCS.BLL.Services.Service
//var shelfInfos = DbHelp.db.Queryable().ToList();
//foreach (var shelfInfo in shelfInfos)
//{
- var ModuleInfos = await DbHelp.db.Queryable().ToListAsync();
- ModuleInfos.ForEach(moduleInfo =>
+ var ModuleInfos = await DbHelp.db.Queryable().ToListAsync();
+ ModuleInfos.ForEach(moduleInfo =>
+ {
+ for (int i = 1; i <= moduleInfo.LightCount; i++)
{
- for (int i = 1; i <= moduleInfo.LightCount; i++)
+ var storeInfo = new StoreInfo()
{
- var storeInfo = new StoreInfo()
- {
- StoreCode = moduleInfo.ModuleCode + "-" + i.ToString(),
- ShelfTypeId = 1,
- ModuleId = moduleInfo.Id,
- ModuleCode = moduleInfo.ModuleCode,
- ShelfId = moduleInfo.ShelfId,
- ShelfCode = moduleInfo.ShelfCode,
- BoardId = moduleInfo.BoardId,
- LightNumber = i,
- Priority = 1,
- CurrentMatSn = string.Empty,
- BigShelfCode = moduleInfo.Bigshelfcode,
- R = moduleInfo.R,
- C = moduleInfo.C,
- Wei = i.ToString(),
- GroupName = moduleInfo.GroupName,
- };
- DbHelp.db.Insertable(storeInfo).ExecuteCommand();
- }
- });
+ StoreCode = moduleInfo.ModuleCode + "-" + i.ToString(),
+ ShelfTypeId = 1,
+ ModuleId = moduleInfo.Id,
+ ModuleCode = moduleInfo.ModuleCode,
+ ShelfId = moduleInfo.ShelfId,
+ ShelfCode = moduleInfo.ShelfCode,
+ BoardId = moduleInfo.BoardId,
+ LightNumber = i,
+ Priority = 1,
+ CurrentMatSn = string.Empty,
+ BigShelfCode = moduleInfo.Bigshelfcode,
+ R = moduleInfo.R,
+ C = moduleInfo.C,
+ Wei = i.ToString(),
+ GroupName = moduleInfo.GroupName,
+ };
+ DbHelp.db.Insertable(storeInfo).ExecuteCommand();
+ }
+ });
//}
return new ResponseCommon