From 9707453c98dff27be7129c957f05aeb385bf4a99 Mon Sep 17 00:00:00 2001
From: maqiao <625215135@qq.com>
Date: Wed, 18 Sep 2024 13:18:12 +0800
Subject: [PATCH] =?UTF-8?q?=E9=BA=BB=E9=86=89=E5=8C=BB=E7=94=9F=E5=BD=93?=
=?UTF-8?q?=E5=A4=A9=E4=BD=BF=E7=94=A8=E8=BF=87=E7=9A=84=E6=9F=9C=E5=AD=90?=
=?UTF-8?q?=E4=B8=8E=E6=9C=AA=E4=BD=BF=E7=94=A8=E8=BF=87=E7=9A=84=E6=9F=9C?=
=?UTF-8?q?=E5=AD=90=E7=94=A8=E9=A2=9C=E8=89=B2=E5=8C=BA=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
DM_Weight/Models/ChannelList.cs | 13 +-
.../CheckOrderNewWindowViewModel.cs | 245 +++++++++++++++++-
.../ViewModels/OpenBoxWindowViewModel.cs | 19 +-
.../ViewModels/SettingBoxWindowViewModel.cs | 26 +-
DM_Weight/Views/CheckOrderNewWindow.xaml | 39 ++-
5 files changed, 305 insertions(+), 37 deletions(-)
diff --git a/DM_Weight/Models/ChannelList.cs b/DM_Weight/Models/ChannelList.cs
index fc1cf4a..be4fd1b 100644
--- a/DM_Weight/Models/ChannelList.cs
+++ b/DM_Weight/Models/ChannelList.cs
@@ -58,12 +58,13 @@ namespace DM_Weight.Models
/////
//[SugarColumn(ColumnName = "manu_no")]
//public string ManuNo { get; set; }
- /////
- /////
- ///// 默认值: NULL
- /////
- //[SugarColumn(ColumnName = "eff_date")]
- //public string EffDate { get; set; }
+ ///
+ ///
+ ///这个值 用于控制柜子使用与未使用的状态
+ ///自始至终未使用是空值,打开了则记录当前打开时间,根据时间修改按钮颜色
+ ///
+ [SugarColumn(ColumnName = "eff_date")]
+ public string EffDate { get; set; }
/////
/////
///// 默认值: NULL
diff --git a/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs b/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs
index 2779225..857ca6a 100644
--- a/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs
+++ b/DM_Weight/ViewModels/CheckOrderNewWindowViewModel.cs
@@ -18,6 +18,7 @@ using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Media;
namespace DM_Weight.ViewModels
{
@@ -120,6 +121,114 @@ namespace DM_Weight.ViewModels
public OrderInfo selectOrderInfo { get => _selectOrderInfo; set => SetProperty(ref _selectOrderInfo, value); }
+ private Brush _button1Color = Brushes.White;
+ public Brush Button1Color
+ {
+ get => _button1Color;
+ set =>SetProperty(ref _button1Color, value);
+ }
+ private Brush _button2Color = Brushes.White;
+ public Brush Button2Color
+ {
+ get => _button2Color;
+ set =>SetProperty(ref _button2Color, value);
+ }
+ private Brush _button3Color = Brushes.White;
+ public Brush Button3Color
+ {
+ get => _button3Color;
+ set =>SetProperty(ref _button3Color, value);
+ }
+ private Brush _button4Color = Brushes.White;
+ public Brush Button4Color
+ {
+ get => _button4Color;
+ set =>SetProperty(ref _button4Color, value);
+ }
+ private Brush _button5Color = Brushes.White;
+ public Brush Button5Color
+ {
+ get => _button5Color;
+ set =>SetProperty(ref _button5Color, value);
+ }
+ private Brush _button6Color = Brushes.White;
+ public Brush Button6Color
+ {
+ get => _button6Color;
+ set =>SetProperty(ref _button6Color, value);
+ }
+ private Brush _button7Color = Brushes.White;
+ public Brush Button7Color
+ {
+ get => _button7Color;
+ set =>SetProperty(ref _button7Color, value);
+ }
+ private Brush _button8Color = Brushes.White;
+ public Brush Button8Color
+ {
+ get => _button8Color;
+ set =>SetProperty(ref _button8Color, value);
+ }
+ private Brush _button9Color = Brushes.White;
+ public Brush Button9Color
+ {
+ get => _button9Color;
+ set =>SetProperty(ref _button9Color, value);
+ }
+ private Brush _button10Color = Brushes.White;
+ public Brush Button10Color
+ {
+ get => _button10Color;
+ set =>SetProperty(ref _button10Color, value);
+ }
+ private Brush _button11Color = Brushes.White;
+ public Brush Button11Color
+ {
+ get => _button11Color;
+ set =>SetProperty(ref _button11Color, value);
+ }
+ private Brush _button12Color = Brushes.White;
+ public Brush Button12Color
+ {
+ get => _button12Color;
+ set =>SetProperty(ref _button12Color, value);
+ }
+ private Brush _button13Color = Brushes.White;
+ public Brush Button13Color
+ {
+ get => _button13Color;
+ set =>SetProperty(ref _button13Color, value);
+ }
+ private Brush _button14Color = Brushes.White;
+ public Brush Button14Color
+ {
+ get => _button14Color;
+ set =>SetProperty(ref _button14Color, value);
+ }
+ private Brush _button15Color = Brushes.White;
+ public Brush Button15Color
+ {
+ get => _button15Color;
+ set =>SetProperty(ref _button15Color, value);
+ }
+ private Brush _button16Color = Brushes.White;
+ public Brush Button16Color
+ {
+ get => _button16Color;
+ set =>SetProperty(ref _button16Color, value);
+ }
+ private Brush _button17Color = Brushes.White;
+ public Brush Button17Color
+ {
+ get => _button17Color;
+ set =>SetProperty(ref _button17Color, value);
+ }
+ private Brush _button18Color = Brushes.White;
+ public Brush Button18Color
+ {
+ get => _button18Color;
+ set =>SetProperty(ref _button18Color, value);
+ }
IEventAggregator _eventAggregator;
private PortUtil _portUtil;
@@ -149,8 +258,8 @@ namespace DM_Weight.ViewModels
if (DrawerNo >= 0)
{
//查询当前药箱归属的药师
- string currentDrawerUser = SqlSugarHelper.Db.Queryable().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").Select(cl => cl.BelongUser).First();
-
+ ChannelList currentList = SqlSugarHelper.Db.Queryable().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").First();//.Select(cl => cl.BelongUser).First();
+ string currentDrawerUser = currentList.BelongUser;
OrderInfoList = SqlSugarHelper.Db.Queryable()
.Includes(oi => oi.OrderDetailList, od => od.DrugInfo)
//.Includes(cl => cl.channelStocks, cs => cs.DrugInfo,di=>di.drugBase)
@@ -179,6 +288,138 @@ namespace DM_Weight.ViewModels
TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
+ if(currentList.EffDate== DateTime.Now.ToString("yyyy-MM-dd"))
+ {
+ switch (DrawerNo)
+ {
+ case 1:
+ _button1Color = Brushes.Yellow;
+ break;
+ case 2:
+ _button2Color = Brushes.Yellow;
+ break;
+ case 3:
+ _button3Color = Brushes.Yellow;
+ break;
+ case 4:
+ _button4Color = Brushes.Yellow;
+ break;
+ case 5:
+ _button5Color = Brushes.Yellow;
+ break;
+ case 6:
+ _button6Color = Brushes.Yellow;
+ break;
+ case 7:
+ _button7Color = Brushes.Yellow;
+ break;
+ case 8:
+ _button8Color = Brushes.Yellow;
+ break;
+ case 9:
+ _button9Color = Brushes.Yellow;
+ break;
+ case 10:
+ _button10Color = Brushes.Yellow;
+ break;
+ case 11:
+ _button11Color = Brushes.Yellow;
+ break;
+ case 12:
+ _button12Color = Brushes.Yellow;
+ break;
+ case 13:
+ _button13Color = Brushes.Yellow;
+ break;
+ case 14:
+ _button14Color = Brushes.Yellow;
+ break;
+ case 15:
+ _button15Color = Brushes.Yellow;
+ break;
+ case 16:
+ _button16Color = Brushes.Yellow;
+ break;
+ case 17:
+ _button17Color = Brushes.Yellow;
+ break;
+ case 18:
+ _button18Color = Brushes.Yellow;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ List chlList = SqlSugarHelper.Db.Queryable().Where(cl => cl.MachineId == "DM5").ToList();//.Select(cl => cl.BelongUser).First();
+ if (chlList != null && chlList.Count > 0)
+ {
+ for (int i = 0; i < chlList.Count; i++)
+ {
+ ChannelList chl = chlList[i];
+ if (chl.EffDate == DateTime.Now.ToString("yyyy-MM-dd"))
+ {
+ switch (chl.DrawerNo)
+ {
+ case 1:
+ Button1Color = Brushes.Yellow;
+ break;
+ case 2:
+ Button2Color = Brushes.Yellow;
+ break;
+ case 3:
+ Button3Color = Brushes.Yellow;
+ break;
+ case 4:
+ Button4Color = Brushes.Yellow;
+ break;
+ case 5:
+ Button5Color = Brushes.Yellow;
+ break;
+ case 6:
+ Button6Color = Brushes.Yellow;
+ break;
+ case 7:
+ Button7Color = Brushes.Yellow;
+ break;
+ case 8:
+ Button8Color = Brushes.Yellow;
+ break;
+ case 9:
+ Button9Color = Brushes.Yellow;
+ break;
+ case 10:
+ Button9Color = Brushes.Yellow;
+ break;
+ case 11:
+ Button9Color = Brushes.Yellow;
+ break;
+ case 12:
+ Button12Color = Brushes.Yellow;
+ break;
+ case 13:
+ Button13Color = Brushes.Yellow;
+ break;
+ case 14:
+ Button14Color = Brushes.Yellow;
+ break;
+ case 15:
+ Button15Color = Brushes.Yellow;
+ break;
+ case 16:
+ Button16Color = Brushes.Yellow;
+ break;
+ case 17:
+ Button17Color = Brushes.Yellow;
+ break;
+ case 18:
+ Button18Color = Brushes.Yellow;
+ break;
+ default:
+ break;
+ }
+ }
+ }
}
}
public DelegateCommand RowSelected
diff --git a/DM_Weight/ViewModels/OpenBoxWindowViewModel.cs b/DM_Weight/ViewModels/OpenBoxWindowViewModel.cs
index 95d0fe3..67b4abc 100644
--- a/DM_Weight/ViewModels/OpenBoxWindowViewModel.cs
+++ b/DM_Weight/ViewModels/OpenBoxWindowViewModel.cs
@@ -50,7 +50,7 @@ namespace DM_Weight.ViewModels
//抽屉号列表
- public static List iList = new List();
+ public static List iList = new List();
//第几个抽屉号
//public static int iNumber = 1;
private PortUtil _portUtil;
@@ -83,8 +83,8 @@ namespace DM_Weight.ViewModels
private void SearchBox()
{
iList = SqlSugarHelper.Db.Queryable().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
- .WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
- .Select(cl => cl.DrawerNo).ToList();
+ .WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).ToList();
+ // .Select(cl => cl.DrawerNo).ToList();
if (iList.Count > 0)
{
//_portUtil.SpeakAsync("正在打开药箱");
@@ -94,19 +94,24 @@ namespace DM_Weight.ViewModels
for (int i = 0; i < iList.Count; i++)
{
+ ChannelList channelList= iList[i];
//记录开药箱日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
- DrawerNo = iList[i],
+ DrawerNo = channelList.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = $"打开{iList[i]}号药箱",
}).ExecuteCommand();
- _portUtil.SpeakAsync($"正在打开{iList[i]}号药箱");
- logger.Info($"正在打开{iList[i]}号药箱");
- ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
+ //记录药箱打开时间
+ channelList.EffDate = DateTime.Now.ToString("yyyy-MM-dd");
+ SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it=>new { it.EffDate }).ExecuteCommand();
+
+ _portUtil.SpeakAsync($"正在打开{channelList.DrawerNo}号药箱");
+ logger.Info($"正在打开{channelList.DrawerNo}号药箱");
+ ModbusHelper.GetInstance().OpenBoxDoor(channelList.DrawerNo - 1);
Thread.Sleep(1000);
}
diff --git a/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs b/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs
index 9b71866..0960cf1 100644
--- a/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs
+++ b/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs
@@ -2,6 +2,7 @@
using DM_Weight.msg;
using DM_Weight.Port;
using DM_Weight.util;
+using MaterialDesignThemes.Wpf;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
@@ -14,11 +15,25 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Media;
namespace DM_Weight.ViewModels
{
public class SettingBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{
+ private SolidColorBrush _colorBrush;
+
+ public SolidColorBrush SnackbarBackground
+ {
+ get => _colorBrush;
+ set => SetProperty(ref _colorBrush, value);
+ }
+ private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
+ public ISnackbarMessageQueue SnackbarMessageQueue
+ {
+ get => _snackbarMessageQueue;
+ set => SetProperty(ref _snackbarMessageQueue, value);
+ }
private int _drawerNo = 0;
public int DrawerNo
@@ -218,8 +233,8 @@ namespace DM_Weight.ViewModels
{
Message = $"未选择药箱,请先选择药箱",
Type = MsgType.ERROR
- };
- _eventAggregator.GetEvent().Publish(alertMsg);
+ };
+ _eventAggregator.GetEvent().Publish(alertMsg);
}
});
}
@@ -295,6 +310,13 @@ namespace DM_Weight.ViewModels
}
}
+ public DelegateCommand Query
+ {
+ get => new DelegateCommand(() =>
+ {
+ BindUserList();
+ });
+ }
}
///
/// 药箱类型
diff --git a/DM_Weight/Views/CheckOrderNewWindow.xaml b/DM_Weight/Views/CheckOrderNewWindow.xaml
index a2dc6f5..c8586cd 100644
--- a/DM_Weight/Views/CheckOrderNewWindow.xaml
+++ b/DM_Weight/Views/CheckOrderNewWindow.xaml
@@ -74,27 +74,26 @@
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+