fix-优化消息提示框

dev
liuwf 1 month ago
parent 1ac584ee02
commit e5dded0b50

@ -24,7 +24,9 @@ namespace SlnMesnac.WPF.MessageTips
{ {
try try
{ {
if (messageAdorner != null) Application.Current.Dispatcher.Invoke(() =>
{
if (messageAdorner != null && messageAdorner.IsLoaded)
{ {
messageAdorner.PushMessage(message, msgtype, outTime); messageAdorner.PushMessage(message, msgtype, outTime);
return; return;
@ -43,6 +45,9 @@ namespace SlnMesnac.WPF.MessageTips
messageAdorner = new MessageAdorner(layer); messageAdorner = new MessageAdorner(layer);
layer.Add(messageAdorner); layer.Add(messageAdorner);
messageAdorner.PushMessage(message, msgtype, outTime); messageAdorner.PushMessage(message, msgtype, outTime);
});
}catch(Exception ex) }catch(Exception ex)
{ {
Console.WriteLine("MsgShow异常:"+ex.Message); Console.WriteLine("MsgShow异常:"+ex.Message);

@ -157,14 +157,24 @@ namespace SlnMesnac.WPF.ViewModel
int? row = targetLocation.LocRow % 2 == 0 ? targetLocation.LocRow - 1 : targetLocation.LocRow + 1; int? row = targetLocation.LocRow % 2 == 0 ? targetLocation.LocRow - 1 : targetLocation.LocRow + 1;
WmsBaseLocation? shallowLocation = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WmsBaseLocation>().Where(it => it.WarehouseId == 311 && it.LocRow == row && it.LocColumn == targetLocation.LocColumn).First(); WmsBaseLocation? shallowLocation = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WmsBaseLocation>().Where(it => it.WarehouseId == 311 && it.LocRow == row && it.LocColumn == targetLocation.LocColumn).First();
if (shallowLocation == null) if (shallowLocation == null)
{
Application.Current.Dispatcher.Invoke(() =>
{ {
Msg.MsgShow($"未找到当前深库位对应的浅库位,请重新选择", 2, 3); Msg.MsgShow($"未找到当前深库位对应的浅库位,请重新选择", 2, 3);
});
return; return;
} }
if(shallowLocation.LocationStatus != "1") if(shallowLocation.LocationStatus != "1")
{
Application.Current.Dispatcher.Invoke(() =>
{ {
Msg.MsgShow($"当前库位对应的浅库位{shallowLocation.LocationCode}状态异常,禁止出库", 2, 3); Msg.MsgShow($"当前库位对应的浅库位{shallowLocation.LocationCode}状态异常,禁止出库", 2, 3);
});
return; return;
} }
if (!string.IsNullOrEmpty(shallowLocation.ContainerCode)) if (!string.IsNullOrEmpty(shallowLocation.ContainerCode))
@ -204,16 +214,25 @@ namespace SlnMesnac.WPF.ViewModel
else else
{ {
Application.Current.Dispatcher.Invoke(() =>
{
Msg.MsgShow("输入的库位有误,请重新输入", 2, 5); Msg.MsgShow("输入的库位有误,请重新输入", 2, 5);
});
return; return;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Application.Current.Dispatcher.Invoke(() =>
{
Msg.MsgShow($"保存异常:{ex.Message}", 2, 5); Msg.MsgShow($"保存异常:{ex.Message}", 2, 5);
});
} }
} }
@ -268,8 +287,13 @@ namespace SlnMesnac.WPF.ViewModel
{ {
var deepHas = wmsRawPreferredOutService.Query(x => x.LocationCode == deepLocation.LocationCode).FirstOrDefault(); var deepHas = wmsRawPreferredOutService.Query(x => x.LocationCode == deepLocation.LocationCode).FirstOrDefault();
if(deepHas != null) if(deepHas != null)
{
Application.Current.Dispatcher.Invoke(() =>
{ {
Msg.MsgShow($"当前库位对应的深库位{deepLocation.LocationCode}在出库队列,请先删除", 2, 3); Msg.MsgShow($"当前库位对应的深库位{deepLocation.LocationCode}在出库队列,请先删除", 2, 3);
});
return; return;
} }
} }

Loading…
Cancel
Save