@@ -12,6 +12,7 @@ using System.Windows; | |||||
namespace BPASmartClient.CustomResource.Pages.Model | namespace BPASmartClient.CustomResource.Pages.Model | ||||
{ | { | ||||
public class AlarmHelper<AlarmT> where AlarmT : class, new() | public class AlarmHelper<AlarmT> where AlarmT : class, new() | ||||
{ | { | ||||
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | ||||
@@ -10,7 +10,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
{ | { | ||||
public AlarmInfo() | public AlarmInfo() | ||||
{ | { | ||||
} | } | ||||
#region 180项目报警信息 | #region 180项目报警信息 | ||||
@@ -54,7 +53,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
/// </summary> | /// </summary> | ||||
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | [Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | ||||
public ushort FryPotFiveRollerTrouble { get; set; } | public ushort FryPotFiveRollerTrouble { get; set; } | ||||
#region 滚筒是否运行状态监测 | |||||
#region 滚筒是否运行状态监测 | |||||
/// <summary> | /// <summary> | ||||
/// 1号滚筒线滚筒未运行 | /// 1号滚筒线滚筒未运行 | ||||
/// </summary> | /// </summary> | ||||
@@ -133,7 +132,5 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
public ushort CleanOutputRollerRunning { get; set; } | public ushort CleanOutputRollerRunning { get; set; } | ||||
#endregion | #endregion | ||||
#endregion | #endregion | ||||
} | } | ||||
} | } |
@@ -38,7 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
private void AddData() | private void AddData() | ||||
{ | { | ||||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||||
Global.userManager.userInfos.Add(new UserInfo() {Id = Guid.NewGuid().ToString(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||||
SaveUser(); | SaveUser(); | ||||
} | } | ||||
@@ -22,10 +22,10 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
private Permission _perimission; | private Permission _perimission; | ||||
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | ||||
private string _userName = "admin"; | |||||
private string _userName ; | |||||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | ||||
private string _password = "admin"; | |||||
private string _password; | |||||
public string CardId { get; set; } = string.Empty; | public string CardId { get; set; } = string.Empty; | ||||
@@ -42,10 +42,11 @@ namespace BPASmartClient.CustomResource.Pages.View | |||||
} | } | ||||
} | } | ||||
else | |||||
{ | |||||
UserManageViewModel.usersInfo.Last().permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||||
} | |||||
//else | |||||
//{ | |||||
// if (UserManageViewModel.usersInfo.Last().permission.ToString() == null) | |||||
// UserManageViewModel.usersInfo.Last().permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||||
//} | |||||
} | } | ||||
@@ -91,7 +91,8 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
AddUserInfoCommand = new RelayCommand( ()=> | AddUserInfoCommand = new RelayCommand( ()=> | ||||
{ | { | ||||
usersInfo.Add(new UserInfo()); | |||||
usersInfo.Add(new UserInfo() { Id=IdProcess()}); | |||||
}); | }); | ||||
SaveDataCommand = new RelayCommand(() => | SaveDataCommand = new RelayCommand(() => | ||||
@@ -250,79 +250,7 @@ namespace BPASmartClient.Modbus | |||||
return default(object); | return default(object); | ||||
} | } | ||||
#region 180项目调用 | |||||
public int GetAddress(string address, string target) | |||||
{ | |||||
if (address == null) return -1; | |||||
if (address.Length > 0) | |||||
{ | |||||
if (address.ToUpper().Contains("D") && address.Length == 5) | |||||
{ | |||||
try | |||||
{ | |||||
string head = "4" + (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); | |||||
string tail = address.Substring(2, 3); | |||||
address = head + tail; | |||||
return Convert.ToInt32(address); | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
//打印日志 | |||||
} | |||||
} | |||||
} | |||||
return -1; | |||||
} | |||||
public object Read(string address, ushort len, string target, byte slaveAddress = 1) | |||||
{ | |||||
if (address == null || tcpClient == null) return default(object); | |||||
ushort startAddress = (ushort)GetAddress(address, target); | |||||
CommandType commandType = CommandType.HoldingRegisters; | |||||
try | |||||
{ | |||||
if (address.ToUpper().Contains("D")) | |||||
{ | |||||
commandType = CommandType.HoldingRegisters; | |||||
return master.ReadHoldingRegisters(slaveAddress, startAddress, len); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"读取地址:【{address}:= {startAddress}】,读取类型:【{commandType.ToString()}】出错,{ex.ToString()}"); | |||||
ExceptionHandling(ex); | |||||
} | |||||
return default(object); | |||||
} | |||||
public void Write<T>(string address, T value, string target, byte slaveAddress = 1) | |||||
{ | |||||
if (address == null || tcpClient == null) return; | |||||
ushort startAddress = (ushort)GetAddress(address, target); | |||||
CommandType commandType = CommandType.Coils; | |||||
try | |||||
{ | |||||
if (address.ToUpper().Contains("D")) | |||||
{ | |||||
commandType = CommandType.HoldingRegisters; | |||||
if (value is ushort ushortValue) | |||||
{ | |||||
master.WriteSingleRegister(slaveAddress, startAddress, ushortValue); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"写入地址:【{address}:= {startAddress}】,写入类型:【{commandType.ToString()}】出错,{ex.ToString()}"); | |||||
ExceptionHandling(ex); | |||||
} | |||||
} | |||||
#endregion | |||||
public void Write<T>(string address, T value, byte slaveAddress = 1) | public void Write<T>(string address, T value, byte slaveAddress = 1) | ||||
@@ -229,7 +229,6 @@ namespace BPASmartClient.MorkF | |||||
} | } | ||||
public void TakePot(object obj) | public void TakePot(object obj) | ||||
{ | { | ||||
WriteData("M14.0", true); | WriteData("M14.0", true); | ||||
} | } | ||||
@@ -663,7 +662,7 @@ namespace BPASmartClient.MorkF | |||||
break; | break; | ||||
case StirFryPotAction.大火t1s: | case StirFryPotAction.大火t1s: | ||||
MinorProcessKitchenAdjustGears(3); | MinorProcessKitchenAdjustGears(3); | ||||
Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作 | |||||
// Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作 | |||||
break; | break; | ||||
case StirFryPotAction.加油: | case StirFryPotAction.加油: | ||||
AddOil();//注油//执行加油操作 | AddOil();//注油//执行加油操作 | ||||
@@ -787,7 +786,7 @@ namespace BPASmartClient.MorkF | |||||
break; | break; | ||||
case StirFryPotAction.大火t1s: | case StirFryPotAction.大火t1s: | ||||
MainProcessKitchenAdjustGears(3); | MainProcessKitchenAdjustGears(3); | ||||
Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作 | |||||
// Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作 | |||||
break; | break; | ||||
case StirFryPotAction.加油: | case StirFryPotAction.加油: | ||||
AddOil();//注油//执行加油操作 | AddOil();//注油//执行加油操作 | ||||
@@ -845,8 +844,6 @@ namespace BPASmartClient.MorkF | |||||
//} | //} | ||||
#endregion | #endregion | ||||
} | } | ||||
morkF.MainOutMealComplete = true; | morkF.MainOutMealComplete = true; | ||||
} | } | ||||
@@ -1531,6 +1531,7 @@ namespace FryPot_DosingSystem.Control | |||||
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; | FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; | ||||
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; | FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; | ||||
} | } | ||||
//炒锅状态实时显示 | //炒锅状态实时显示 | ||||
FryPotStatusDisplay(); | FryPotStatusDisplay(); | ||||
RollerLineStatusDisplay(); | RollerLineStatusDisplay(); | ||||