@@ -22,33 +22,12 @@ namespace HBLConsole.Business.AbstractServer | |||||
if (orderInfo == null) return; | if (orderInfo == null) return; | ||||
if (orderInfo is MorkOrderPush morkOrderpush) | if (orderInfo is MorkOrderPush morkOrderpush) | ||||
{ | { | ||||
//OrderData order = Json<MorkOrderPushPar>.Data.morkOrderPushes.Find(par => par.OrderPush?.SuborderId == morkOrderpush.SuborderId); | |||||
//if (order == null)//防止重复订单 | |||||
//{ | |||||
// Json<MorkOrderPushPar>.Data.morkOrderPushes.Add(new OrderData() | |||||
// { | |||||
// OrderStatus = ORDER_STATUS.WAIT, | |||||
// IsSelected = true, | |||||
// OrderPush = morkOrderpush | |||||
// }); | |||||
// ActionManage.GetInstance.Send("AddOrder", morkOrderpush); | |||||
// ActionManage.GetInstance.Send("DataParse", morkOrderpush); | |||||
//} | |||||
OrderData order = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(par => par.OrderPush?.SuborderId == morkOrderpush.SuborderId); | OrderData order = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(par => par.OrderPush?.SuborderId == morkOrderpush.SuborderId); | ||||
if (order == null)//防止重复订单 | if (order == null)//防止重复订单 | ||||
{ | { | ||||
//Json<KeepDataBase>.Data.orderLists.Add(new OrderData() | |||||
//{ | |||||
// OrderStatus = ORDER_STATUS.WAIT, | |||||
// IsSelected = true, | |||||
// OrderPush = morkOrderpush, | |||||
// StartDate = DateTime.Now.ToString("HH:mm:ss"), | |||||
//}); | |||||
ActionManage.GetInstance.Send("AddOrder", morkOrderpush); | ActionManage.GetInstance.Send("AddOrder", morkOrderpush); | ||||
ActionManage.GetInstance.Send("DataParse", morkOrderpush); | |||||
GeneralConfig.morkOrderPushes.Enqueue(morkOrderpush); | |||||
//ActionManage.GetInstance.Send("DataParse", morkOrderpush); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -7,6 +7,7 @@ using HBLConsole.GVL; | |||||
using BPA.Message; | using BPA.Message; | ||||
using HBLConsole.Service; | using HBLConsole.Service; | ||||
using HBLConsole.Communication; | using HBLConsole.Communication; | ||||
using System.Threading; | |||||
namespace HBLConsole.Factory | namespace HBLConsole.Factory | ||||
{ | { | ||||
@@ -107,19 +108,28 @@ namespace HBLConsole.Factory | |||||
string NameSpace = $"HBLConsole.{DeviceType}";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类 | string NameSpace = $"HBLConsole.{DeviceType}";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类 | ||||
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Control_{DeviceType}"); | Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Control_{DeviceType}"); | ||||
control = Activator.CreateInstance(type) as IControl; | control = Activator.CreateInstance(type) as IControl; | ||||
//control = (IControl)type?.GetProperty("Instance").GetValue(null); | |||||
//IControl business = (IControl)type?.GetProperty("GetInstance").GetValue(null); | |||||
GetBatchingInfo(); | GetBatchingInfo(); | ||||
GetInterfaceData(); | GetInterfaceData(); | ||||
control?.Init(); | control?.Init(); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => { control?.DataParse(o); }), "DataParse"); | |||||
//ActionManage.GetInstance.Register(new Action<object>((o) => { control?.DataParse(o); }), "DataParse"); | |||||
ActionManage.GetInstance.Register(new Action(() => { control?.ConnectOk(); }), $"{GeneralConfig.DeviceType.ToString()}/ConnectOk"); | ActionManage.GetInstance.Register(new Action(() => { control?.ConnectOk(); }), $"{GeneralConfig.DeviceType.ToString()}/ConnectOk"); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => { control?.SimOrder(o); }), "SimOrder"); | ActionManage.GetInstance.Register(new Action<object>((o) => { control?.SimOrder(o); }), "SimOrder"); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => { control?.IotBroadcast(o); }), "IotBroadcast"); | ActionManage.GetInstance.Register(new Action<object>((o) => { control?.IotBroadcast(o); }), "IotBroadcast"); | ||||
ConnectHelper.GetInstance.Init(); | ConnectHelper.GetInstance.Init(); | ||||
ActionManage.GetInstance.Send("监控数据初始化"); | ActionManage.GetInstance.Send("监控数据初始化"); | ||||
//ActionManage.GetInstance.Send("NoCompleteOrderInit"); | |||||
//GetControlBase(); | |||||
ThreadManage.GetInstance.StartLong(new Action(() => | |||||
{ | |||||
while (GeneralConfig.morkOrderPushes.Count > 0) | |||||
{ | |||||
if (GeneralConfig.morkOrderPushes.TryDequeue(out MorkOrderPush s)) | |||||
{ | |||||
control?.DataParse(s); | |||||
} | |||||
} | |||||
Thread.Sleep(1000); | |||||
}), "订单解析线程"); | |||||
} | } | ||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks; | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPA.Message.Enum; | using BPA.Message.Enum; | ||||
using BPA.Models; | using BPA.Models; | ||||
using System.Collections.Concurrent; | |||||
namespace HBLConsole.GVL | namespace HBLConsole.GVL | ||||
{ | { | ||||
@@ -26,5 +27,10 @@ namespace HBLConsole.GVL | |||||
/// </summary> | /// </summary> | ||||
public static bool Healthy { get; set; } | public static bool Healthy { get; set; } | ||||
/// <summary> | |||||
/// 订单队列集合 | |||||
/// </summary> | |||||
public static ConcurrentQueue<MorkOrderPush> morkOrderPushes { get; set; } = new ConcurrentQueue<MorkOrderPush>(); | |||||
} | } | ||||
} | } |
@@ -77,7 +77,7 @@ namespace HBLConsole.MORKS | |||||
public bool NoodleMacCommunicateError { get; set; } | public bool NoodleMacCommunicateError { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 煮面机通讯异常 | |||||
/// 配料机通讯异常 | |||||
/// PLC ---> M551.0 | /// PLC ---> M551.0 | ||||
/// ModbusTcp --> 1580 | /// ModbusTcp --> 1580 | ||||
/// </summary> | /// </summary> | ||||
@@ -137,6 +137,25 @@ namespace HBLConsole.MORKS | |||||
} | } | ||||
})); | })); | ||||
//ModbusTcpHelper.GetInstance.Readbool(1570, 20, new Action<bool[]>((bools) => | |||||
//{ | |||||
// alarm.MachineLeftLowTemperature = bools[0]; | |||||
// alarm.MachineRightLowTemperature = bools[1]; | |||||
// alarm.Supply1_LossBowl = bools[2]; | |||||
// alarm.Supply2_LossBowl = bools[3]; | |||||
// alarm.Supply1_ErrorOutBowl = bools[4]; | |||||
// alarm.Supply2_ErrorOutBowl = bools[5]; | |||||
// alarm.PushBowlCylinderError = bools[6]; | |||||
// alarm.NoodleMacCommunicateError = bools[7]; | |||||
// alarm.DosingMacCommunicateError = bools[8]; | |||||
// alarm.RobotMacCommunicateError = bools[9]; | |||||
// alarm.RobotInitError = bools[11]; | |||||
// alarm.RobotUrgentStop = bools[12]; | |||||
// alarm.RobotNotInRemoteMode = bools[13]; | |||||
// alarm.RobotNotInReady = bools[14]; | |||||
// alarm.RobotSelfInException = bools[15]; | |||||
//})); | |||||
var ResLoc = ModbusTcpHelper.GetInstance.Read(286, ReadType.HoldingRegisters); | var ResLoc = ModbusTcpHelper.GetInstance.Read(286, ReadType.HoldingRegisters); | ||||
if (ResLoc != null) | if (ResLoc != null) | ||||
@@ -364,27 +383,11 @@ namespace HBLConsole.MORKS | |||||
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString()); | var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString()); | ||||
if (res != null) | if (res != null) | ||||
{ | { | ||||
TurntableStart(mORKS.TurntableFeedbackloc); | |||||
mORKS.TurntableLocLists.Clear(); | mORKS.TurntableLocLists.Clear(); | ||||
mORKS.AllowTakeNoodle = true; | mORKS.AllowTakeNoodle = true; | ||||
ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, mORKS.TurntableFeedbackloc); | |||||
MessageLog.GetInstance.Show("转台位置OK,执行机器人取面"); | 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 | else | ||||
{ | { | ||||
@@ -74,6 +74,7 @@ namespace HBLConsole.MainConsole | |||||
{ | { | ||||
ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload)); | ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload)); | ||||
}); | }); | ||||
}); | }); | ||||
//MQTT 重连成功 | //MQTT 重连成功 | ||||
@@ -51,7 +51,8 @@ namespace HBLConsole.DialogWindow.ViewModel | |||||
{ | { | ||||
item.OrderStatus = ORDER_STATUS.WAIT; | item.OrderStatus = ORDER_STATUS.WAIT; | ||||
Json<KeepDataBase>.Data.orderLists.Add(item); | Json<KeepDataBase>.Data.orderLists.Add(item); | ||||
ActionManage.GetInstance.Send("DataParse", item.OrderPush); | |||||
GVL.GeneralConfig.morkOrderPushes.Enqueue(item.OrderPush); | |||||
//ActionManage.GetInstance.Send("DataParse", item.OrderPush); | |||||
} | } | ||||
} | } | ||||
WeakReferenceMessenger.Default.Send("true", "Close"); | WeakReferenceMessenger.Default.Send("true", "Close"); | ||||
@@ -146,6 +146,8 @@ | |||||
<Grid Grid.Column="1"> | <Grid Grid.Column="1"> | ||||
<TextBlock | <TextBlock | ||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="{Binding OrderPush.GoodsName}" /> | Text="{Binding OrderPush.GoodsName}" /> | ||||
@@ -301,6 +303,8 @@ | |||||
<Grid Grid.Column="1"> | <Grid Grid.Column="1"> | ||||
<TextBlock | <TextBlock | ||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" | ||||
Style="{StaticResource TextBlockStyle}" | Style="{StaticResource TextBlockStyle}" | ||||
Text="{Binding OrderPush.GoodsName}" /> | Text="{Binding OrderPush.GoodsName}" /> | ||||
@@ -129,6 +129,7 @@ namespace HBLConsole.ViewModel | |||||
private void Test() | private void Test() | ||||
{ | { | ||||
#if test | #if test | ||||
GeneralConfig.Healthy = true; | |||||
ThreadManage.GetInstance.StartLong(new Action(() => | ThreadManage.GetInstance.StartLong(new Action(() => | ||||
{ | { | ||||
while (morkOrderPushes.Count > 0) | while (morkOrderPushes.Count > 0) | ||||