1.增加手动自检功能,主页增加状态显示
This commit is contained in:
@ -20,7 +20,7 @@ namespace WCS.BLL.DbModels
|
||||
/// <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; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,7 +67,7 @@ namespace WCS.BLL.DbModels
|
||||
/// 货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "group_name", Length = 50, IsNullable = false, DefaultValue = "0", ColumnDescription = "货架的组别、区域(区分单个软件管哪些货架的,前端的配置文件配置一个组别,查询时只显示当前组别的货架)")]
|
||||
public string GroupName { get; set; }
|
||||
public string GroupName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
|
@ -706,11 +706,23 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public void ShelfCheck()
|
||||
{
|
||||
try
|
||||
{
|
||||
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
|
||||
|
||||
#region 报警灯协议返回处理
|
||||
@ -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<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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -75,8 +75,15 @@ namespace WCS.BLL.Manager
|
||||
case WarningTypeEnum.出库自检丢失:
|
||||
SolveLoss(warningInManager);
|
||||
break;
|
||||
case WarningTypeEnum.自检丢失:
|
||||
SolveLoss(warningInManager);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (solveType == SolveTypeEnum.忽略)
|
||||
{
|
||||
//不发指令了
|
||||
}
|
||||
|
||||
//消除报警缓存信息
|
||||
lock (flag)
|
||||
|
@ -21,6 +21,7 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseBase> GetOutOrderListByStatus(GetOutOrderListByStatusRequest request);
|
||||
|
||||
public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request);
|
||||
public Task<ResponseBase> GetOutOrderDetailSingleLight(GetOutOrderDetailRequest request);
|
||||
|
||||
public Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request);
|
||||
|
||||
|
@ -12,5 +12,7 @@ namespace WCS.BLL.Services.IService
|
||||
public interface ISelfCheckService
|
||||
{
|
||||
public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
|
||||
|
||||
public Task<ResponseBase> StartSelfCheckByGroupName(List<string> GroupNames);
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
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,39 +1364,74 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
public async Task<ResponseBase> SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
|
||||
{
|
||||
InOutRecord ior = new InOutRecord();
|
||||
List<InventoryDetail> id = DbHelp.db.Queryable<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ToList();
|
||||
if (id.Count == 0)
|
||||
try
|
||||
{
|
||||
//单据校验
|
||||
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 = $"此SN不在库存中{request.MatSn}!",
|
||||
Message = $"系统不存在单据[{request.OrderNumber}]!",
|
||||
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;
|
||||
//物料校验
|
||||
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(ior).ExecuteCommand();
|
||||
int count = DbHelp.db.Insertable(inOutRecord).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();
|
||||
outOrderDetail.OutQty += invetoryDetail.MatQty;
|
||||
DbHelp.db.Updateable(outOrderDetail).ExecuteCommand();
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
@ -1337,7 +1440,16 @@ namespace WCS.BLL.Services.Service
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"出库发生异常!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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<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 = $"已成功开始自检!",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ namespace WCS.Model
|
||||
{
|
||||
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; }
|
||||
|
||||
@ -33,5 +33,9 @@ namespace WCS.Model
|
||||
/// 货架组别
|
||||
/// </summary>
|
||||
public string GroupName { get; set; }
|
||||
/// <summary>
|
||||
/// 单据号
|
||||
/// </summary>
|
||||
public string OrderNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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<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>
|
||||
|
@ -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>
|
||||
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ⵥ<EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ
|
||||
/// </summary>
|
||||
|
@ -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;
|
||||
/// <summary>
|
||||
@ -44,39 +63,42 @@ 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<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);
|
||||
// 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
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
d:DesignHeight="200" d:DesignWidth="150">
|
||||
|
||||
<Border Name="border" Grid.Column="0" Margin="5" BorderThickness="1" Background="LightSkyBlue" BorderBrush="Black" CornerRadius="3">
|
||||
<StackPanel Margin="3">
|
||||
<TextBlock Name="txtShelfCode" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock Name="txtCurrentMode" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock Name="txtGroupName" HorizontalAlignment="Center"></TextBlock>
|
||||
<StackPanel Margin="25">
|
||||
<TextBlock Name="txtShelfCode" FontSize="20" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock Name="txtCurrentMode" FontSize="15" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock Name="txtOrderNumber" FontSize="15" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
@ -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,
|
||||
|
@ -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">
|
||||
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
|
||||
<Grid>
|
||||
<Grid Height="737" VerticalAlignment="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="7*"/>
|
||||
<RowDefinition Height="3*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="4*"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<!--内容区-->
|
||||
<!--<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">
|
||||
<hc:ScrollViewer IsInertiaEnabled="True" hc:ScrollViewerAttach.AutoHide="False">
|
||||
<WrapPanel Name="shelfsWrapPanel">
|
||||
|
||||
</WrapPanel>
|
||||
</hc:ScrollViewer>
|
||||
</Border>
|
||||
@ -31,10 +30,10 @@
|
||||
<Border Grid.Row="1" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<!--<ColumnDefinition Width="4*"/>-->
|
||||
<ColumnDefinition Width="6*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--报警-->
|
||||
<!--报警--><!--
|
||||
<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="5,5,5,5">
|
||||
<GroupBox.Header>
|
||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||
@ -43,20 +42,21 @@
|
||||
</Grid>
|
||||
</GroupBox.Header>
|
||||
<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>
|
||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||
<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}"> 清空</Button>
|
||||
</Grid>
|
||||
</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>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Button Grid.Row="2" Command="{Binding AddUserControlCommand}" Content="点击添加控件"></Button>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</pi:UserControlBase>
|
||||
|
@ -24,7 +24,7 @@ namespace 货架标准上位机
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,10 +33,10 @@
|
||||
<!--<Button Grid.Column="1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityHiddenConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Click="closeClick"/>-->
|
||||
</Grid>
|
||||
<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">
|
||||
<Button Content="确认"/>
|
||||
<Button Content="忽略"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<StackPanel Orientation="Horizontal" x:Name="spacingPanel" Grid.Row="2" Margin="5,0,5,10" Width="auto" HorizontalAlignment="Center">
|
||||
<Button Margin="10 0 10 0" Content="确认"/>
|
||||
<Button Margin="10 0 10 0" Content="忽略"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Window>
|
||||
|
@ -66,18 +66,6 @@ namespace 货架标准上位机
|
||||
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>
|
||||
@ -103,6 +91,7 @@ namespace 货架标准上位机
|
||||
{
|
||||
Content = item,
|
||||
};
|
||||
button.Margin = new Thickness(10, 0, 10, 0);
|
||||
button.Click += (s, e) =>
|
||||
{
|
||||
clikename = ((Button)s).Content.ToString();
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user