change - 入库界面添加报警提示

collectionStore
wenjy 6 months ago
parent 96648e78c8
commit a5f250299e

@ -258,6 +258,8 @@ namespace Aucma.Scada.Business
{
string str = storeCode == appConfig.shellStoreCode ? "箱壳异常入库" : "内胆异常入库";
PrintLogInfoMessage(str + "; 未获取到可用的异常货道");
CreateInStoreTask(spaceList.First(), null);
PrintLogInfoMessage(str + "; 创建异常任务暂存等待异常道进入");
}
}
else

@ -157,29 +157,36 @@ namespace Aucma.Scada.Business
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
RefreshShellStockEvent?.Invoke();
RefreshLinerStockEvent?.Invoke();
}
if ((spaceInfo.spaceCapacity - spaceInfo.spaceStock) <= 5)
if ((spaceInfo.spaceCapacity - spaceInfo.spaceStock) <= 5)
{
if (spaceInfo.storeCode == appConfig.shellStoreCode)
{
ShellAlarmSpaceName.Add(spaceInfo.spaceName);
}
else
{
if (spaceInfo.storeCode == appConfig.shellStoreCode)
{
ShellAlarmSpaceName.Add(spaceInfo.spaceName);
}
else
{
LinerAlarmSpaceName.Add(spaceInfo.spaceName);
}
LinerAlarmSpaceName.Add(spaceInfo.spaceName);
}
}
}
string str = string.Empty;
if (ShellAlarmSpaceName.Count > 0)
{
SpaceCapacityAlarmEvent?.Invoke(appConfig.shellStoreCode, jsonChange.ModeToJson(ShellAlarmSpaceName));
str += $"箱壳库货道:{jsonChange.ModeToJson(ShellAlarmSpaceName)}";
}
if (LinerAlarmSpaceName.Count > 0)
{
SpaceCapacityAlarmEvent?.Invoke(appConfig.linerStoreCode, jsonChange.ModeToJson(LinerAlarmSpaceName));
str += $"内胆库货道:{jsonChange.ModeToJson(LinerAlarmSpaceName)}";
}
if (!string.IsNullOrEmpty(str))
{
SpaceCapacityAlarmEvent?.Invoke(appConfig.shellStoreCode, str);
}
}

@ -107,9 +107,8 @@
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderBrush="Red" BorderThickness="0" CornerRadius="5" >
<Border Grid.Row="0" BorderBrush="Red" BorderThickness="0" CornerRadius="5" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@ -136,7 +135,7 @@
</Grid>
</Border>
<Border Grid.Row="2" BorderBrush="Red" BorderThickness="0" CornerRadius="5" >
<Border Grid.Row="1" BorderBrush="Red" BorderThickness="0" CornerRadius="5" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@ -163,6 +162,21 @@
</Grid>
</Border>
<Border Grid.Row="2" BorderBrush="Red" BorderThickness="0" CornerRadius="5" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="12*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text="提示信息:" FontSize="20" Foreground="#FFFFFF"/>
</StackPanel>
<Border Grid.Column="1" BorderBrush="Gray" BorderThickness="2" Margin="0,0,30,0">
<TextBlock Text="{Binding AlarmMessage}" FontSize="20" Foreground="Red" TextWrapping="Wrap"/>
</Border>
</Grid>
</Border>
</Grid>
</Border>
@ -236,8 +250,7 @@
<Button Content="查询" Command="{Binding QueryCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#007DFA" BorderBrush="#007DFA" Foreground="White" Margin="20,0,0,0" Height="36" Width="80" FontSize="20"/>
<Button Content="重置" Command="{Binding ResetCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#007DFA" BorderBrush="#007DFA" Foreground="White" Margin="20,0,0,0" Height="36" Width="80" FontSize="20" />
<Button Content="空板入库" Command="{Binding ResetCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#FF9900" BorderBrush="#FF9900" Foreground="White" Height="36" Width="150" FontSize="20" Margin="20 0 0 0" Click="Button_Click" />
<!--<Button Content="空板入库" Command="{Binding ResetCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#FF9900" BorderBrush="#FF9900" Foreground="White" Height="36" Width="150" FontSize="20" Margin="20 0 0 0" Click="Button_Click" />-->
</StackPanel>
</Border>
<DataGrid Grid.Row="1" Name="DG" ItemsSource="{Binding InstoreTask}" Background="Transparent"

@ -17,6 +17,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using System.Windows.Media;
namespace Aucma.Scada.UI.viewModel.InStoreInfo
@ -41,16 +42,14 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
inStoreBusiness.RefreshScanMateriaCodeEvent += RefreshScanInfo;
inStoreBusiness.RefreshLogMessageEvent += PrintMessageToListBox;
outStoreBusiness.RefreshStoreStockEvent += Init;
inStoreTaskHandle.SpaceCapacityAlarmEvent += (storeCode, spaceName) =>
inStoreTaskHandle.SpaceCapacityAlarmEvent += async (storeCode, spaceName) =>
{
if(storeCode == appConfig.shellStoreCode)
{
MessageBoxTimeoutA((IntPtr)0, $"箱壳库货道预警:{spaceName}库存即将放满请尽快清理库存3秒后关闭提示", "告警提示", 0, 0, 3000);
}
else
{
MessageBoxTimeoutA((IntPtr)0, $"箱壳库货道预警:{spaceName}库存即将放满请尽快清理库存3秒后关闭提示", "告警提示", 0, 0, 3000);
}
// MessageBoxTimeoutA((IntPtr)0, $"货道预警:{spaceName}库存即将放满请尽快清理库存10秒后关闭提示", "告警提示", 0, 0, 10000);
AlarmMessage = $"货道预警:{spaceName}库存即将放满请尽快清理库存";
Task.Delay(1000*10).Wait();
AlarmMessage = string.Empty;
};
QueryCommand = new RelayCommand(Query);
@ -124,6 +123,12 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
set { linerSpaceName = value; RaisePropertyChanged(nameof(LinerSpaceName)); }
}
private string alarmMessage = string.Empty;
public string AlarmMessage
{
get { return alarmMessage; }
set { alarmMessage = value; RaisePropertyChanged(nameof(AlarmMessage)); }
}
/// <summary>
/// LisBox数据模板
@ -277,7 +282,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
//info.ForEach(x => RefreshInStoreTask(x));
try
{
info = info.Where(x => !string.IsNullOrEmpty(search) ? x.materialCode == search : 1 == 1 && !string.IsNullOrEmpty(materialTypeCombox) ? x.storeCode == materialTypeCombox : 1 == 1).ToList();
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
@ -297,7 +302,8 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
}
}
#endregion
}catch(Exception ex)
}
catch (Exception ex)
{
logHelper.Error("入库任务加载异常", ex);
}
@ -314,7 +320,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
this.Query();
}
/// <summary>
/// 柱状体加载
@ -365,11 +371,12 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
Achievement.Add(shellColumn);
Achievement.Add(linerColumn);
}));
}catch(Exception ex)
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
/// <summary>
/// 截取逗号之间的名称
@ -378,11 +385,11 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
/// <returns></returns>
private string SubStringByName(string name)
{
if(string.IsNullOrEmpty(name)) return string.Empty;
if (string.IsNullOrEmpty(name)) return string.Empty;
string result = string.Empty;
try
{
int firstCommaIndex = name.IndexOf(',');
int secondCommaIndex = name.IndexOf(',', firstCommaIndex + 1);
@ -390,7 +397,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
{
result = name.Substring(firstCommaIndex + 1, secondCommaIndex - firstCommaIndex - 1);
}
}
catch (Exception ex)
{

Loading…
Cancel
Save