1.增加手动自检功能,主页增加状态显示

This commit is contained in:
hehaibing-1996
2024-06-11 14:03:06 +08:00
parent a87a93ea11
commit 95437c2ccf
24 changed files with 576 additions and 123 deletions

View File

@ -20,7 +20,7 @@ namespace WCS.BLL.DbModels
/// <summary> /// <summary>
/// 出库单据号 /// 出库单据号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")] [SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = true, ColumnDescription = "出库单据号")]
public string OrderNumber { get; set; } public string OrderNumber { get; set; }
/// <summary> /// <summary>

View File

@ -67,7 +67,7 @@ namespace WCS.BLL.DbModels
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架) /// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
/// </summary> /// </summary>
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")] [SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
public string GroupName { get; set; } public string GroupName { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 创建时间 /// 创建时间

View File

@ -458,7 +458,7 @@ namespace WCS.BLL.HardWare
var isOuting = ShelfManager.Shelves.Where(t => t.CurrentMode == Mode. && t.OrderNumber == OrderNumber) var isOuting = ShelfManager.Shelves.Where(t => t.CurrentMode == Mode. && t.OrderNumber == OrderNumber)
.Any(); .Any();
//WebSocket通知前台以更新左侧出库单列表的状态 //WebSocket通知前台以更新左侧出库单列表的状态
if (!isOuting ) if (!isOuting)
{ {
#region WebSocket #region WebSocket
var messageMode = new WebSocketMessageModel() var messageMode = new WebSocketMessageModel()
@ -706,9 +706,21 @@ namespace WCS.BLL.HardWare
public void ShelfCheck() 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 #endregion
@ -794,6 +806,9 @@ namespace WCS.BLL.HardWare
case 0x19://电压值3 case 0x19://电压值3
QueryVoltageProcess(data, boardId, lightNumber); QueryVoltageProcess(data, boardId, lightNumber);
break; break;
case 0x0B://自检结果反馈
SelfCheckProcess(data, boardId, lightNumber);
break;
default: default:
; ;
break; 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<StoreInfo>()
.Where(t => t.BoardId == boardId)
.ToList();
//当前设置的板库位数
var boardStoreNumber = storeInfos.Count();
List<char> dataTemp = new List<char>();
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<InventoryDetail>().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 #endregion
} }

View File

@ -72,7 +72,7 @@ namespace WCS.BLL.Manager
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail) , typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo) , typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord) , typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
, typeof(DocumentSerialNumber) , typeof(DocumentSerialNumber),typeof(OrderLight)
); );
Logs.Write("【初始化数据库】db建表", LogsType.StartBoot); Logs.Write("【初始化数据库】db建表", LogsType.StartBoot);

View File

@ -75,8 +75,15 @@ namespace WCS.BLL.Manager
case WarningTypeEnum.: case WarningTypeEnum.:
SolveLoss(warningInManager); SolveLoss(warningInManager);
break; break;
case WarningTypeEnum.:
SolveLoss(warningInManager);
break;
} }
} }
else if (solveType == SolveTypeEnum.)
{
//不发指令了
}
//消除报警缓存信息 //消除报警缓存信息
lock (flag) lock (flag)

View File

@ -21,6 +21,7 @@ namespace WCS.BLL.Services.IService
public Task<ResponseBase> GetOutOrderListByStatus(GetOutOrderListByStatusRequest request); public Task<ResponseBase> GetOutOrderListByStatus(GetOutOrderListByStatusRequest request);
public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request); public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request);
public Task<ResponseBase> GetOutOrderDetailSingleLight(GetOutOrderDetailRequest request);
public Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request); public Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request);

View File

@ -12,5 +12,7 @@ namespace WCS.BLL.Services.IService
public interface ISelfCheckService public interface ISelfCheckService
{ {
public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request); public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
public Task<ResponseBase> StartSelfCheckByGroupName(List<string> GroupNames);
} }
} }

View File

@ -562,6 +562,74 @@ namespace WCS.BLL.Services.Service
}; };
} }
/// <summary>
/// 单灯查询物料明细 PDA要求返回数据种data需要增加一层details
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<ResponseBase> GetOutOrderDetailSingleLight(GetOutOrderDetailRequest request)
{
OutOrder outOrder = null;
#region
if (request.OrderId != 0)
{
outOrder = await DbHelp.db.Queryable<OutOrder>().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<OutOrder>().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<OutOrderDetail>()
.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<OutOrderDetail>()
{
Code = 200,
Message = "Success",
Data = new ResponseCommonDataDetail<OutOrderDetail>
{
Details = orderDetail
}
};
}
public async Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request) public async Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request)
{ {
OutOrder outOrder = null; OutOrder outOrder = null;
@ -925,7 +993,7 @@ namespace WCS.BLL.Services.Service
return new OutResponseCommonSingle() return new OutResponseCommonSingle()
{ {
Code = 200, Code = 200,
Message = "Success", Message = LightColor,
Data = orcs.Data Data = orcs.Data
}; };
} }
@ -1296,48 +1364,92 @@ namespace WCS.BLL.Services.Service
public async Task<ResponseBase> SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request) public async Task<ResponseBase> SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
{ {
InOutRecord ior = new InOutRecord(); try
List<InventoryDetail> id = DbHelp.db.Queryable<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ToList();
if (id.Count == 0)
{ {
//单据校验
var order = await DbHelp.db.Queryable<OutOrder>()
.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<InventoryDetail>()
.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<OutOrderDetail>().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<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ExecuteCommand();
//更新需求表
outOrderDetail.OutQty += invetoryDetail.MatQty;
DbHelp.db.Updateable(outOrderDetail).ExecuteCommand();
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 201, Code = 200,
Message = $"此SN不在库存中{request.MatSn}!", Message = $"出库成功",
Data = null Data = null
}; };
} }
ior.StoreId = id[0].StoreId; catch (Exception ex)
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<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ExecuteCommand();
//更新需求表
List<OutOrderDetail> odd = DbHelp.db.Queryable<OutOrderDetail>().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()
{ {
Code = 200, return new ResponseCommon()
Message = $"出库成功", {
Data = null Code = 300,
}; Message = $"出库发生异常!",
Data = null
};
}
} }
} }
} }

View File

@ -7,6 +7,7 @@ using WCS.BLL.Manager;
using WCS.BLL.Services.IService; using WCS.BLL.Services.IService;
using WCS.Model; using WCS.Model;
using WCS.Model.ApiModel.SelfCheck; using WCS.Model.ApiModel.SelfCheck;
using WCS.Model.WebSocketModel;
namespace WCS.BLL.Services.Service namespace WCS.BLL.Services.Service
{ {
@ -42,5 +43,76 @@ namespace WCS.BLL.Services.Service
Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!", Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!",
}; };
} }
public async Task<ResponseBase> StartSelfCheckByGroupName(List<string> 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 = $"已成功开始自检!",
};
}
} }
} }

View File

@ -8,10 +8,10 @@ namespace WCS.Model
{ {
public class GetShelfStatusResponse : ResponseBase public class GetShelfStatusResponse : ResponseBase
{ {
public List<Shelf> Data { get; set; } public List<ShelfModel> Data { get; set; }
} }
public class Shelf public class ShelfModel
{ {
public int ShelfId { get; set; } public int ShelfId { get; set; }
@ -33,5 +33,9 @@ namespace WCS.Model
/// 货架组别 /// 货架组别
/// </summary> /// </summary>
public string GroupName { get; set; } public string GroupName { get; set; }
/// <summary>
/// 单据号
/// </summary>
public string OrderNumber { get; set; }
} }
} }

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.OutStore
{
public class ResponseCommonModify<T>:ResponseCommon
{
public ResponseCommonDataDetail<T> Data { get; set; }
}
public class ResponseCommonDataDetail<T>
{
public List<T> Details { get; set; }
}
}

View File

@ -4,19 +4,12 @@ using System.Text;
namespace WCS.Model.ApiModel.OutStore namespace WCS.Model.ApiModel.OutStore
{ {
public class OutOrderMatDetailModelSingle public class OutOrderMatDetailModelSingle:RequestBase
{ {
public int orderId { get; set; } public int OrderId { get; set; }
public string orderNumber { get; set; } public string OrderNumber { get; set; }
public int MatId { get; set; }
public string MatSn { 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; }
} }
} }

View File

@ -57,6 +57,9 @@ namespace WCS.Model.WebSocketModel
= 13, = 13,
退 = 14, 退 = 14,
= 15,
= 16,
//通知类 //通知类
= 50, = 50,
= 51, = 51,
@ -64,5 +67,6 @@ namespace WCS.Model.WebSocketModel
= 53, = 53,
= 54, = 54,
= 55, = 55,
= 56,
} }
} }

View File

@ -19,10 +19,12 @@ namespace WCS.WebApi.Controllers
public class HomeController : ControllerBase public class HomeController : ControllerBase
{ {
public IHomerService _homerService { get; set; } public IHomerService _homerService { get; set; }
public ISelfCheckService _selfCheckService { get; set; }
public HomeController(IHomerService homerService) public HomeController(IHomerService homerService, ISelfCheckService selfCheckService)
{ {
_homerService = homerService; _homerService = homerService;
_selfCheckService = selfCheckService;
} }
[Route("getShelfTypes")] [Route("getShelfTypes")]
@ -74,13 +76,14 @@ namespace WCS.WebApi.Controllers
{ {
Code = 200, Code = 200,
Message = "success", Message = "success",
Data = shelfs.Select(t => new Shelf Data = shelfs.Select(t => new ShelfModel
{ {
ShelfId = t.ShelfId, ShelfId = t.ShelfId,
ShelfCode = t.ShelfCode, ShelfCode = t.ShelfCode,
CurentMode = (int)t.CurrentMode, CurentMode = (int)t.CurrentMode,
ModulesStr = t.ModulesStr, ModulesStr = t.ModulesStr,
GroupName = t.GroupName GroupName = t.GroupName,
OrderNumber = t.OrderNumber,
}).ToList(), }).ToList(),
}; };
} }
@ -94,6 +97,31 @@ namespace WCS.WebApi.Controllers
} }
} }
[Route("shelfCheckAll")]
[HttpPost(Name = "shelfCheckAll")]
public async Task<ResponseBase> 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,
};
}
}
/// <summary> /// <summary>
/// 重置货架的状态 使其回到待机模式 /// 重置货架的状态 使其回到待机模式
/// </summary> /// </summary>

View File

@ -195,6 +195,25 @@ namespace WebApi.Controllers
} }
} }
[Route("getOutOrderDetailSingleLight")]
[HttpPost(Name = "getOutOrderDetailSingleLight")]
public async Task<ResponseBase> getOutOrderDetailSingleLight(GetOutOrderDetailRequest request)
{
try
{
return await _outstoreService.GetOutOrderDetailSingleLight(request);
}
catch (Exception ex)
{
return new ResponseBase()
{
Code = 300,
Message = "<22><>ѯʧ<D1AF>ܣ<EFBFBD>" + ex.Message,
};
}
}
/// <summary> /// <summary>
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ /// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
/// </summary> /// </summary>

View File

@ -14,6 +14,8 @@ using HandyControl.Tools.Extension;
using .Views.Controls; using .Views.Controls;
using .Api; using .Api;
using WCS.Model; using WCS.Model;
using System.Diagnostics;
using System.Security.Cryptography;
namespace .ViewModel namespace .ViewModel
{ {
@ -21,6 +23,23 @@ namespace 货架标准上位机.ViewModel
{ {
WarnInfoContainer WarnInfo = new WarnInfoContainer();//警告、错误等信息 WarnInfoContainer WarnInfo = new WarnInfoContainer();//警告、错误等信息
public bool IsThisPageVisible = true;
public HomeViewModel()
{
Task.Run(() =>
{
while (true)
{
if (IsThisPageVisible)
{
RefreshUserControl();
}
Thread.Sleep(2000);
}
});
}
#region #region
private string textErr; private string textErr;
/// <summary> /// <summary>
@ -44,39 +63,42 @@ namespace 货架标准上位机.ViewModel
WarnInfo.RemoveAll(WarnInfoType.AlwayWarn); WarnInfo.RemoveAll(WarnInfoType.AlwayWarn);
} }
public ICommand AddUserControlCommand { get => new DelegateCommand(AddUserControl); } public ICommand AddUserControlCommand { get => new DelegateCommand(RefreshUserControl); }
public WrapPanel wrapPanel; public WrapPanel wrapPanel;
public async void AddUserControl() public async void RefreshUserControl()
{ {
//var dia = Dialog.Show(new TextDialog()); //var dia = Dialog.Show(new TextDialog());
//try try
//{ {
// var body = new GetShelfStatusRequest() var body = new GetShelfStatusRequest()
// { {
// UserName = "xxx", UserName = "xxx",
// DeviceType = "WCS前端", DeviceType = "WCS前端",
// GroupNames = LocalFile.Config.GroupName, GroupNames = LocalFile.Config.GroupName,
};
var Result = await ApiHelp.Post<GetShelfStatusResponse>([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<GetShelfStatusResponse>([LocalFile.Config.ApiIpHost, "home/getShelfStatus"], body); finally
// 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
//{
// //dia.Close();
//}
} }
#endregion #endregion

View File

@ -8,10 +8,10 @@
d:DesignHeight="200" d:DesignWidth="150"> d:DesignHeight="200" d:DesignWidth="150">
<Border Name="border" Grid.Column="0" Margin="5" BorderThickness="1" Background="LightSkyBlue" BorderBrush="Black" CornerRadius="3"> <Border Name="border" Grid.Column="0" Margin="5" BorderThickness="1" Background="LightSkyBlue" BorderBrush="Black" CornerRadius="3">
<StackPanel Margin="3"> <StackPanel Margin="25">
<TextBlock Name="txtShelfCode" HorizontalAlignment="Center"></TextBlock> <TextBlock Name="txtShelfCode" FontSize="20" HorizontalAlignment="Center"></TextBlock>
<TextBlock Name="txtCurrentMode" HorizontalAlignment="Center"></TextBlock> <TextBlock Name="txtCurrentMode" FontSize="15" HorizontalAlignment="Center"></TextBlock>
<TextBlock Name="txtGroupName" HorizontalAlignment="Center"></TextBlock> <TextBlock Name="txtOrderNumber" FontSize="15" HorizontalAlignment="Center"></TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
</UserControl> </UserControl>

View File

@ -22,11 +22,11 @@ namespace 货架标准上位机.Views.Controls
public partial class ShelfStatusControl : UserControl public partial class ShelfStatusControl : UserControl
{ {
public ShelfStatusControl(string shelfCode, int currentMode, string groupName) public ShelfStatusControl(string shelfCode, int currentMode, string orderNumber)
{ {
InitializeComponent(); InitializeComponent();
txtShelfCode.Text = shelfCode; txtShelfCode.Text = shelfCode;
txtGroupName.Text = groupName; txtOrderNumber.Text = orderNumber;
//待机模式 = 0, //待机模式 = 0,
//入库模式 = 1, //入库模式 = 1,
//出库模式 = 2, //出库模式 = 2,

View File

@ -8,13 +8,13 @@
mc:Ignorable="d" mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:pi="https://github.com/ping9719/wpfex" 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">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0"> <Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid> <Grid Height="737" VerticalAlignment="Top">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="7*"/> <RowDefinition Height="7*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="4*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--内容区--> <!--内容区-->
<!--<Grid Grid.Row="0" Margin="5,5,5,0">--> <!--<Grid Grid.Row="0" Margin="5,5,5,0">-->
@ -22,7 +22,6 @@
<Border Grid.Row="0" Margin="5,5,5,0" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3"> <Border Grid.Row="0" Margin="5,5,5,0" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
<hc:ScrollViewer IsInertiaEnabled="True" hc:ScrollViewerAttach.AutoHide="False"> <hc:ScrollViewer IsInertiaEnabled="True" hc:ScrollViewerAttach.AutoHide="False">
<WrapPanel Name="shelfsWrapPanel"> <WrapPanel Name="shelfsWrapPanel">
</WrapPanel> </WrapPanel>
</hc:ScrollViewer> </hc:ScrollViewer>
</Border> </Border>
@ -31,10 +30,10 @@
<Border Grid.Row="1" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3"> <Border Grid.Row="1" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/> <!--<ColumnDefinition Width="4*"/>-->
<ColumnDefinition Width="6*"/> <ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--报警--> <!--报警--><!--
<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="5,5,5,5"> <GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="5,5,5,5">
<GroupBox.Header> <GroupBox.Header>
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}"> <Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
@ -43,20 +42,21 @@
</Grid> </Grid>
</GroupBox.Header> </GroupBox.Header>
<TextBox Style="{StaticResource TextBoxExtend.Multi}" IsReadOnly="True" Margin="-1" Text="{Binding TextErr}" Foreground="Tomato" hc:InfoElement.Placeholder="没有报警信息"></TextBox> <TextBox Style="{StaticResource TextBoxExtend.Multi}" IsReadOnly="True" Margin="-1" Text="{Binding TextErr}" Foreground="Tomato" hc:InfoElement.Placeholder="没有报警信息"></TextBox>
</GroupBox> </GroupBox>-->
<!--日志--> <!--日志-->
<GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" > <GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" >
<GroupBox.Header> <GroupBox.Header>
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}"> <Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">日志</TextBlock> <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">日志</TextBlock>
<Button Grid.Row="2" Command="{Binding AddUserControlCommand}" Background="AliceBlue" Content="手动自检"></Button>
<Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}">&#xe652; 清空</Button> <Button HorizontalAlignment="Right" Height="25" Margin="10,0" Padding="10,0" FontFamily="{StaticResource IconFont}" Command="{Binding ClearTextInfoCommand}">&#xe652; 清空</Button>
</Grid> </Grid>
</GroupBox.Header> </GroupBox.Header>
<pi:TextBoxLog Token="123" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog> <pi:TextBoxLog Token="selfCheck" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
</GroupBox> </GroupBox>
</Grid> </Grid>
</Border> </Border>
<Button Grid.Row="2" Command="{Binding AddUserControlCommand}" Content="点击添加控件"></Button>
</Grid> </Grid>
</Border> </Border>
</pi:UserControlBase> </pi:UserControlBase>

View File

@ -24,7 +24,7 @@ namespace 货架标准上位机
/// </summary> /// </summary>
public partial class HomeView : UserControlBase public partial class HomeView : UserControlBase
{ {
HomeViewModel viewModel = new HomeViewModel(); public static HomeViewModel viewModel = new HomeViewModel();
public HomeView() public HomeView()
{ {
@ -40,5 +40,12 @@ namespace 货架标准上位机
viewModel.LoadTask(); viewModel.LoadTask();
} }
private void vis(object sender, DependencyPropertyChangedEventArgs e)
{
if (IsInDesignMode)
return;
viewModel.IsThisPageVisible = (bool)e.NewValue;
}
} }
} }

View File

@ -33,10 +33,10 @@
<!--<Button Grid.Column="1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityHiddenConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Click="closeClick"/>--> <!--<Button Grid.Column="1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityHiddenConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Click="closeClick"/>-->
</Grid> </Grid>
<TextBlock Margin="5,0" Grid.Row="1" Text="{Binding Content, FallbackValue=我是内容}" Foreground="Red" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Margin="5,0" Grid.Row="1" Text="{Binding Content, FallbackValue=我是内容}" Foreground="Red" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:UniformSpacingPanel x:Name="spacingPanel" Grid.Row="2" Margin="5,0,5,10" Spacing="10" Width="auto" ChildWrapping="Wrap" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" x:Name="spacingPanel" Grid.Row="2" Margin="5,0,5,10" Width="auto" HorizontalAlignment="Center">
<Button Content="确认"/> <Button Margin="10 0 10 0" Content="确认"/>
<Button Content="忽略"/> <Button Margin="10 0 10 0" Content="忽略"/>
</hc:UniformSpacingPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>
</hc:Window> </hc:Window>

View File

@ -66,18 +66,6 @@ namespace 货架标准上位机
return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut); return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut);
} }
/// <summary>
/// 显示提示框
/// </summary>
/// <param name="content">内容</param>
/// <param name="buttons">按钮内容</param>
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
/// <returns>点击的按钮文本</returns>
public static WarningWindow Show(string content, IEnumerable<string> buttons, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
{
return Show(content, string.Empty, buttons, _warning, isVisCloseBut);
}
/// <summary> /// <summary>
/// 显示提示框 /// 显示提示框
/// </summary> /// </summary>
@ -103,6 +91,7 @@ namespace 货架标准上位机
{ {
Content = item, Content = item,
}; };
button.Margin = new Thickness(10, 0, 10, 0);
button.Click += (s, e) => button.Click += (s, e) =>
{ {
clikename = ((Button)s).Content.ToString(); clikename = ((Button)s).Content.ToString();

View File

@ -141,6 +141,10 @@ namespace 货架标准上位机
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty); scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty);
} }
break; break;
case WarningTypeEnum.:
TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", DateTime.Now);
client.Send(e.DataFrame.ToText());
break;
default: break; default: break;
} }
return; return;