diff --git a/SlnMesnac.WPF/Model/DmsShutDownModel.cs b/SlnMesnac.WPF/Model/DmsShutDownModel.cs
new file mode 100644
index 0000000..a1937f6
--- /dev/null
+++ b/SlnMesnac.WPF/Model/DmsShutDownModel.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlnMesnac.WPF.Model
+{
+ public class DmsShutDownModel
+ {
+
+ ///
+ /// 序号
+ ///
+ public int id { get; set; }
+
+ ///
+ /// 设备名
+ ///
+ public string deviceName { get; set; }
+
+ ///
+ /// 停机类型
+ ///
+ public string shutReason { get; set; }
+
+ ///
+ /// 停机开始时间
+ ///
+ public string shutBeginTime { get; set; } = "";
+ ///
+ /// 停机结束时间
+ ///
+ public string shutEndTime { get; set; } = "";
+ ///
+ /// 停机总时长,单位:min
+ ///
+ public string totalTime { get; set; } = "";
+ }
+}
diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml b/SlnMesnac.WPF/Page/DevMonitorPage.xaml
index ef0aa95..8537c84 100644
--- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml
+++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml
@@ -32,7 +32,7 @@
-
+
diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
index c5c48e6..138eb2b 100644
--- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
+++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
@@ -10,6 +10,7 @@ using SlnMesnac.Repository.service;
using SlnMesnac.WPF.Dto;
using SlnMesnac.WPF.MessageTips;
using SlnMesnac.WPF.Model;
+using SlnMesnac.WPF.Page.WindowPage;
using SlnMesnac.WPF.ViewModel;
using SqlSugar;
using System;
@@ -2524,5 +2525,12 @@ namespace SlnMesnac.WPF.Page
});
}
+ private void MachineStopHistoryButton_Click(object sender, RoutedEventArgs e)
+ {
+ MachineStopHistoryWindow window = new MachineStopHistoryWindow();
+ window.ShowDialog();
+ }
+
+
}
}
diff --git a/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml b/SlnMesnac.WPF/Page/WindowPage/BagsAmountSetWindow.xaml
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml
rename to SlnMesnac.WPF/Page/WindowPage/BagsAmountSetWindow.xaml
diff --git a/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml.cs b/SlnMesnac.WPF/Page/WindowPage/BagsAmountSetWindow.xaml.cs
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml.cs
rename to SlnMesnac.WPF/Page/WindowPage/BagsAmountSetWindow.xaml.cs
diff --git a/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml b/SlnMesnac.WPF/Page/WindowPage/InputDialogWindow.xaml
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml
rename to SlnMesnac.WPF/Page/WindowPage/InputDialogWindow.xaml
diff --git a/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml.cs b/SlnMesnac.WPF/Page/WindowPage/InputDialogWindow.xaml.cs
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml.cs
rename to SlnMesnac.WPF/Page/WindowPage/InputDialogWindow.xaml.cs
diff --git a/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml b/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml
new file mode 100644
index 0000000..e233c8e
--- /dev/null
+++ b/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml.cs b/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml.cs
new file mode 100644
index 0000000..65f7f54
--- /dev/null
+++ b/SlnMesnac.WPF/Page/WindowPage/MachineStopHistoryWindow.xaml.cs
@@ -0,0 +1,39 @@
+using SlnMesnac.WPF.ViewModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace SlnMesnac.WPF.Page.WindowPage
+{
+ ///
+ /// MachineStopHistoryWindow.xaml 的交互逻辑
+ ///
+ public partial class MachineStopHistoryWindow : Window
+ {
+ public MachineStopHistoryWindow()
+ {
+ InitializeComponent();
+ MachineStopHistoryViewModel vm = new MachineStopHistoryViewModel();
+ this.DataContext = vm;
+ }
+
+
+ private void Window_StateChanged(object sender, EventArgs e)
+ {
+ if (this.WindowState == WindowState.Minimized)
+ {
+ this.Close(); // 当窗口最小化时关闭窗口
+ }
+ }
+ }
+}
diff --git a/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml b/SlnMesnac.WPF/Page/WindowPage/RecipeManageSetWindow.xaml
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml
rename to SlnMesnac.WPF/Page/WindowPage/RecipeManageSetWindow.xaml
diff --git a/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml.cs b/SlnMesnac.WPF/Page/WindowPage/RecipeManageSetWindow.xaml.cs
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml.cs
rename to SlnMesnac.WPF/Page/WindowPage/RecipeManageSetWindow.xaml.cs
diff --git a/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml b/SlnMesnac.WPF/Page/WindowPage/RecipeModeSetWindow.xaml
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml
rename to SlnMesnac.WPF/Page/WindowPage/RecipeModeSetWindow.xaml
diff --git a/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml.cs b/SlnMesnac.WPF/Page/WindowPage/RecipeModeSetWindow.xaml.cs
similarity index 100%
rename from SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml.cs
rename to SlnMesnac.WPF/Page/WindowPage/RecipeModeSetWindow.xaml.cs
diff --git a/SlnMesnac.WPF/SlnMesnac.WPF.csproj b/SlnMesnac.WPF/SlnMesnac.WPF.csproj
index ffca841..9cd4fa5 100644
--- a/SlnMesnac.WPF/SlnMesnac.WPF.csproj
+++ b/SlnMesnac.WPF/SlnMesnac.WPF.csproj
@@ -52,16 +52,16 @@
Code
-
+
Code
-
+
Code
-
+
Code
-
+
Code
diff --git a/SlnMesnac.WPF/ViewModel/MachineStopHistoryViewModel.cs b/SlnMesnac.WPF/ViewModel/MachineStopHistoryViewModel.cs
new file mode 100644
index 0000000..f7cca28
--- /dev/null
+++ b/SlnMesnac.WPF/ViewModel/MachineStopHistoryViewModel.cs
@@ -0,0 +1,128 @@
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using Microsoft.Extensions.DependencyInjection;
+using SlnMesnac.Business;
+using SlnMesnac.Model.domain;
+using SlnMesnac.Model.dto;
+using SlnMesnac.WPF.MessageTips;
+using SlnMesnac.WPF.Model;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Drawing.Printing;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+#region << 版 本 注 释 >>
+/*--------------------------------------------------------------------
+* 版权所有 (c) 2024 WenJY 保留所有权利。
+* CLR版本:4.0.30319.42000
+* 机器名称:LAPTOP-E0N2L34V
+* 命名空间:SlnMesnac.WPF.ViewModel
+* 唯一标识:14008fcc-0a31-4f1e-bc80-9f9ea84d3de5
+*
+* 创建者:WenJY
+* 电子邮箱:wenjy@mesnac.com
+* 创建时间:2024-04-10 16:18:57
+* 版本:V1.0.0
+* 描述:
+*
+*--------------------------------------------------------------------
+* 修改人:
+* 时间:
+* 修改说明:
+*
+* 版本:V1.0.0
+*--------------------------------------------------------------------*/
+#endregion << 版 本 注 释 >>
+namespace SlnMesnac.WPF.ViewModel
+{
+ ///
+ /// 生产统计ViewModel
+ ///
+ internal class MachineStopHistoryViewModel : ViewModelBase
+ {
+ private readonly ISqlSugarClient? sqlSugarClient;
+
+ private Dictionary machineNameDic = new Dictionary();
+ public MachineStopHistoryViewModel()
+ {
+ sqlSugarClient = App.ServiceProvider.GetService();
+
+ InitList();
+
+ }
+
+ private async void InitList()
+ {
+ machineNameDic.Add(1016, "3楼拆包机");
+ machineNameDic.Add(1017, "2楼磁选机");
+ machineNameDic.Add(1018, "2楼螺旋机");
+ machineNameDic.Add(1019, "2楼烘干机");
+ machineNameDic.Add(1020, "2楼除尘机");
+ machineNameDic.Add(1021, "2楼喷码机");
+ await RefreshWcsTaskDataGrid();
+ }
+
+
+ #region 参数定义
+
+ ///
+ /// 停机记录DataGrid
+ ///
+ private ObservableCollection dmsShutDownModelDataGrid = new ObservableCollection();
+
+ public ObservableCollection DmsShutDownModelDataGrid
+ {
+ get { return dmsShutDownModelDataGrid; }
+ set { dmsShutDownModelDataGrid = value; RaisePropertyChanged(() => DmsShutDownModelDataGrid); }
+
+ }
+ #endregion
+
+
+
+ ///
+ /// 刷新停机记录信息
+ ///
+ ///
+ private async Task RefreshWcsTaskDataGrid(int pageNumber=1,int pageSize=20)
+ {
+ try
+ {
+ List deviceIds = new List { 1016, 1017, 1018, 1019, 1020, 1021 };
+ List list = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable().Where(x=>deviceIds.Contains(x.DeviceId)).OrderByDescending(x=>x.ShutBeginTime).ToPageListAsync(pageNumber,pageSize);
+
+ await App.Current.Dispatcher.BeginInvoke((Action)(() =>
+ {
+ dmsShutDownModelDataGrid.Clear();
+ int startId = (pageNumber-1)*pageSize+1;
+ foreach (var item in list)
+ {
+ DmsShutDownModel model = new DmsShutDownModel();
+ model.id = startId++;
+ model.deviceName = machineNameDic[item.DeviceId];
+ model.shutReason = item.ShutReason??"未知";
+ model.shutBeginTime = item.ShutBeginTime==null?"":item.ShutBeginTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
+ model.shutEndTime = item.ShutEndTime == null?"":item.ShutEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
+ model.totalTime = item.ShutEndTime == null ? "" : (item.ShutEndTime.Value - item.ShutBeginTime.Value).TotalMinutes.ToString("F2");
+ dmsShutDownModelDataGrid.Add(model);
+ }
+
+ }));
+
+
+ }catch(Exception ex)
+ {
+ Msg.MsgShow($"刷新停机记录信息{ex.Message}", 2, 3);
+ }
+
+ }
+
+
+ }
+}