|
|
@ -18,6 +18,8 @@ using Aucma.Core.Palletiz.Business;
|
|
|
|
using Aucma.Core.HwPLc;
|
|
|
|
using Aucma.Core.HwPLc;
|
|
|
|
using Aucma.Core.Palletiz.Common;
|
|
|
|
using Aucma.Core.Palletiz.Common;
|
|
|
|
using Aucma.Core.Palletiz.config;
|
|
|
|
using Aucma.Core.Palletiz.config;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using Admin.Core.Socket;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -29,6 +31,11 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public delegate Task RefreshInfo();
|
|
|
|
public delegate Task RefreshInfo();
|
|
|
|
public static event RefreshInfo? RefreshInfoEvent;
|
|
|
|
public static event RefreshInfo? RefreshInfoEvent;
|
|
|
|
|
|
|
|
private static List<ScannerModel> allScanners = Appsettings.app<ScannerModel>("ScannerServer").ToList();
|
|
|
|
|
|
|
|
// A库扫码器ip
|
|
|
|
|
|
|
|
private static string AScannerIp = allScanners.First(x => x.Name == "PalletizStoreCodeA").Ip;
|
|
|
|
|
|
|
|
// B库扫码器ip
|
|
|
|
|
|
|
|
private static string BScannerIp = allScanners.First(x => x.Name == "PalletizStoreCodeB").Ip;
|
|
|
|
|
|
|
|
|
|
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
|
|
|
|
|
|
|
@ -41,6 +48,7 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
public MainWindowViewModel()
|
|
|
|
public MainWindowViewModel()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
|
|
|
|
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
|
|
|
|
|
|
|
|
|
|
|
|
UserContent = firstPage;
|
|
|
|
UserContent = firstPage;
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
@ -51,6 +59,10 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
|
|
|
|
|
|
|
|
public void init()
|
|
|
|
public void init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
RefreshScanner(BScannerIp, false);
|
|
|
|
|
|
|
|
RefreshScanner(AScannerIp, false);
|
|
|
|
|
|
|
|
TouchSocketService.RefreshStateEvent += RefreshScanner;
|
|
|
|
|
|
|
|
|
|
|
|
TeamName = $"班组:{appConfig.TeamName} 用户:{appConfig.Account}";
|
|
|
|
TeamName = $"班组:{appConfig.TeamName} 用户:{appConfig.Account}";
|
|
|
|
// 设备状态刷新定时器
|
|
|
|
// 设备状态刷新定时器
|
|
|
|
System.Timers.Timer timer = new System.Timers.Timer(1000 * 5);
|
|
|
|
System.Timers.Timer timer = new System.Timers.Timer(1000 * 5);
|
|
|
@ -75,7 +87,7 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RefreshMesDb();
|
|
|
|
RefreshMesDb();
|
|
|
|
RefreshPlc();
|
|
|
|
RefreshPlc();
|
|
|
|
RefreshScanner();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -113,17 +125,35 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
PlcState(false);
|
|
|
|
PlcState(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
|
|
|
///// 扫码器状态刷新
|
|
|
|
|
|
|
|
///// </summary>
|
|
|
|
|
|
|
|
///// <param name="sender"></param>
|
|
|
|
|
|
|
|
///// <param name="e"></param>
|
|
|
|
|
|
|
|
//public void RefreshScanner()
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
|
|
|
|
|
|
|
|
// bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1);
|
|
|
|
|
|
|
|
// Scanner1State(flag1);
|
|
|
|
|
|
|
|
// Scanner2State(flag1);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 扫码器状态刷新
|
|
|
|
/// 扫码器状态刷新
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
public void RefreshScanner()
|
|
|
|
public void RefreshScanner(string ip, bool flag)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
|
|
|
|
if (ip == AScannerIp)
|
|
|
|
bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1);
|
|
|
|
{
|
|
|
|
Scanner1State(flag1);
|
|
|
|
Scanner1State(flag); ;
|
|
|
|
Scanner2State(flag1);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (ip == BScannerIp)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Scanner2State(flag);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
@ -480,15 +510,15 @@ namespace Aucma.Core.Palletiz.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (type)
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Scanner1UIStatusWb = "B区域扫码器";
|
|
|
|
Scanner2UIStatusWb = "B区域扫码器";
|
|
|
|
Scanner1UIColor = "Green";
|
|
|
|
Scanner2UIColor = "Green";
|
|
|
|
Scanner1UIIcon = "Assets/Images/Green.png";
|
|
|
|
Scanner2UIIcon = "Assets/Images/Green.png";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Scanner1UIStatusWb = "B区域扫码器";
|
|
|
|
Scanner2UIStatusWb = "B区域扫码器";
|
|
|
|
Scanner1UIColor = "Red";
|
|
|
|
Scanner2UIColor = "Red";
|
|
|
|
Scanner1UIIcon = "Assets/Images/Red.png";
|
|
|
|
Scanner2UIIcon = "Assets/Images/Red.png";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|