@@ -105,8 +105,6 @@ namespace HBLConsole.Communication | |||
return 0; | |||
} | |||
/// <summary> | |||
/// 获取信号量 | |||
/// </summary> | |||
@@ -118,6 +118,7 @@ namespace HBLConsole.Factory | |||
ActionManage.GetInstance.Register(new Action<object>((o) => { control?.IotBroadcast(o); }), "IotBroadcast"); | |||
ConnectHelper.GetInstance.Init(); | |||
ActionManage.GetInstance.Send("监控数据初始化"); | |||
//ActionManage.GetInstance.Send("NoCompleteOrderInit"); | |||
//GetControlBase(); | |||
} | |||
@@ -10,13 +10,128 @@ namespace HBLConsole.MORKS | |||
{ | |||
public class Alarm : IAlarm | |||
{ | |||
[Alarm("报警测试1")] | |||
public bool AlarmTest1 { get; set; } | |||
[Alarm("报警测试2")] | |||
public bool AlarmTest2 { get; set; } | |||
[Alarm("报警测试3")] | |||
public bool AlarmTest3 { get; set; } | |||
/// <summary> | |||
/// 煮面机左侧低温报警 | |||
/// PLC ---> M550.0 | |||
/// ModbusTcp --> 1570 | |||
/// </summary> | |||
[Alarm("煮面机左侧低温报警")] | |||
public bool MachineLeftLowTemperature { get; set; } | |||
/// <summary> | |||
/// 煮面机左侧低温报警 | |||
/// PLC ---> M550.1 | |||
/// ModbusTcp --> 1571 | |||
/// </summary> | |||
[Alarm("煮面机右侧低温报警")] | |||
public bool MachineRightLowTemperature { get; set; } | |||
/// <summary> | |||
/// 供碗1缺碗 | |||
/// PLC ---> M550.2 | |||
/// ModbusTcp --> 1572 | |||
/// </summary> | |||
[Alarm("供碗1缺碗")] | |||
public bool Supply1_LossBowl { get; set; } | |||
/// <summary> | |||
/// 供碗2缺碗 | |||
/// PLC ---> M550.3 | |||
/// ModbusTcp --> 1573 | |||
/// </summary> | |||
[Alarm("供碗2缺碗")] | |||
public bool Supply2_LossBowl { get; set; } | |||
/// <summary> | |||
/// 供碗1出碗检测异常 | |||
/// PLC ---> M550.4 | |||
/// ModbusTcp --> 1574 | |||
/// </summary> | |||
[Alarm("供碗1出碗检测异常")] | |||
public bool Supply1_ErrorOutBowl { get; set; } | |||
/// <summary> | |||
/// 供碗2出碗检测异常 | |||
/// PLC ---> M550.5 | |||
/// ModbusTcp --> 1575 | |||
/// </summary> | |||
[Alarm("供碗2出碗检测异常")] | |||
public bool Supply2_ErrorOutBowl { get; set; } | |||
/// <summary> | |||
/// 推碗气缸故障 | |||
/// PLC ---> M550.6 | |||
/// ModbusTcp --> 1576 | |||
/// </summary> | |||
[Alarm("推碗气缸故障")] | |||
public bool PushBowlCylinderError { get; set; } | |||
/// <summary> | |||
/// 煮面机通讯异常 | |||
/// PLC ---> M550.7 | |||
/// ModbusTcp --> 1577 | |||
/// </summary> | |||
[Alarm("煮面机通讯异常")] | |||
public bool NoodleMacCommunicateError { get; set; } | |||
/// <summary> | |||
/// 煮面机通讯异常 | |||
/// PLC ---> M551.0 | |||
/// ModbusTcp --> 1580 | |||
/// </summary> | |||
[Alarm("配料机通讯异常")] | |||
public bool DosingMacCommunicateError { get; set; } | |||
/// <summary> | |||
/// 机器人通讯异常 | |||
/// PLC ---> M551.1 | |||
/// ModbusTcp --> 1581 | |||
/// </summary> | |||
[Alarm("机器人通讯异常")] | |||
public bool RobotMacCommunicateError { get; set; } | |||
/// <summary> | |||
/// 机器人初始化失败 | |||
/// PLC ---> M551.3 | |||
/// ModbusTcp --> 1583 | |||
/// </summary> | |||
[Alarm("机器人初始化失败")] | |||
public bool RobotInitError { get; set; } | |||
/// <summary> | |||
/// 机器人急停 | |||
/// PLC ---> M551.4 | |||
/// ModbusTcp --> 1584 | |||
/// </summary> | |||
[Alarm("机器人急停")] | |||
public bool RobotUrgentStop { get; set; } | |||
/// <summary> | |||
/// 机器人不在远程模式 | |||
/// PLC ---> M551.5 | |||
/// ModbusTcp --> 1585 | |||
/// </summary> | |||
[Alarm("机器人不在远程模式")] | |||
public bool RobotNotInRemoteMode { get; set; } | |||
/// <summary> | |||
/// 机器人伺服未就绪 | |||
/// PLC ---> M551.6 | |||
/// ModbusTcp --> 1586 | |||
/// </summary> | |||
[Alarm("机器人伺服未就绪")] | |||
public bool RobotNotInReady { get; set; } | |||
/// <summary> | |||
/// 机器人本体异常 | |||
/// PLC ---> M551.7 | |||
/// ModbusTcp --> 1587 | |||
/// </summary> | |||
[Alarm("机器人本体异常")] | |||
public bool RobotSelfInException { get; set; } | |||
} | |||
} |
@@ -117,6 +117,7 @@ namespace HBLConsole.MORKS | |||
mORKS.TurntableLowerLimit = bools[11]; | |||
mORKS.MissingBowlSignal2 = bools[12]; | |||
mORKS.TurntableUpLimit = bools[13]; | |||
mORKS.FeedComplete = bools[14]; | |||
mORKS.TurntableMoveInPlace = bools[15]; | |||
})); | |||
@@ -310,101 +311,121 @@ namespace HBLConsole.MORKS | |||
/// </summary> | |||
private void TurntableControl() | |||
{ | |||
if (mORKS.TurntableMoveInPlace && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) | |||
{ | |||
if (mORKS.TurntableLowerLimit) | |||
{ | |||
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); | |||
mORKS.AllowTakeNoodle = true; | |||
mORKS.TurntableLocLists.Clear(); | |||
MessageLog.GetInstance.Show("转台位置OK"); | |||
mORKS.IsNoodles = true; | |||
} | |||
else | |||
{ | |||
if (!mORKS.TurntableInterlock) | |||
{ | |||
var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); | |||
if (result != null) | |||
{ | |||
foreach (var item in result) | |||
{ | |||
if (ushort.TryParse(item.BatchingLoc, out ushort loc)) | |||
{ | |||
if (mORKS.TurntableFeedbackloc != loc) | |||
{ | |||
if (!mORKS.TurntableLocLists.Contains(loc)) | |||
{ | |||
TurntableStart(loc); | |||
MessageLog.GetInstance.Show("未检测到物料,启动转台查找"); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
mORKS.IsNoodles = false; | |||
MessageLog.GetInstance.Show("转台位置缺少物料"); | |||
} | |||
} | |||
} | |||
} | |||
#region 优化版本 | |||
//if (mORKS.TurntableMoveInPlace && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) | |||
//{ | |||
// var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); | |||
// if (mORKS.TurntableLowerLimit) | |||
// { | |||
// if (mORKS.TurntableFeedbackloc == mORKS.RBTakeNoodleTask.ElementAt(0).Loc || (result?.Count > 0 && result?.Count == mORKS.TurntableLocLists.Count)) | |||
// { | |||
// mORKS.TurntableLocLists.Clear(); | |||
// mORKS.AllowTakeNoodle = true; | |||
// MessageLog.GetInstance.Show("转台位置OK,执行机器人取面"); | |||
// } | |||
// else | |||
// { | |||
// if (!mORKS.TurntableInterlock) | |||
// { | |||
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); | |||
// MessageLog.GetInstance.Show($"有物料检测,反馈位置不同的转台启动控制,转台位置:[{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}]"); | |||
// } | |||
// } | |||
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); | |||
// mORKS.AllowTakeNoodle = true; | |||
// mORKS.TurntableLocLists.Clear(); | |||
// MessageLog.GetInstance.Show("转台位置OK"); | |||
// mORKS.IsNoodles = true; | |||
// } | |||
// else | |||
// { | |||
// if (!mORKS.TurntableInterlock) | |||
// { | |||
// var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); | |||
// if (result != null) | |||
// { | |||
// foreach (var item in result) | |||
// { | |||
// if (ushort.TryParse(item.BatchingLoc, out ushort loc)) | |||
// { | |||
// if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc)) | |||
// if (mORKS.TurntableFeedbackloc != loc) | |||
// { | |||
// TurntableStart(loc); | |||
// MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); | |||
// break; | |||
// if (!mORKS.TurntableLocLists.Contains(loc)) | |||
// { | |||
// TurntableStart(loc); | |||
// MessageLog.GetInstance.Show("未检测到物料,启动转台查找"); | |||
// return; | |||
// } | |||
// } | |||
// else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc); | |||
// } | |||
// } | |||
// mORKS.IsNoodles = false; | |||
// MessageLog.GetInstance.Show("转台位置缺少物料"); | |||
// } | |||
// } | |||
// } | |||
//} | |||
#region 优化版本 | |||
if (mORKS.TurntableMoveInPlace && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0) | |||
{ | |||
var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); | |||
if (mORKS.TurntableLowerLimit) | |||
{ | |||
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString()); | |||
if (res != null) | |||
{ | |||
mORKS.TurntableLocLists.Clear(); | |||
mORKS.AllowTakeNoodle = true; | |||
ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, mORKS.TurntableFeedbackloc); | |||
MessageLog.GetInstance.Show("转台位置OK,执行机器人取面"); | |||
} | |||
//if (mORKS.TurntableFeedbackloc == mORKS.RBTakeNoodleTask.ElementAt(0).Loc || (result?.Count > 0 && result?.Count == mORKS.TurntableLocLists.Count)) | |||
//{ | |||
// mORKS.TurntableLocLists.Clear(); | |||
// mORKS.AllowTakeNoodle = true; | |||
// MessageLog.GetInstance.Show("转台位置OK,执行机器人取面"); | |||
//} | |||
//else | |||
//{ | |||
// if (!mORKS.TurntableInterlock) | |||
// { | |||
// //TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); | |||
// mORKS.AllowTakeNoodle = true; | |||
// MessageLog.GetInstance.Show($"有物料检测,反馈位置不同的转台启动控制,转台位置:[{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}]"); | |||
// } | |||
//} | |||
} | |||
else | |||
{ | |||
if (!mORKS.TurntableInterlock) | |||
{ | |||
if (result != null) | |||
{ | |||
foreach (var item in result) | |||
{ | |||
if (ushort.TryParse(item.BatchingLoc, out ushort loc)) | |||
{ | |||
if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc)) | |||
{ | |||
TurntableStart(loc); | |||
MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); | |||
break; | |||
} | |||
else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
//转台到位检测 | |||
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace)) | |||
{ | |||
mORKS.TurntableInterlock = false; | |||
} | |||
//补料完成检测 | |||
if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete)) | |||
{ | |||
if (!mORKS.TurntableLowerLimit && mORKS.TurntableLocLists.Count > 0 && !mORKS.AllowTakeNoodle) | |||
{ | |||
mORKS.TurntableLocLists.Clear(); | |||
mORKS.TurntableInterlock = false; | |||
} | |||
} | |||
#endregion | |||
@@ -425,7 +446,7 @@ namespace HBLConsole.MORKS | |||
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||
{ | |||
//设置转台位置 | |||
TurntableStart(orderLocInfo.Loc); | |||
//TurntableStart(orderLocInfo.Loc); | |||
//设置倒面位置 | |||
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; | |||
@@ -434,7 +455,7 @@ namespace HBLConsole.MORKS | |||
//机器人开始取面 | |||
RobotTakeNoodle(); | |||
SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,转台:[{orderLocInfo}],煮面栏:[{loc + 1}]"); | |||
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,转台:[{orderLocInfo.Loc}],煮面栏:[{loc + 1}]"); | |||
mORKS.TakeNoodleInterlock = true; | |||
} | |||
} | |||
@@ -207,6 +207,14 @@ namespace HBLConsole.MORKS | |||
[VariableMonitor("转台上限检测", "M101.5", "1133")] | |||
public bool TurntableUpLimit { get; set; } | |||
/// <summary> | |||
/// 补料完成 | |||
/// PLC -> M101.6 | |||
/// ModbusTcp -> 1134 | |||
/// </summary> | |||
[VariableMonitor("补料完成", "M101.6", "1134")] | |||
public bool FeedComplete { get; set; } | |||
/// <summary> | |||
/// 转台移动到位 | |||
/// PLC -> M101.7 | |||
@@ -241,11 +249,11 @@ namespace HBLConsole.MORKS | |||
public ushort RecipeNumber { get; set; } | |||
/// <summary> | |||
/// 转台位置 | |||
/// 转台设置位置 | |||
/// PLC -> VW2 | |||
/// ModbusTcp -> 101 | |||
/// </summary> | |||
[VariableMonitor("转台位置", "VW2", "101")] | |||
[VariableMonitor("转台设置位置", "VW2", "101")] | |||
public ushort TurntableLoc { get; set; } | |||
/// <summary> | |||
@@ -265,11 +273,11 @@ namespace HBLConsole.MORKS | |||
public ushort TakeNoodleLoc { get; set; } | |||
/// <summary> | |||
/// 转台位置 | |||
/// 转台反馈位置 | |||
/// PLC -> VW372 | |||
/// ModbusTcp -> 286 | |||
/// </summary> | |||
[VariableMonitor("转台位置", "VW372", "286")] | |||
[VariableMonitor("转台反馈位置", "VW372", "286")] | |||
public ushort TurntableFeedbackloc { get; set; } | |||
/// <summary> | |||
@@ -11,7 +11,7 @@ | |||
<!--客户端ID--> | |||
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13--> | |||
<add key="ClientId" value="4"/> | |||
<add key="ClientId" value="11"/> | |||
<add key="COM_Coffee" value="COM8"/> | |||
<add key="BAUD_Coffee" value="115200"/> | |||
@@ -17,6 +17,7 @@ using HBLConsole.Business; | |||
using HBLConsole.AdvertiseWindow; | |||
using System.Windows.Forms; | |||
using System.Drawing; | |||
using HBLConsole.ViewModel; | |||
//问题.net core项目中引用 using System.Windows.Forms; 失败 | |||
//解决方案:在 csproj 文件的 PropertyGroup里面添加 <UseWindowsForms>true</UseWindowsForms> | |||
@@ -36,6 +37,7 @@ namespace HBLConsole | |||
{ | |||
base.OnStartup(e); | |||
//SystemHelper.GetInstance.AutoStart(true); | |||
ViewModelBase.Init(); | |||
SystemHelper.GetInstance.CreateDesktopShortcut(); | |||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | |||
MainConsole.Main.GetInstance.DataInit(); | |||
@@ -43,7 +45,12 @@ namespace HBLConsole | |||
mainView = new MainView(); | |||
mainView.Show(); | |||
SplitScreenDisplay(); | |||
//ActionManage.GetInstance.Register(new Action(() => | |||
//{ | |||
// NoCompleteOrderInit(); | |||
//}), "NoCompleteOrderInit"); | |||
NoCompleteOrderInit(); | |||
MainConsole.Main.GetInstance.BusinessInit(); | |||
} | |||
@@ -31,12 +31,14 @@ namespace HBLConsole.DialogWindow.ViewModel | |||
{ | |||
Json<KeepDataBase>.Data.orderLists.Clear(); | |||
WeakReferenceMessenger.Default.Send("false", "Close"); | |||
Json<KeepDataBase>.Save(); | |||
}); | |||
CancelCommand = new RelayCommand(() => | |||
{ | |||
Json<KeepDataBase>.Data.orderLists.Clear(); | |||
WeakReferenceMessenger.Default.Send("false", "Close"); | |||
Json<KeepDataBase>.Save(); | |||
}); | |||
ConfirmCommand = new RelayCommand(() => | |||
@@ -25,6 +25,11 @@ namespace HBLConsole.ViewModel | |||
{ | |||
public ViewModelBase() | |||
{ | |||
} | |||
public static void Init() | |||
{ | |||
MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | |||
{ | |||
@@ -46,6 +51,7 @@ namespace HBLConsole.ViewModel | |||
}); | |||
} | |||
#region 静态通知属性 | |||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | |||