From 11f71fb97bb4d67bd6341ac550064ded64432374 Mon Sep 17 00:00:00 2001 From: liuwf Date: Sat, 12 Oct 2024 09:43:54 +0800 Subject: [PATCH] =?UTF-8?q?change-=E6=B7=BB=E5=8A=A03F=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=8A=95=E6=96=99=E5=87=BA=E5=BA=93=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Business/ProdMgmtBusiness.cs | 28 ++++++++++++++++++--- SlnMesnac.WPF/MessageTips/MessageAdorner.cs | 2 ++ SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs | 11 +++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/SlnMesnac.Business/ProdMgmtBusiness.cs b/SlnMesnac.Business/ProdMgmtBusiness.cs index 94e3a9d..1f8ecaf 100644 --- a/SlnMesnac.Business/ProdMgmtBusiness.cs +++ b/SlnMesnac.Business/ProdMgmtBusiness.cs @@ -68,6 +68,12 @@ namespace SlnMesnac.Business private readonly ConfigInfoBusiness _configInfoBusiness; + /// + /// 消息弹框提示 + /// + /// + public delegate void MsgHandler(string message, int msgtype, int outTime = 3); + public static event MsgHandler MsgHandlerEvent; private ISqlSugarClient sqlSugarClient; @@ -82,7 +88,6 @@ namespace SlnMesnac.Business _basePalletInfoService = basePalletInfoService; _baseRealTaskService = baseRealTaskService; _mesPrdBarCodeService = serviceProvider.GetRequiredService(); - _configInfoBusiness = configInfoBusiness; // TestTran(); @@ -193,6 +198,7 @@ namespace SlnMesnac.Business { try { + RefreshMesProdList(); var plc = base.GetPlcByKey("plc"); @@ -303,7 +309,7 @@ namespace SlnMesnac.Business /// public void MaterialPutInCheck() { - + bool result = false; var plc = base.GetPlcByKey("plc"); while (true) @@ -517,11 +523,27 @@ namespace SlnMesnac.Business bool result = false; try { - + //判断当前模式,手动需从出库队列叫料,如果没有出库队列,弹框提醒;自动模式,库位参数为Null + string targetLocationCode = null; + if(debugConfig.ProductMode== "1") + { + // 手动模式出库队列 + WmsRawPreferredOut? PreferredOut = sqlSugarClient.AsTenant().GetConnection("mes").Queryable().OrderBy(x=>x.RawPreferredOutId).First(); + if (PreferredOut == null) + { + MsgHandlerEvent?.Invoke("当前投料手动模式,无出库队列,请在投料管理添加出库队列,或修改为自动投料模式", 2, 4); + return false; + } + else + { + targetLocationCode = PreferredOut.LocationCode; + } + } var content = new { rawOutstockId = taskId, + locationCode = targetLocationCode, }; string message = JsonConvert.SerializeObject(content); diff --git a/SlnMesnac.WPF/MessageTips/MessageAdorner.cs b/SlnMesnac.WPF/MessageTips/MessageAdorner.cs index a13ebf8..a0f09ad 100644 --- a/SlnMesnac.WPF/MessageTips/MessageAdorner.cs +++ b/SlnMesnac.WPF/MessageTips/MessageAdorner.cs @@ -9,6 +9,7 @@ using System.Windows.Media; using System.Windows.Threading; using System.Windows; using MaterialDesignThemes.Wpf; +using SlnMesnac.Business; namespace SlnMesnac.WPF.MessageTips { @@ -20,6 +21,7 @@ namespace SlnMesnac.WPF.MessageTips public MessageAdorner(UIElement adornedElement) : base(adornedElement) { this.adornedElement = adornedElement as FrameworkElement; + } public void PushMessage(string message, int msgtype, int outTime) diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs index 41469f1..c3dca42 100644 --- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs +++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs @@ -30,6 +30,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using TouchSocket.Core; +using static SlnMesnac.Business.ProdMgmtBusiness; namespace SlnMesnac.WPF.Page { @@ -68,7 +69,7 @@ namespace SlnMesnac.WPF.Page dmsRecordShutDownService = App.ServiceProvider.GetService(); dmsRecordAlarmTimeService = App.ServiceProvider.GetService(); dmsRealtimeStatusService = App.ServiceProvider.GetService(); - + ProdMgmtBusiness.MsgHandlerEvent += MsgHandler; RecipeModeSetWindow.ManualChangeRecipeEvent += ManualChangeRecipe; _logger = App.ServiceProvider.GetService>(); _configInfoBusiness = App.ServiceProvider.GetService(); @@ -83,6 +84,14 @@ namespace SlnMesnac.WPF.Page StartAdjustRecipe(); } + private void MsgHandler(string message, int msgtype, int outTime = 3) + { + Application.Current.Dispatcher.Invoke(() => + { + Msg.MsgShow(message, msgtype, outTime); + }); + + } private void Init()