1)退出判断重复,删除重复
2)添加insert表dm_machine_record时将部分reviewer字段插入 3)修改回收箱查数指令(原指令错误)
This commit is contained in:
parent
531c01bc4e
commit
55dbe8185a
|
@ -635,8 +635,8 @@ namespace DM_Weight.Port
|
|||
private byte[] GetBufferByPort(SerialPort serialPort, int length, int timeout)
|
||||
{
|
||||
byte[] buffer = new byte[length];
|
||||
try
|
||||
{
|
||||
// try
|
||||
// {
|
||||
int _length = 0;
|
||||
DateTime start = DateTime.Now;
|
||||
DateTime end = DateTime.Now;
|
||||
|
@ -650,11 +650,11 @@ namespace DM_Weight.Port
|
|||
throw new TimeoutException($"串口【{serialPort.PortName}】交互超时");
|
||||
}
|
||||
serialPort.Read(buffer, 0, length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"GetBufferByPort:{ex.Message}");
|
||||
}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// logger.Error($"GetBufferByPort:{ex.Message}");
|
||||
// }
|
||||
return buffer;
|
||||
}
|
||||
private Task<byte[]> GetBufferByPort(SerialPort serialPort, int length)
|
||||
|
@ -1128,8 +1128,8 @@ namespace DM_Weight.Port
|
|||
try
|
||||
{
|
||||
canBusSerial.DiscardInBuffer();
|
||||
//byte[] buffer = new byte[] { 0xAA, 0x9A, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0x00, 0xEE };
|
||||
byte[] buffer = new byte[] { 0xAA, 0x9A, 01, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0xEE };
|
||||
byte[] buffer = new byte[] { 0xAA, 0x9A, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0x00, 0xEE };
|
||||
//byte[] buffer = new byte[] { 0xAA, 0x9A, 01, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0xEE };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
|
||||
return await GetBufferByPort(canBusSerial, 8);
|
||||
|
|
|
@ -296,6 +296,7 @@ namespace DM_Weight.ViewModels
|
|||
ManuNo = it.ManuNo,
|
||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
Reviewer=HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
|
|
|
@ -198,6 +198,7 @@ namespace DM_Weight.ViewModels
|
|||
ManuNo = it.ManuNo,
|
||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
Reviewer=HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
|
|
|
@ -21,6 +21,7 @@ using System.Timers;
|
|||
using Unity;
|
||||
using System.Windows.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using DM_Weight.msg;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -127,20 +128,20 @@ namespace DM_Weight.ViewModels
|
|||
get { return _selectedMenu; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (value.PremissionName == "退出")
|
||||
{
|
||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedChildMenu = value.Children[0];
|
||||
}
|
||||
}
|
||||
//if (value != null)
|
||||
//{
|
||||
// if (value.PremissionName == "退出")
|
||||
// {
|
||||
// logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
// Operator = null;
|
||||
// Reviewer = null;
|
||||
// _regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SelectedChildMenu = value.Children[0];
|
||||
// }
|
||||
//}
|
||||
SetProperty(ref _selectedMenu, value);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
SelectedMenu.Children = SelectedMenu.Children;
|
||||
//SelectedMenu.Children = SelectedMenu.Children;
|
||||
SelectedChildMenu = SelectedMenu.Children[0];
|
||||
}
|
||||
}
|
||||
|
@ -182,12 +183,14 @@ namespace DM_Weight.ViewModels
|
|||
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
|
||||
public bool KeepAlive => false;
|
||||
private PortUtil _portUtil;
|
||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container)
|
||||
IEventAggregator _eventAggregator;
|
||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_regionManager = iRegionManager;
|
||||
_dialogService = dialogService;
|
||||
_container = container;
|
||||
this._eventAggregator = eventAggregator;
|
||||
}
|
||||
|
||||
public DelegateCommand<string> OpenFingerDialog
|
||||
|
@ -276,11 +279,27 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
|
||||
List<PremissionDm> premissions = UserList.Role.Permissions;
|
||||
|
||||
if (premissions.Count <= 0)
|
||||
{
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
});
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"用户{UserList.Nickname}或还未设置权限,请联系管理员",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
return;
|
||||
}
|
||||
//SqlSugarHelper.Db.SqlQueryable<PremissionDm>(sql)
|
||||
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
|
||||
PremissionDmList = premissions;
|
||||
SelectedMenu = premissions[0];
|
||||
SelectedChildMenu = premissions[0].Children[0];
|
||||
FindDrawerCount();
|
||||
|
||||
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
|
||||
|
|
|
@ -155,7 +155,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
Username = "";
|
||||
Password = "";
|
||||
}
|
||||
else if (userList.Role == null)
|
||||
else if (userList.Role == null|| userList.Role.Permissions.Count<=0)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue