Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
c88a8122cc | |||
9562d86449 | |||
ec50c3986b | |||
2f9ca87876 | |||
e197c32f52 |
@ -994,7 +994,7 @@ namespace WCS.BLL.HardWare
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未响应自检!");
|
||||
}
|
||||
//通信校验
|
||||
var messages = notReturnList.Select(t => $"模组{t.ModuleCode}未响应自检!").ToList();
|
||||
var messages = notReturnList.Select(t => $"模组{t.ModuleCode}({t.CurrentMode})未响应自检!").ToList();
|
||||
var exceptionMessage = string.Join("\r\n", messages);
|
||||
var warningModel = new WebSocketMessageModel()
|
||||
{
|
||||
@ -2240,7 +2240,9 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public void ResetReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.入库模式).FirstOrDefault();
|
||||
var module = this.Modules
|
||||
.Where(t => t.BoardId == boardId)
|
||||
.FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
return;
|
||||
|
@ -5,6 +5,7 @@ using System.Data.OscarClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Config;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.DAL.Db;
|
||||
@ -81,6 +82,21 @@ namespace WCS.BLL.Manager
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (solveType == SolveTypeEnum.屏蔽库位)
|
||||
{
|
||||
switch (warningInManager.WarningType)
|
||||
{
|
||||
case WarningTypeEnum.出库自检未扫描上架:
|
||||
DisableNoScan(warningInManager);
|
||||
break;
|
||||
case WarningTypeEnum.入库自检未扫描上架:
|
||||
DisableNoScan(warningInManager);
|
||||
break;
|
||||
case WarningTypeEnum.自检未扫描上架:
|
||||
DisableNoScan(warningInManager);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (solveType == SolveTypeEnum.忽略)
|
||||
{
|
||||
//不发指令了
|
||||
@ -143,9 +159,85 @@ namespace WCS.BLL.Manager
|
||||
|
||||
|
||||
#region 报警消除的处理
|
||||
public static void SolveNoScan(WebSocketMessageModel warning)
|
||||
/// <summary>
|
||||
/// 未扫描上架禁用库位
|
||||
/// </summary>
|
||||
/// <param name="warning"></param>
|
||||
public static void DisableNoScan(WebSocketMessageModel warning)
|
||||
{
|
||||
#region 【后台】未扫描上架库位的处理
|
||||
try
|
||||
{
|
||||
//获取库位
|
||||
var storeInfo = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.ShelfId == warning.ShelfId)
|
||||
.Where(t => t.Id == warning.StoreId)
|
||||
.First();
|
||||
if (storeInfo != null)
|
||||
{
|
||||
storeInfo.CurrentMatSn = "禁用";
|
||||
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
|
||||
if (LocalFile.Config.IsMx)
|
||||
{
|
||||
var DingDing = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被 {warning.SolvedUser} “未扫描上架弹窗”屏蔽,请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
|
||||
Logs.Write($"【智能货架】库位{storeInfo.StoreCode}被 {warning.SolvedUser} “未扫描上架弹窗”屏蔽,请及时调查或维保硬件!");
|
||||
#region 计算库位禁用率并发送
|
||||
Task.Run(() =>
|
||||
{
|
||||
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.CurrentMatSn == "禁用")
|
||||
.ToList();
|
||||
var allStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledCount = disabledStore.Count();
|
||||
var allCount = allStore.Count();
|
||||
|
||||
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
|
||||
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.Where(t => t.IsEnable == false)
|
||||
.ToList();
|
||||
var allModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledModuleCount = disabledModule.Count();
|
||||
var allModuleCount = allModule.Count();
|
||||
|
||||
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}," +
|
||||
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}," +
|
||||
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
|
||||
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}," +
|
||||
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}," +
|
||||
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
|
||||
|
||||
Logs.Write(message);
|
||||
var dd = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static void SolveLoss(WebSocketMessageModel warning)
|
||||
@ -244,6 +336,7 @@ namespace WCS.BLL.Manager
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public static void GoInRightMode(WebSocketMessageModel warning)
|
||||
{
|
||||
try
|
||||
|
@ -73,5 +73,6 @@ namespace WCS.BLL.Services.IService
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon> disableOrEnableStore(DisableOrEnableStoreRequest request);
|
||||
|
||||
public Task<ResponseCommon> getDisablePercent();
|
||||
}
|
||||
}
|
||||
|
@ -42,12 +42,13 @@ namespace WCS.BLL.Services.Service
|
||||
Message = "操作失败:没有需要控制的库位",
|
||||
};
|
||||
}
|
||||
//对应库位
|
||||
//库位编码去重
|
||||
var storeCodes = request.StoreList.Select(t => t.StoreCode)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var stores = DbHelp.db.Queryable<StoreInfo>().Where(t => storeCodes.Contains(t.StoreCode))
|
||||
.ToList();
|
||||
var stores = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => storeCodes.Contains(t.StoreCode))
|
||||
.ToList();
|
||||
if (stores == null || stores.Count == 0)
|
||||
{
|
||||
return new ResponseCommon<object>
|
||||
@ -61,10 +62,11 @@ namespace WCS.BLL.Services.Service
|
||||
var shelfIds = stores.Select(t => t.ShelfId).Distinct().ToList();
|
||||
var shelfs = DbHelp.db.Queryable<ShelfInfo>().Where(t => shelfIds.Contains(t.Id))
|
||||
.ToList();
|
||||
|
||||
//对应模组信息
|
||||
var moduleIds = stores.Select(t => t.ModuleId).Distinct().ToList();
|
||||
var modules = DbHelp.db.Queryable<ModuleInfo>().Where(t => moduleIds.Contains(t.Id))
|
||||
.ToList();
|
||||
.ToList();
|
||||
|
||||
//加载请求参数中的库位灯 板子ID和货架ID
|
||||
foreach (var store in request.StoreList)
|
||||
|
@ -350,7 +350,55 @@ namespace WCS.BLL.Services.Service
|
||||
if (LocalFile.Config.IsMx)
|
||||
{
|
||||
var DingDing = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽", new List<string> { "104379", "103595" }, ref DingDing);
|
||||
MXBackgroundThread.SendDingDingMsg($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽(模组管理),请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
|
||||
Logs.Write($"【智能货架】模组{moduleInfo.ModuleCode}被屏蔽(模组管理),请及时调查或维保硬件!");
|
||||
|
||||
#region 计算库位禁用率并发送
|
||||
Task.Run(() =>
|
||||
{
|
||||
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.CurrentMatSn == "禁用")
|
||||
.ToList();
|
||||
var allStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledCount = disabledStore.Count();
|
||||
var allCount = allStore.Count();
|
||||
|
||||
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
|
||||
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.Where(t => t.IsEnable == false)
|
||||
.ToList();
|
||||
var allModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledModuleCount = disabledModule.Count();
|
||||
var allModuleCount = allModule.Count();
|
||||
|
||||
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}," +
|
||||
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}," +
|
||||
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
|
||||
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}," +
|
||||
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}," +
|
||||
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
|
||||
|
||||
Logs.Write(message);
|
||||
var dd = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -552,7 +600,56 @@ namespace WCS.BLL.Services.Service
|
||||
if (LocalFile.Config.IsMx)
|
||||
{
|
||||
var DingDing = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被屏蔽", new List<string> { "104379", "103595" }, ref DingDing);
|
||||
MXBackgroundThread.SendDingDingMsg($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!", new List<string> { "104379", "103595" }, ref DingDing);
|
||||
Logs.Write($"【智能货架】库位{storeInfo.StoreCode}被屏蔽(库位管理),请及时调查或维保硬件!");
|
||||
|
||||
#region 计算库位禁用率并发送
|
||||
Task.Run(() =>
|
||||
{
|
||||
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.CurrentMatSn == "禁用")
|
||||
.ToList();
|
||||
var allStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledCount = disabledStore.Count();
|
||||
var allCount = allStore.Count();
|
||||
|
||||
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
|
||||
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.Where(t => t.IsEnable == false)
|
||||
.ToList();
|
||||
var allModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledModuleCount = disabledModule.Count();
|
||||
var allModuleCount = allModule.Count();
|
||||
|
||||
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}," +
|
||||
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}," +
|
||||
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
|
||||
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}," +
|
||||
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}," +
|
||||
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
|
||||
|
||||
Logs.Write(message);
|
||||
|
||||
var dd = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg(message, new List<string> { "104379", "103595" }, ref dd);
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
|
||||
//库位
|
||||
@ -618,6 +715,74 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon> getDisablePercent()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 计算库位禁用率
|
||||
var disabledStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.CurrentMatSn == "禁用")
|
||||
.ToList();
|
||||
var allStore = DbHelp.db.Queryable<StoreInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledCount = disabledStore.Count();
|
||||
var allCount = allStore.Count();
|
||||
|
||||
var disabledACount = disabledStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allACount = allStore.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCCount = disabledStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCCount = allStore.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
|
||||
var disabledModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.Where(t => t.IsEnable == false)
|
||||
.ToList();
|
||||
var allModule = DbHelp.db.Queryable<ModuleInfo>()
|
||||
.ToList();
|
||||
|
||||
var disabledModuleCount = disabledModule.Count();
|
||||
var allModuleCount = allModule.Count();
|
||||
|
||||
var disabledAModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
var allAModuleCount = allModule.Where(t => t.ShelfCode.Contains("A")).ToList().Count();
|
||||
|
||||
var disabledCModuleCount = disabledModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
var allCModuleCount = allModule.Where(t => t.ShelfCode.Contains("C")).ToList().Count();
|
||||
|
||||
var message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}," +
|
||||
$"其中A区库位总数{allACount},禁用数{disabledACount},禁用率{((double)disabledACount / allACount).ToString("P")}," +
|
||||
$"C区库位总数{allCCount},禁用数{disabledCCount},禁用率{((double)disabledCCount / allCCount).ToString("P")}。\r\n" +
|
||||
$"当前模组总数{allModuleCount},禁用总数{disabledModuleCount},禁用率{((double)disabledModuleCount / allModuleCount).ToString("P")}," +
|
||||
$"其中A区模组总数{allAModuleCount},禁用数{disabledAModuleCount},禁用率{((double)disabledAModuleCount / allAModuleCount).ToString("P")}," +
|
||||
$"C区模组总数{allCModuleCount},禁用数{disabledCModuleCount},禁用率{((double)disabledCModuleCount / allCModuleCount).ToString("P")}。";
|
||||
#endregion
|
||||
|
||||
//非盟讯公司的展示
|
||||
if (LocalFile.Config.IsMx == false)
|
||||
{
|
||||
message = $"【智能货架】当前库位总数{allCount},禁用总数{disabledCount},禁用率{((double)disabledCount / allCount).ToString("P")}。";
|
||||
}
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"Success",
|
||||
Data = message ,
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:异常{ex.Message}!"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ namespace WCS.Model.WebSocketModel
|
||||
{
|
||||
处理 = 0,
|
||||
忽略 = 1,
|
||||
屏蔽库位 = 2,
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,13 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
return await _storeInfoService.disableOrEnableStore(request);
|
||||
}
|
||||
|
||||
[Route("getDisablePercent")]
|
||||
[HttpPost(Name = "getDisablePercent")]
|
||||
public async Task<ResponseBase> getDisablePercent(DisableOrEnableStoreRequest request)
|
||||
{
|
||||
return await _storeInfoService.getDisablePercent();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
<!--字体-->
|
||||
<FontFamily x:Key="IconFont">pack://application,,,/智能仓储WCS管理系统;component/Fonts/#iconfont</FontFamily>
|
||||
<!--字符串-->
|
||||
<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>
|
||||
<!--<sys:String x:Key="AboutInfo1">金川数智</sys:String>-->
|
||||
<!--<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>-->
|
||||
<sys:String x:Key="AboutInfo1">金川数智</sys:String>
|
||||
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 264 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 264 KiB |
Before Width: | Height: | Size: 15 KiB |
BIN
货架标准上位机/Resources/LogoMX.ico
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
货架标准上位机/Resources/LogoMX.png
Normal file
After Width: | Height: | Size: 18 KiB |
@ -4,9 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.SerialPorts;
|
||||
using TouchSocket.Sockets;
|
||||
using System.IO.Ports;
|
||||
using 智能仓储WCS管理系统.Views.Controls;
|
||||
|
||||
namespace 智能仓储WCS管理系统
|
||||
@ -24,33 +22,29 @@ namespace 智能仓储WCS管理系统
|
||||
{
|
||||
try
|
||||
{
|
||||
var client = new SerialPortClient();
|
||||
//成功连接到端口
|
||||
client.Connected = (client, e) =>
|
||||
{
|
||||
Logs.Write($"扫码枪{client.MainSerialPort.PortName},已成功连接!", LogsType.Scanner);
|
||||
//初始化扫码枪对象
|
||||
var Scanner = new Scanner()
|
||||
{
|
||||
SerialPortClient = (SerialPortClient)client,
|
||||
//ScannerDisplayControl = new ScannerDisplayControl(client.MainSerialPort.PortName),
|
||||
COM = client.MainSerialPort.PortName,
|
||||
TempCode = string.Empty,
|
||||
};
|
||||
Scanners.Add(Scanner);
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
client.Setup(new TouchSocket.Core.TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
BaudRate = 9600,//波特率
|
||||
DataBits = 8,//数据位
|
||||
Parity = System.IO.Ports.Parity.None,//校验位
|
||||
PortName = COM,
|
||||
StopBits = System.IO.Ports.StopBits.One//停止位
|
||||
}));
|
||||
var _serialPort = new SerialPort();
|
||||
|
||||
client.Connect(LocalFile.Config.ScannerTimeOut, new CancellationToken());
|
||||
// 初始化串口配置
|
||||
_serialPort = new SerialPort
|
||||
{
|
||||
PortName = COM,
|
||||
BaudRate = 9600,
|
||||
Parity = Parity.None,
|
||||
DataBits = 8,
|
||||
StopBits = StopBits.One,
|
||||
Handshake = Handshake.None,
|
||||
Encoding = Encoding.UTF8 // 根据设备要求选择编码
|
||||
};
|
||||
_serialPort.Open();
|
||||
|
||||
var Scanner = new Scanner()
|
||||
{
|
||||
SerialPort = _serialPort,
|
||||
//ScannerDisplayControl = new ScannerDisplayControl(client.MainSerialPort.PortName),
|
||||
COM = COM,
|
||||
TempCode = string.Empty,
|
||||
};
|
||||
Scanners.Add(Scanner);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -63,7 +57,7 @@ namespace 智能仓储WCS管理系统
|
||||
|
||||
public class Scanner
|
||||
{
|
||||
public SerialPortClient SerialPortClient { get; set; }
|
||||
public SerialPort SerialPort { get; set; }
|
||||
|
||||
public ScannerDisplayControl ScannerDisplayControl { get; set; }
|
||||
|
||||
|
@ -30,6 +30,7 @@ using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using System.Security.Cryptography;
|
||||
using Ping9719.WpfEx;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace 智能仓储WCS管理系统.ViewModel
|
||||
{
|
||||
@ -41,30 +42,44 @@ namespace 智能仓储WCS管理系统.ViewModel
|
||||
var scanners = ScannerManager.Scanners;
|
||||
foreach (var scanner in scanners)
|
||||
{
|
||||
scanner.SerialPortClient.Received = (client, e) =>
|
||||
{
|
||||
//获取串口号
|
||||
var COM = client.MainSerialPort.PortName;
|
||||
//获取扫码枪对象
|
||||
var scanner = ScannerManager.Scanners.Where(t => t.COM == COM).FirstOrDefault();
|
||||
if (scanner == null)
|
||||
return EasyTask.CompletedTask;
|
||||
int newBytes = e.ByteBlock.Len;
|
||||
if (newBytes > 0)
|
||||
{
|
||||
var currentScanedCode = Encoding.UTF8.GetString(e.ByteBlock, 0, e.ByteBlock.Len);
|
||||
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
|
||||
scanner.TempCode += currentScanedCode;
|
||||
//校验末尾码
|
||||
CheckDataCompleteness(scanner);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
scanner.SerialPort.DataReceived += SerialPort_DataReceived;
|
||||
}
|
||||
RevertScannerStatus();
|
||||
}
|
||||
|
||||
|
||||
public void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var _serialPort = sender as SerialPort;
|
||||
if (_serialPort == null)
|
||||
return;
|
||||
//// 读取所有可用数据
|
||||
string receivedData = _serialPort.ReadExisting();
|
||||
//获取串口号
|
||||
var COM = _serialPort.PortName;
|
||||
//获取扫码枪对象
|
||||
var scanner = ScannerManager.Scanners.Where(t => t.COM == COM).FirstOrDefault();
|
||||
if (scanner == null)
|
||||
return;
|
||||
//int newBytes = e.ByteBlock.Len;
|
||||
if (receivedData.Length > 0)
|
||||
{
|
||||
var currentScanedCode = receivedData;
|
||||
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
|
||||
scanner.TempCode += currentScanedCode;
|
||||
//校验末尾码
|
||||
CheckDataCompleteness(scanner);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"接收数据错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#region Property
|
||||
private string shelfCode;
|
||||
public string ShelfCode
|
||||
|
@ -102,7 +102,9 @@ namespace 智能仓储WCS管理系统.ViewModel
|
||||
}
|
||||
else if (Result != null && Result.Code == 200 && (Result.Data == null || Result.Data.Lists == null || Result.Data.Lists.Count == 0))
|
||||
{
|
||||
MessageBox.Show($"未查询到领料明细!所推荐物料在此货架上不存在,请确认是否在其他货架上!\r\n{string.Join(",\r\n", matSns)}");
|
||||
var content = $"MES/WMS系统按先进先出推荐物料条码在此货架上不存在,请确认物料是否在其他货架(B区)上!或者确认是否是物料上架后丢失(复制物料条码后在[出入记录]功能中通过物料SN查询确认是否丢失,如果确认是此货架上丢失,重新上架再次进行出库操作),具体条码如下:\r\n{string.Join(",\r\n", matSns)}";
|
||||
//MessageBox.Show($"未查询到领料明细!所推荐物料在此货架上不存在,请确认是否在其他货架上!或者是否已经丢失?(复制物料条码后在[出入记录]功能中即可查询)\r\n{string.Join(",\r\n", matSns)}");
|
||||
TipView.Show(content, "提示", true);
|
||||
DataGridItemSource = null;
|
||||
}
|
||||
else
|
||||
@ -120,12 +122,12 @@ namespace 智能仓储WCS管理系统.ViewModel
|
||||
}
|
||||
else if (result != null && result.code == 200 && (result.data == null || result.data.Count == 0))
|
||||
{
|
||||
Growl.Warning("未查询到物料明细!MES推荐物料明细为空!");
|
||||
Growl.Warning("未查询到物料明细!MES推荐物料明细为空!请确认该单据是否已发或咨询MES系统相关负责人!");
|
||||
DataGridItemSource = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("未查询到领料明细!请求MES接口失败!");
|
||||
Growl.Warning("未查询到领料明细!请求MES接口失败!请确认该单据是否已发或咨询MES系统相关负责人!");
|
||||
DataGridItemSource = null;
|
||||
}
|
||||
});
|
||||
|
@ -230,6 +230,37 @@ namespace 智能仓储WCS管理系统.ViewModel
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public ICommand BtnDisablePercentCommand { get => new DelegateCommand(DisablePercent); }
|
||||
public void DisablePercent()
|
||||
{
|
||||
#region 调用接口 获取屏蔽率
|
||||
try
|
||||
{
|
||||
var body = new DisableOrEnableStoreRequest()
|
||||
{
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/getDisablePercent", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show(Result.Data.ToString());
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("操作失败:请重试!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("操作失败:" + ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
|
@ -67,6 +67,11 @@
|
||||
Grid.Column="9" MinHeight="40" FontSize="18" Content=" 重置" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnResetCommand}">
|
||||
</Button>
|
||||
|
||||
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="12"
|
||||
Grid.Column="8" Grid.Row="1" MinHeight="30" FontSize="18" Content=" 屏蔽率" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnDisablePercentCommand}">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
<TextBlock Margin="5,0" Text="{Binding Title, FallbackValue=标题}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
<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=我是内容}" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<TextBox Margin="5,0" Grid.Row="1" Text="{Binding Content, Mode=OneWay}" 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="取消"/>
|
||||
|
@ -66,6 +66,19 @@ namespace 智能仓储WCS管理系统
|
||||
return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
/// <param name="content">内容</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
|
||||
/// <returns>点击的按钮文本</returns>
|
||||
public static WarningWindow ShowNoScanError(string content, string title, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
|
||||
{
|
||||
content = content + "\r\n确认对应无物料可点击[屏蔽库位]按钮进行库位屏蔽!";
|
||||
return Show(content, title, new string[] { "确认","屏蔽库位", "忽略" }, _warning, isVisCloseBut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
@ -92,6 +105,14 @@ namespace 智能仓储WCS管理系统
|
||||
Content = item,
|
||||
};
|
||||
button.Margin = new Thickness(10, 0, 10, 0);
|
||||
button.FontSize = 18;
|
||||
if (item == "屏蔽库位")
|
||||
{
|
||||
button.Foreground = Brushes.Red;
|
||||
button.FontWeight = FontWeights.DemiBold;
|
||||
//WaningWindow.Content = WaningWindow.Content + "\r\n确认对应无物料可点击[屏蔽库位]按钮进行库位屏蔽!";
|
||||
}
|
||||
|
||||
button.Click += (s, e) =>
|
||||
{
|
||||
clikename = ((Button)s).Content.ToString();
|
||||
@ -99,10 +120,26 @@ namespace 智能仓储WCS管理系统
|
||||
#region 调用接口处理异常/消除报警
|
||||
try
|
||||
{
|
||||
var solveType = SolveTypeEnum.忽略;
|
||||
switch (clikename)
|
||||
{
|
||||
case "确认":
|
||||
solveType = SolveTypeEnum.处理;
|
||||
break;
|
||||
case "忽略":
|
||||
solveType = SolveTypeEnum.忽略;
|
||||
break;
|
||||
case "屏蔽库位":
|
||||
solveType = SolveTypeEnum.屏蔽库位;
|
||||
break;
|
||||
default:
|
||||
solveType = SolveTypeEnum.忽略;
|
||||
break;
|
||||
}
|
||||
var body = new SolveWarningRequest()
|
||||
{
|
||||
Guid = _warning.Guid,
|
||||
SolveType = clikename == "确认" ? SolveTypeEnum.处理 : SolveTypeEnum.忽略,
|
||||
SolveType = solveType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = "WCS前端",
|
||||
};
|
||||
|
@ -26,7 +26,14 @@ namespace 智能仓储WCS管理系统
|
||||
Logs.Write($"【添加报警信息弹窗】报警类型:{warningModel.WarningType} 报警信息:{warningModel.WarningMessage} Guid:{warningModel.Guid}", LogsType.WebSocket);
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
if (warningModel.WarningType == WarningTypeEnum.入库自检未扫描上架 || warningModel.WarningType == WarningTypeEnum.出库自检未扫描上架 || warningModel.WarningType == WarningTypeEnum.自检未扫描上架)
|
||||
{
|
||||
warnings.Add(WarningWindow.ShowNoScanError(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
}
|
||||
else
|
||||
{
|
||||
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@
|
||||
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
||||
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
||||
<PackageReference Include="System.IO.Ports" Version="9.0.0" />
|
||||
<PackageReference Include="TouchSocket.Http" Version="2.0.3" />
|
||||
<PackageReference Include="TouchSocket.SerialPorts" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -84,12 +84,12 @@
|
||||
<Resource Include="Resources\Logo.ico" />
|
||||
<Resource Include="Resources\Logo.png" />
|
||||
<Resource Include="Resources\主页.png" />
|
||||
<Resource Include="Resources\入库.png"/>
|
||||
<Resource Include="Resources\出库.png"/>
|
||||
<Resource Include="Resources\盘点.png"/>
|
||||
<Resource Include="Resources\查询.png"/>
|
||||
<Resource Include="Resources\货架.png"/>
|
||||
<Resource Include="Resources\物料.png"/>
|
||||
<Resource Include="Resources\入库.png" />
|
||||
<Resource Include="Resources\出库.png" />
|
||||
<Resource Include="Resources\盘点.png" />
|
||||
<Resource Include="Resources\查询.png" />
|
||||
<Resource Include="Resources\货架.png" />
|
||||
<Resource Include="Resources\物料.png" />
|
||||
<Resource Include="Resources\权限.png" />
|
||||
<Resource Include="Resources\调试.png" />
|
||||
</ItemGroup>
|
||||
|