diff --git a/WCS.BLL/DbModels/OrderLight.cs b/WCS.BLL/DbModels/OrderLight.cs
index 21fa02a..2d55396 100644
--- a/WCS.BLL/DbModels/OrderLight.cs
+++ b/WCS.BLL/DbModels/OrderLight.cs
@@ -20,7 +20,7 @@ namespace WCS.BLL.DbModels
///
/// 出库单据号
///
- [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
+ [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = true, ColumnDescription = "出库单据号")]
public string OrderNumber { get; set; }
///
diff --git a/WCS.BLL/DbModels/OutOrder.cs b/WCS.BLL/DbModels/OutOrder.cs
index 0784705..aa8c4a3 100644
--- a/WCS.BLL/DbModels/OutOrder.cs
+++ b/WCS.BLL/DbModels/OutOrder.cs
@@ -67,7 +67,7 @@ namespace WCS.BLL.DbModels
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
///
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
- public string GroupName { get; set; }
+ public string GroupName { get; set; } = string.Empty;
///
/// 创建时间
diff --git a/WCS.BLL/HardWare/SmartShelf.cs b/WCS.BLL/HardWare/SmartShelf.cs
index b7993bd..bf07030 100644
--- a/WCS.BLL/HardWare/SmartShelf.cs
+++ b/WCS.BLL/HardWare/SmartShelf.cs
@@ -458,7 +458,7 @@ namespace WCS.BLL.HardWare
var isOuting = ShelfManager.Shelves.Where(t => t.CurrentMode == Mode.出库模式 && t.OrderNumber == OrderNumber)
.Any();
//WebSocket通知前台以更新左侧出库单列表的状态
- if (!isOuting )
+ if (!isOuting)
{
#region WebSocket
var messageMode = new WebSocketMessageModel()
@@ -706,9 +706,21 @@ namespace WCS.BLL.HardWare
public void ShelfCheck()
{
- foreach (var module in Modules.Where(t => t.IsEnable).ToList())
+ try
{
- module.ShelfCheck(TcpCleint);
+ OrderNumber = "自检中...";
+ foreach (var module in Modules.Where(t => t.IsEnable).ToList())
+ {
+ module.ShelfCheck(TcpCleint);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logs.Write("自检发现异常:" + ex);
+ }
+ finally
+ {
+ OrderNumber = string.Empty;
}
}
#endregion
@@ -794,6 +806,9 @@ namespace WCS.BLL.HardWare
case 0x19://电压值3
QueryVoltageProcess(data, boardId, lightNumber);
break;
+ case 0x0B://自检结果反馈
+ SelfCheckProcess(data, boardId, lightNumber);
+ break;
default:
;
break;
@@ -1977,6 +1992,164 @@ namespace WCS.BLL.HardWare
}
}
}
+
+ public void SelfCheckProcess(byte[] data, int boardId, int lightNumber)
+ {
+ if (data[TcpCleint.PreFixLength + 3] == 0x01)
+ {
+ //比对结果相同
+ }
+ //比对结果不同
+ else if (data[TcpCleint.PreFixLength + 3] == 0x00)
+ {
+ //获取当前板所有库位
+ var storeInfos = DbHelp.db.Queryable()
+ .Where(t => t.BoardId == boardId)
+ .ToList();
+ //当前设置的板库位数
+ var boardStoreNumber = storeInfos.Count();
+
+ List dataTemp = new List();
+ int index11 = 0;
+ while (boardStoreNumber > 0)
+ {
+ if (boardStoreNumber >= 4)
+ {
+ dataTemp.AddRange(Convert.ToString(data[TcpCleint.PreFixLength + 4 + index11], 2).PadLeft(8, '0').Reverse().ToList());
+ boardStoreNumber = boardStoreNumber - 4;
+ }
+ else
+ {
+ dataTemp.AddRange(Convert.ToString(data[TcpCleint.PreFixLength + 4 + index11], 2).PadLeft(2 * boardStoreNumber, '0').Reverse().ToList());
+ boardStoreNumber = 0;
+ }
+ index11++;
+ }
+
+ boardStoreNumber = storeInfos.Count();
+ for (int index = 0; index <= boardStoreNumber - 1; index++)
+ {
+ //当前库位异常
+ if (dataTemp[2 * index + 1] == '1')
+ {
+ if (dataTemp[2 * index] == '1')
+ {
+ var storeInfo = storeInfos.Where(t => t.LightNumber == index + 1).First();
+ if (storeInfo != null)
+ {
+
+ #region 不处理、WebSocket通知前台
+ var exceptionMessage = storeInfo.StoreCode + $"自检发现物料{storeInfo.CurrentMatSn}丢失,请确认是否删除?";
+ var warningModel = new WebSocketMessageModel()
+ {
+ WarningType = WarningTypeEnum.自检丢失,
+ StoreId = storeInfo.Id,
+ StoreCode = storeInfo.StoreCode,
+ ModuleId = storeInfo.ModuleId,
+ ModuleCode = storeInfo.ModuleCode,
+ ShelfCode = ShelfCode,
+ ShelfId = ShelfId,
+ WarningMessage = exceptionMessage,
+ ClientIp = WebSocketIpAddress
+ };
+ WarningManager.SendWarning(warningModel);
+ #endregion
+
+ //#region 【后台】丢失的数据处理
+ //Task.Run(() =>
+ //{
+ // try
+ // {
+ // DbHelp.db.BeginTran();
+ // //库位表字段清空
+ // storeInfo.CurrentMatSN = string.Empty;
+ // DbHelp.db.Updateable(storeInfo).ExecuteCommand();
+ // //库存表记录删除、插入出入记录
+ // var inventoryDetail = DbHelp.db.Queryable().Where(t => t.StoreCode == storeInfo.StoreCode).First();
+ // if (inventoryDetail != null)
+ // {
+ // var inOutRecord = new InOutRecord()
+ // {
+ // StoreCode = storeInfo.StoreCode,
+ // StoreId = storeInfo.Id,
+ // StoreInfo = storeInfo,
+
+ // R = storeInfo.R,
+ // C = storeInfo.C,
+ // Wei = storeInfo.Wei,
+ // WarehouseCode = inventoryDetail.WarehouseCode,
+
+ // MatSN = inventoryDetail.MatSN,
+ // MatCode = inventoryDetail.MatCode,
+ // MatName = inventoryDetail.MatName,
+ // MatBatch = inventoryDetail.MatBatch,
+ // MatQty = inventoryDetail.MatQty,
+ // MatSpec = inventoryDetail.MatSpec,
+
+ // OrderNumber = inventoryDetail.OrderNumber,
+ // OrderProdNumber = inventoryDetail.OrderProdNumber,
+ // OrderMaterialCode = inventoryDetail.OrderMaterialCode,
+ // OrderMaterialName = inventoryDetail.OrderMaterialName,
+ // OrderMaterialSpec = inventoryDetail.OrderMaterialSpec,
+
+ // GroupName = LocalFile.Config.GroupName,
+
+ // Direction = DirectionEnum.丢失,
+ // };
+ // DbHelp.db.Insertable(inOutRecord).ExecuteCommand();
+ // DbHelp.db.Deleteable(inventoryDetail).ExecuteCommand();
+ // }
+ // DbHelp.db.CommitTran();
+ // }
+ // catch (Exception e)
+ // {
+ // DbHelp.db.RollbackTran();
+ // }
+ //});
+ //#endregion
+ }
+ //库位未配置、返回数据异常
+ else
+ {
+ Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
+ }
+ }
+ else if (dataTemp[2 * index] == '0')
+ {
+ var storeInfo = storeInfos.Where(t => t.LightNumber == index + 1).First();
+ if (storeInfo != null)
+ {
+ #region 不处理、WebSocket通知前台
+ var exceptionMessage = $"自检发现库位{storeInfo.StoreCode}存在物料未扫描上架,请拿下后点击【确认】消除报警";
+ var warningModel = new WebSocketMessageModel()
+ {
+ WarningType = WarningTypeEnum.自检未扫描上架,
+ StoreId = storeInfo.Id,
+ StoreCode = storeInfo.StoreCode,
+ ModuleId = storeInfo.ModuleId,
+ ModuleCode = storeInfo.ModuleCode,
+ ShelfCode = ShelfCode,
+ ShelfId = ShelfId,
+ WarningMessage = exceptionMessage,
+ ClientIp = WebSocketIpAddress
+ };
+ WarningManager.SendWarning(warningModel);
+ #endregion
+ //#region 【记录缓存异常信息】
+ //var shelfStatus = LocalStatic.ShelfStatuses.Where(t => t.ShelfCode == storeInfo.ShelfCode).First();
+ //LocalStatic.CheckErr.Add($"库位{storeInfo.StoreCode}:存在物料未扫描上架,请取出后重新扫描上架!");
+ //#endregion
+ //WaringLightAlwaysRed(shelfStatus.ClientIp, shelfStatus.LightId);
+ }
+ else
+ {
+ Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
+ }
+ }
+ }
+ }
+ }
+ }
#endregion
}
diff --git a/WCS.BLL/Manager/DbInit.cs b/WCS.BLL/Manager/DbInit.cs
index 32a4244..69b92e8 100644
--- a/WCS.BLL/Manager/DbInit.cs
+++ b/WCS.BLL/Manager/DbInit.cs
@@ -72,7 +72,7 @@ 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(DocumentSerialNumber),typeof(OrderLight)
);
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);
diff --git a/WCS.BLL/Manager/WarningManager.cs b/WCS.BLL/Manager/WarningManager.cs
index 5e878b2..1b32f1d 100644
--- a/WCS.BLL/Manager/WarningManager.cs
+++ b/WCS.BLL/Manager/WarningManager.cs
@@ -75,8 +75,15 @@ namespace WCS.BLL.Manager
case WarningTypeEnum.出库自检丢失:
SolveLoss(warningInManager);
break;
+ case WarningTypeEnum.自检丢失:
+ SolveLoss(warningInManager);
+ break;
}
}
+ else if (solveType == SolveTypeEnum.忽略)
+ {
+ //不发指令了
+ }
//消除报警缓存信息
lock (flag)
diff --git a/WCS.BLL/Services/IService/IHomerService.cs b/WCS.BLL/Services/IService/IHomerService.cs
index 95ade5b..3e254b8 100644
--- a/WCS.BLL/Services/IService/IHomerService.cs
+++ b/WCS.BLL/Services/IService/IHomerService.cs
@@ -3,6 +3,6 @@ namespace WCS.BLL.Services.IService
{
public interface IHomerService
{
-
+
}
}
diff --git a/WCS.BLL/Services/IService/IOutstoreService.cs b/WCS.BLL/Services/IService/IOutstoreService.cs
index b9f5c88..a80d3ff 100644
--- a/WCS.BLL/Services/IService/IOutstoreService.cs
+++ b/WCS.BLL/Services/IService/IOutstoreService.cs
@@ -21,6 +21,7 @@ namespace WCS.BLL.Services.IService
public Task GetOutOrderListByStatus(GetOutOrderListByStatusRequest request);
public Task GetOutOrderDetail(GetOutOrderDetailRequest request);
+ public Task GetOutOrderDetailSingleLight(GetOutOrderDetailRequest request);
public Task GetOutOrderMatDetail(GetOutOrderDetailRequest request);
diff --git a/WCS.BLL/Services/IService/ISelfCheckService.cs b/WCS.BLL/Services/IService/ISelfCheckService.cs
index 141f61a..12793a6 100644
--- a/WCS.BLL/Services/IService/ISelfCheckService.cs
+++ b/WCS.BLL/Services/IService/ISelfCheckService.cs
@@ -12,5 +12,7 @@ namespace WCS.BLL.Services.IService
public interface ISelfCheckService
{
public Task StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
+
+ public Task StartSelfCheckByGroupName(List GroupNames);
}
}
diff --git a/WCS.BLL/Services/Service/OutstoreService.cs b/WCS.BLL/Services/Service/OutstoreService.cs
index 6e315bd..cea40ba 100644
--- a/WCS.BLL/Services/Service/OutstoreService.cs
+++ b/WCS.BLL/Services/Service/OutstoreService.cs
@@ -562,6 +562,74 @@ namespace WCS.BLL.Services.Service
};
}
+ ///
+ /// 单灯查询物料明细 PDA要求返回数据种data需要增加一层details
+ ///
+ ///
+ ///
+ public async Task GetOutOrderDetailSingleLight(GetOutOrderDetailRequest request)
+ {
+ OutOrder outOrder = null;
+
+ #region 查询出库单
+ if (request.OrderId != 0)
+ {
+ outOrder = await DbHelp.db.Queryable().Where(t => t.Id == request.OrderId).FirstAsync();
+ if (outOrder == null)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"查询失败:不存在Id为{request.OrderId}的出库单!",
+ };
+ }
+ }
+ else if (!string.IsNullOrEmpty(request.OrderNumber))
+ {
+ outOrder = await DbHelp.db.Queryable().Where(t => t.OrderNumber == request.OrderNumber)
+ .FirstAsync();
+ if (outOrder == null)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"查询失败:不存在出库单据号为{request.OrderNumber}的出库单!",
+ };
+ }
+ }
+ else
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"查询失败:缺少必要参数!",
+ };
+ }
+ #endregion
+
+ #region 查询出库单明细
+ var orderDetailTask = DbHelp.db.Queryable()
+ .Where(t => t.OrderId == outOrder.Id)
+ .ToListAsync();
+ var orderDetail = await orderDetailTask;
+ //生成序号
+ for (int i = 0; i < orderDetail.Count; i++)
+ {
+ orderDetail[i].RowNumber = i + 1;
+ }
+ #endregion
+
+ return new ResponseCommonModify()
+ {
+ Code = 200,
+ Message = "Success",
+ Data = new ResponseCommonDataDetail
+ {
+ Details = orderDetail
+ }
+ };
+ }
+
public async Task GetOutOrderMatDetail(GetOutOrderDetailRequest request)
{
OutOrder outOrder = null;
@@ -925,7 +993,7 @@ namespace WCS.BLL.Services.Service
return new OutResponseCommonSingle()
{
Code = 200,
- Message = "Success",
+ Message = LightColor,
Data = orcs.Data
};
}
@@ -1296,48 +1364,92 @@ namespace WCS.BLL.Services.Service
public async Task SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
{
- InOutRecord ior = new InOutRecord();
- List id = DbHelp.db.Queryable().Where(it => it.MatSN == request.MatSn).ToList();
- if (id.Count == 0)
+ try
{
+ //单据校验
+ var order = await DbHelp.db.Queryable()
+ .Where(it => it.Id == request.OrderId)
+ .Where(it => it.OrderNumber == request.OrderNumber)
+ .FirstAsync();
+ if (order == null)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"系统不存在单据[{request.OrderNumber}]!",
+ Data = null
+ };
+ }
+ //物料校验
+ var invetoryDetail = await DbHelp.db.Queryable()
+ .Where(it => it.Id == request.MatId)
+ .Where(it => it.MatSN == request.MatSn)
+ .FirstAsync();
+
+ if (invetoryDetail == null)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"库存中不存在物料[{request.MatSn}]!",
+ Data = null
+ };
+ }
+
+ //物料需求明细校验
+ var outOrderDetail = await DbHelp.db.Queryable().Where(it => it.OrderNumber == request.OrderNumber)
+ .Where(it => it.MatCode == invetoryDetail.MatCode)
+ .FirstAsync();
+ if (outOrderDetail == null)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"单据[{request.OrderNumber}]需求不包含物料[{invetoryDetail.MatCode}]!",
+ Data = null
+ };
+ }
+
+ var inOutRecord = new InOutRecord();
+ inOutRecord.StoreId = invetoryDetail.StoreId;
+ inOutRecord.StoreCode = invetoryDetail.StoreCode;
+ inOutRecord.MatSN = invetoryDetail.MatSN;
+ inOutRecord.MatCode = invetoryDetail.MatCode;
+ inOutRecord.MatName = invetoryDetail.MatName;
+ inOutRecord.MatSpec = invetoryDetail.MatSpec;
+ inOutRecord.MatBatch = invetoryDetail.MatBatch;
+ inOutRecord.MatQty = invetoryDetail.MatQty;
+ inOutRecord.MatSupplier = invetoryDetail.MatSupplier;
+ inOutRecord.MatCustomer = invetoryDetail.MatCustomer;
+ inOutRecord.OrderNumber = order.OrderNumber;
+ inOutRecord.Direction = DirectionEnum.出库;
+ inOutRecord.OperateUser = request.UserName;
+ inOutRecord.OperateTime = DateTime.Now;
+ //保存出库记录
+ int count = DbHelp.db.Insertable(inOutRecord).ExecuteCommand();
+ //删除库存
+ DbHelp.db.Deleteable().Where(it => it.MatSN == request.MatSn).ExecuteCommand();
+ //更新需求表
+ outOrderDetail.OutQty += invetoryDetail.MatQty;
+ DbHelp.db.Updateable(outOrderDetail).ExecuteCommand();
+
return new ResponseCommon()
{
- Code = 201,
- Message = $"此SN不在库存中{request.MatSn}!",
+ Code = 200,
+ Message = $"出库成功",
Data = null
};
}
- ior.StoreId = id[0].StoreId;
- ior.StoreCode = id[0].StoreCode;
- ior.MatSN = request.MatSn;
- ior.MatCode = request.MatCode;
- ior.MatName = request.MatName;
- ior.MatSpec = request.MatSpec;
- ior.MatBatch = request.MatBatch;
- ior.MatQty = request.Qty;
- ior.MatSupplier = request.MatSupplier;
- ior.MatCustomer = request.MatCustomer;
- ior.OrderNumber = request.orderNumber;
- ior.Direction = DirectionEnum.出库;
- ior.OperateUser = request.userName;
- ior.OperateTime = DateTime.Now;
- //保存出库记录
- int count = DbHelp.db.Insertable(ior).ExecuteCommand();
- //删除库存
- DbHelp.db.Deleteable().Where(it => it.MatSN == request.MatSn).ExecuteCommand();
- //更新需求表
- List odd = DbHelp.db.Queryable().Where(it => it.OrderNumber == request.orderNumber).Where(it => it.MatCode == request.MatCode).ToList();
- odd[0].OutQty += request.Qty;
- DbHelp.db.Updateable(odd[0]).ExecuteCommand();
-
- return new ResponseCommon()
+ catch (Exception ex)
{
- Code = 200,
- Message = $"出库成功",
- Data = null
- };
+ return new ResponseCommon()
+ {
+ Code = 300,
+ Message = $"出库发生异常!",
+ Data = null
+ };
+ }
}
-
-
+
}
}
diff --git a/WCS.BLL/Services/Service/SelfCheckService.cs b/WCS.BLL/Services/Service/SelfCheckService.cs
index faf4866..8088fe1 100644
--- a/WCS.BLL/Services/Service/SelfCheckService.cs
+++ b/WCS.BLL/Services/Service/SelfCheckService.cs
@@ -7,6 +7,7 @@ using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.Model;
using WCS.Model.ApiModel.SelfCheck;
+using WCS.Model.WebSocketModel;
namespace WCS.BLL.Services.Service
{
@@ -42,5 +43,76 @@ namespace WCS.BLL.Services.Service
Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!",
};
}
+
+ public async Task StartSelfCheckByGroupName(List GroupNames)
+ {
+ if (GroupNames == null || GroupNames.Count == 0)
+ {
+ return new ResponseCommon()
+ {
+ Code = 201,
+ Message = $"参数为空!",
+ };
+ }
+ //获取货架
+ var shelfs = ShelfManager.Shelves
+ .Where(t => GroupNames.Contains(t.GroupName))
+ .ToList();
+ var cleintIps = shelfs.Select(t => t.ClientIp).Distinct().ToList();
+
+ foreach (var ip in cleintIps)
+ {
+ var currentIdShelfs = shelfs.Where(t => t.ClientIp == ip)
+ .ToList();
+ Task.Run(() =>
+ {
+ foreach(var shelf in currentIdShelfs)
+ {
+
+ Task.Run(() =>
+ {
+ var warningModel = new WebSocketMessageModel()
+ {
+ IsWarning = false,
+ ClientIsReceived = true,
+ WarningType = WarningTypeEnum.通知自检进度,
+ StoreId = 0,
+ StoreCode = "",
+ ShelfCode = shelf.ShelfCode,
+ ShelfId = shelf.ShelfId,
+ ClientIp = shelf.WebSocketIpAddress,
+ WarningMessage = $"货架【{shelf.ShelfCode}】开始自检"
+ };
+ WarningManager.SendWarning(warningModel);
+ });
+
+ shelf.ShelfCheck();
+
+ Task.Run(() =>
+ {
+ var warningModel = new WebSocketMessageModel()
+ {
+ IsWarning = false,
+ ClientIsReceived = true,
+ WarningType = WarningTypeEnum.通知自检进度,
+ StoreId = 0,
+ StoreCode = "",
+ ShelfCode = shelf.ShelfCode,
+ ShelfId = shelf.ShelfId,
+ ClientIp = shelf.WebSocketIpAddress,
+ WarningMessage = $"货架【{shelf.ShelfCode}】已完成自检"
+ };
+ WarningManager.SendWarning(warningModel);
+ });
+ Thread.Sleep(10);
+ }
+ });
+ }
+ return new ResponseCommon()
+ {
+ Code = 200,
+ Message = $"已成功开始自检!",
+ };
+ }
}
}
diff --git a/WCS.Model/ApiModel/Home/GetShelfStatusResponse.cs b/WCS.Model/ApiModel/Home/GetShelfStatusResponse.cs
index afb0fd9..7d56251 100644
--- a/WCS.Model/ApiModel/Home/GetShelfStatusResponse.cs
+++ b/WCS.Model/ApiModel/Home/GetShelfStatusResponse.cs
@@ -8,10 +8,10 @@ namespace WCS.Model
{
public class GetShelfStatusResponse : ResponseBase
{
- public List Data { get; set; }
+ public List Data { get; set; }
}
- public class Shelf
+ public class ShelfModel
{
public int ShelfId { get; set; }
@@ -33,5 +33,9 @@ namespace WCS.Model
/// 货架组别
///
public string GroupName { get; set; }
+ ///
+ /// 单据号
+ ///
+ public string OrderNumber { get; set; }
}
}
diff --git a/WCS.Model/ApiModel/OutStore/GetOutOrderDetailSingleLightResponse.cs b/WCS.Model/ApiModel/OutStore/GetOutOrderDetailSingleLightResponse.cs
new file mode 100644
index 0000000..081a6f8
--- /dev/null
+++ b/WCS.Model/ApiModel/OutStore/GetOutOrderDetailSingleLightResponse.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WCS.Model.ApiModel.OutStore
+{
+ public class ResponseCommonModify:ResponseCommon
+ {
+ public ResponseCommonDataDetail Data { get; set; }
+ }
+
+ public class ResponseCommonDataDetail
+ {
+ public List Details { get; set; }
+ }
+}
diff --git a/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs b/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs
index 5a1ab48..ee2296d 100644
--- a/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs
+++ b/WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs
@@ -4,19 +4,12 @@ using System.Text;
namespace WCS.Model.ApiModel.OutStore
{
- public class OutOrderMatDetailModelSingle
+ public class OutOrderMatDetailModelSingle:RequestBase
{
- public int orderId { get; set; }
- public string orderNumber { get; set; }
+ public int OrderId { get; set; }
+ public string OrderNumber { get; set; }
+
+ public int MatId { get; set; }
public string MatSn { get; set; }
- public string MatCode { get; set; }
- public string MatName { get; set; }
- public string MatSpec { get; set; }
- public string MatBatch { get; set; }
- public int MatQty { get; set; }
- public string MatCustomer { get; set; }
- public string MatSupplier { get; set; }
- public int Qty { get; set; }
- public string userName { get; set; }
}
}
diff --git a/WCS.Model/WebSocketModel/WebSocketMessageModel.cs b/WCS.Model/WebSocketModel/WebSocketMessageModel.cs
index 7675ee3..d5cee2f 100644
--- a/WCS.Model/WebSocketModel/WebSocketMessageModel.cs
+++ b/WCS.Model/WebSocketModel/WebSocketMessageModel.cs
@@ -57,6 +57,9 @@ namespace WCS.Model.WebSocketModel
确认盘点未响应 = 13,
退出盘点未响应 = 14,
+ 自检丢失 = 15,
+ 自检未扫描上架 = 16,
+
//通知类
恢复正常 = 50,
通知刷新出库 = 51,
@@ -64,5 +67,6 @@ namespace WCS.Model.WebSocketModel
通知刷新盟讯盘点 = 53,
通知前台结束入库 = 54,
通知刷新出库单列表 = 55,
+ 通知自检进度 = 56,
}
}
diff --git a/WCS.WebApi/Controllers/HomeController.cs b/WCS.WebApi/Controllers/HomeController.cs
index 47dfd25..aaea3b9 100644
--- a/WCS.WebApi/Controllers/HomeController.cs
+++ b/WCS.WebApi/Controllers/HomeController.cs
@@ -19,10 +19,12 @@ namespace WCS.WebApi.Controllers
public class HomeController : ControllerBase
{
public IHomerService _homerService { get; set; }
+ public ISelfCheckService _selfCheckService { get; set; }
- public HomeController(IHomerService homerService)
+ public HomeController(IHomerService homerService, ISelfCheckService selfCheckService)
{
_homerService = homerService;
+ _selfCheckService = selfCheckService;
}
[Route("getShelfTypes")]
@@ -74,13 +76,14 @@ namespace WCS.WebApi.Controllers
{
Code = 200,
Message = "success",
- Data = shelfs.Select(t => new Shelf
+ Data = shelfs.Select(t => new ShelfModel
{
ShelfId = t.ShelfId,
ShelfCode = t.ShelfCode,
CurentMode = (int)t.CurrentMode,
ModulesStr = t.ModulesStr,
- GroupName = t.GroupName
+ GroupName = t.GroupName,
+ OrderNumber = t.OrderNumber,
}).ToList(),
};
}
@@ -94,6 +97,31 @@ namespace WCS.WebApi.Controllers
}
}
+
+ [Route("shelfCheckAll")]
+ [HttpPost(Name = "shelfCheckAll")]
+ public async Task shelfCheckAll(GetShelfStatusRequest request)
+ {
+ try
+ {
+ //var shelfs = ShelfManager.Shelves
+ // .WhereIF(request.GroupNames?.Count > 0, t => request.GroupNames!.Contains(t.GroupName))
+ // .Select(t => t.ShelfCode)
+ // .ToList();
+ //直接返回当前内存中缓存的货架和状态
+ return await _selfCheckService.StartSelfCheckByGroupName(request.GroupNames);
+ }
+ catch (Exception ex)
+ {
+ return new ResponseBase()
+ {
+ Code = 300,
+ Message = "操作失败:" + ex.Message,
+ };
+ }
+ }
+
+
///
/// 重置货架的状态 使其回到待机模式
///
diff --git a/WCS.WebApi/Controllers/OutstoreController.cs b/WCS.WebApi/Controllers/OutstoreController.cs
index 33bfcad..d828528 100644
--- a/WCS.WebApi/Controllers/OutstoreController.cs
+++ b/WCS.WebApi/Controllers/OutstoreController.cs
@@ -195,6 +195,25 @@ namespace WebApi.Controllers
}
}
+ [Route("getOutOrderDetailSingleLight")]
+ [HttpPost(Name = "getOutOrderDetailSingleLight")]
+ public async Task getOutOrderDetailSingleLight(GetOutOrderDetailRequest request)
+ {
+ try
+ {
+ return await _outstoreService.GetOutOrderDetailSingleLight(request);
+ }
+ catch (Exception ex)
+ {
+ return new ResponseBase()
+ {
+ Code = 300,
+ Message = "ѯʧܣ" + ex.Message,
+ };
+ }
+ }
+
+
///
/// ȡⵥϸ
///
diff --git a/货架标准上位机/ViewModels/HomeViewModel.cs b/货架标准上位机/ViewModels/HomeViewModel.cs
index f8b90ea..366898b 100644
--- a/货架标准上位机/ViewModels/HomeViewModel.cs
+++ b/货架标准上位机/ViewModels/HomeViewModel.cs
@@ -14,6 +14,8 @@ using HandyControl.Tools.Extension;
using 货架标准上位机.Views.Controls;
using 货架标准上位机.Api;
using WCS.Model;
+using System.Diagnostics;
+using System.Security.Cryptography;
namespace 货架标准上位机.ViewModel
{
@@ -21,6 +23,23 @@ namespace 货架标准上位机.ViewModel
{
WarnInfoContainer WarnInfo = new WarnInfoContainer();//警告、错误等信息
+ public bool IsThisPageVisible = true;
+
+ public HomeViewModel()
+ {
+ Task.Run(() =>
+ {
+ while (true)
+ {
+ if (IsThisPageVisible)
+ {
+ RefreshUserControl();
+ }
+ Thread.Sleep(2000);
+ }
+ });
+ }
+
#region 绑定
private string textErr;
///
@@ -44,40 +63,43 @@ namespace 货架标准上位机.ViewModel
WarnInfo.RemoveAll(WarnInfoType.AlwayWarn);
}
- public ICommand AddUserControlCommand { get => new DelegateCommand(AddUserControl); }
+ public ICommand AddUserControlCommand { get => new DelegateCommand(RefreshUserControl); }
public WrapPanel wrapPanel;
- public async void AddUserControl()
+ public async void RefreshUserControl()
{
//var dia = Dialog.Show(new TextDialog());
- //try
- //{
- // var body = new GetShelfStatusRequest()
- // {
- // UserName = "xxx",
- // DeviceType = "WCS前端",
- // GroupNames = LocalFile.Config.GroupName,
+ try
+ {
+ var body = new GetShelfStatusRequest()
+ {
+ UserName = "xxx",
+ DeviceType = "WCS前端",
+ GroupNames = LocalFile.Config.GroupName,
+ };
+ var Result = await ApiHelp.Post([LocalFile.Config.ApiIpHost, "home/getShelfStatus"], body);
+ if (Result != null && Result.Data?.Count > 0)
+ {
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ wrapPanel.Children.Clear();
+ Result.Data
+ .ForEach(t =>
+ {
+ var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, "");
+ wrapPanel.Children.Add(shelf);
+ });
+ });
+ }
+ }
+ catch (Exception ex)
+ {
- // };
- // var Result = await ApiHelp.Post([LocalFile.Config.ApiIpHost, "home/getShelfStatus"], body);
- // if (Result != null && Result.Data?.Count > 0)
- // {
- // wrapPanel.Children.Clear();
- // Result.Data.ForEach(t =>
- // {
- // var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, t.GroupName);
- // wrapPanel.Children.Add(shelf);
- // });
- // }
- //}
- //catch (Exception ex)
- //{
+ }
+ finally
+ {
- //}
- //finally
- //{
- // //dia.Close();
- //}
- }
+ }
+ }
#endregion
#region 页面加载时任务
diff --git a/货架标准上位机/Views/Controls/ShelfStatusControl.xaml b/货架标准上位机/Views/Controls/ShelfStatusControl.xaml
index 3dc4aa3..be563c1 100644
--- a/货架标准上位机/Views/Controls/ShelfStatusControl.xaml
+++ b/货架标准上位机/Views/Controls/ShelfStatusControl.xaml
@@ -8,10 +8,10 @@
d:DesignHeight="200" d:DesignWidth="150">
-
-
-
-
+
+
+
+
diff --git a/货架标准上位机/Views/Controls/ShelfStatusControl.xaml.cs b/货架标准上位机/Views/Controls/ShelfStatusControl.xaml.cs
index fcd1623..f43adcd 100644
--- a/货架标准上位机/Views/Controls/ShelfStatusControl.xaml.cs
+++ b/货架标准上位机/Views/Controls/ShelfStatusControl.xaml.cs
@@ -22,11 +22,11 @@ namespace 货架标准上位机.Views.Controls
public partial class ShelfStatusControl : UserControl
{
- public ShelfStatusControl(string shelfCode, int currentMode, string groupName)
+ public ShelfStatusControl(string shelfCode, int currentMode, string orderNumber)
{
InitializeComponent();
txtShelfCode.Text = shelfCode;
- txtGroupName.Text = groupName;
+ txtOrderNumber.Text = orderNumber;
//待机模式 = 0,
//入库模式 = 1,
//出库模式 = 2,
diff --git a/货架标准上位机/Views/HomeView.xaml b/货架标准上位机/Views/HomeView.xaml
index 94c724d..0486d6f 100644
--- a/货架标准上位机/Views/HomeView.xaml
+++ b/货架标准上位机/Views/HomeView.xaml
@@ -8,13 +8,13 @@
mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:pi="https://github.com/ping9719/wpfex"
- d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="loadFir">
+ d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="loadFir" IsVisibleChanged="vis">
-
+
-
-
+
+
@@ -22,7 +22,6 @@
-
@@ -31,10 +30,10 @@
-
+
-
+
-
+
日志
+
-
+
-
+
diff --git a/货架标准上位机/Views/HomeView.xaml.cs b/货架标准上位机/Views/HomeView.xaml.cs
index 406f0e0..76528c0 100644
--- a/货架标准上位机/Views/HomeView.xaml.cs
+++ b/货架标准上位机/Views/HomeView.xaml.cs
@@ -24,7 +24,7 @@ namespace 货架标准上位机
///
public partial class HomeView : UserControlBase
{
- HomeViewModel viewModel = new HomeViewModel();
+ public static HomeViewModel viewModel = new HomeViewModel();
public HomeView()
{
@@ -40,5 +40,12 @@ namespace 货架标准上位机
viewModel.LoadTask();
}
+ private void vis(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if (IsInDesignMode)
+ return;
+
+ viewModel.IsThisPageVisible = (bool)e.NewValue;
+ }
}
}
diff --git a/货架标准上位机/Views/Windows/WarningWindow.xaml b/货架标准上位机/Views/Windows/WarningWindow.xaml
index f40e1dd..58d4686 100644
--- a/货架标准上位机/Views/Windows/WarningWindow.xaml
+++ b/货架标准上位机/Views/Windows/WarningWindow.xaml
@@ -33,10 +33,10 @@
-
-
-
-
+
+
+
+
diff --git a/货架标准上位机/Views/Windows/WarningWindow.xaml.cs b/货架标准上位机/Views/Windows/WarningWindow.xaml.cs
index ec56c34..c7cafef 100644
--- a/货架标准上位机/Views/Windows/WarningWindow.xaml.cs
+++ b/货架标准上位机/Views/Windows/WarningWindow.xaml.cs
@@ -66,18 +66,6 @@ namespace 货架标准上位机
return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut);
}
- ///
- /// 显示提示框
- ///
- /// 内容
- /// 按钮内容
- /// 界面右上角是否显示关闭按钮
- /// 点击的按钮文本
- public static WarningWindow Show(string content, IEnumerable buttons, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
- {
- return Show(content, string.Empty, buttons, _warning, isVisCloseBut);
- }
-
///
/// 显示提示框
///
@@ -103,6 +91,7 @@ namespace 货架标准上位机
{
Content = item,
};
+ button.Margin = new Thickness(10, 0, 10, 0);
button.Click += (s, e) =>
{
clikename = ((Button)s).Content.ToString();
diff --git a/货架标准上位机/WebSocket.cs b/货架标准上位机/WebSocket.cs
index 5a9cd6d..80ad5dd 100644
--- a/货架标准上位机/WebSocket.cs
+++ b/货架标准上位机/WebSocket.cs
@@ -141,6 +141,10 @@ namespace 货架标准上位机
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty);
}
break;
+ case WarningTypeEnum.通知自检进度:
+ TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", DateTime.Now);
+ client.Send(e.DataFrame.ToText());
+ break;
default: break;
}
return;