Bläddra i källkod

三代机调试

master
pry 2 år sedan
förälder
incheckning
96442a2c2b
9 ändrade filer med 52 tillägg och 47 borttagningar
  1. +2
    -23
      HBLConsole.Business/AbstractServer/Base.cs
  2. +15
    -5
      HBLConsole.Factory/SimpleFactory.cs
  3. +6
    -0
      HBLConsole.GVL/GeneralConfig.cs
  4. +1
    -1
      HBLConsole.MORKS/Alarm.cs
  5. +20
    -17
      HBLConsole.MORKS/Control_MORKS.cs
  6. +1
    -0
      HBLConsole.MainConsole/Main.cs
  7. +2
    -1
      HBLConsole/DialogWindow/ViewModel/ListDialogViewModel.cs
  8. +4
    -0
      HBLConsole/View/OrderStatusView.xaml
  9. +1
    -0
      HBLConsole/ViewModel/ViewModelBase.cs

+ 2
- 23
HBLConsole.Business/AbstractServer/Base.cs Visa fil

@@ -22,33 +22,12 @@ namespace HBLConsole.Business.AbstractServer
if (orderInfo == null) return;
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);
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("DataParse", morkOrderpush);
GeneralConfig.morkOrderPushes.Enqueue(morkOrderpush);
//ActionManage.GetInstance.Send("DataParse", morkOrderpush);
}
}
}


+ 15
- 5
HBLConsole.Factory/SimpleFactory.cs Visa fil

@@ -7,6 +7,7 @@ using HBLConsole.GVL;
using BPA.Message;
using HBLConsole.Service;
using HBLConsole.Communication;
using System.Threading;

namespace HBLConsole.Factory
{
@@ -107,19 +108,28 @@ namespace HBLConsole.Factory
string NameSpace = $"HBLConsole.{DeviceType}";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Control_{DeviceType}");
control = Activator.CreateInstance(type) as IControl;
//control = (IControl)type?.GetProperty("Instance").GetValue(null);
//IControl business = (IControl)type?.GetProperty("GetInstance").GetValue(null);
GetBatchingInfo();
GetInterfaceData();
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<object>((o) => { control?.SimOrder(o); }), "SimOrder");
ActionManage.GetInstance.Register(new Action<object>((o) => { control?.IotBroadcast(o); }), "IotBroadcast");
ConnectHelper.GetInstance.Init();
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
- 0
HBLConsole.GVL/GeneralConfig.cs Visa fil

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using BPA.Message;
using BPA.Message.Enum;
using BPA.Models;
using System.Collections.Concurrent;

namespace HBLConsole.GVL
{
@@ -26,5 +27,10 @@ namespace HBLConsole.GVL
/// </summary>
public static bool Healthy { get; set; }

/// <summary>
/// 订单队列集合
/// </summary>
public static ConcurrentQueue<MorkOrderPush> morkOrderPushes { get; set; } = new ConcurrentQueue<MorkOrderPush>();

}
}

+ 1
- 1
HBLConsole.MORKS/Alarm.cs Visa fil

@@ -77,7 +77,7 @@ namespace HBLConsole.MORKS
public bool NoodleMacCommunicateError { get; set; }

/// <summary>
/// 煮面机通讯异常
/// 配料机通讯异常
/// PLC ---> M551.0
/// ModbusTcp --> 1580
/// </summary>


+ 20
- 17
HBLConsole.MORKS/Control_MORKS.cs Visa fil

@@ -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);
if (ResLoc != null)
@@ -364,27 +383,11 @@ namespace HBLConsole.MORKS
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
if (res != null)
{
TurntableStart(mORKS.TurntableFeedbackloc);
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
{


+ 1
- 0
HBLConsole.MainConsole/Main.cs Visa fil

@@ -74,6 +74,7 @@ namespace HBLConsole.MainConsole
{
ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload));
});

});

//MQTT 重连成功


+ 2
- 1
HBLConsole/DialogWindow/ViewModel/ListDialogViewModel.cs Visa fil

@@ -51,7 +51,8 @@ namespace HBLConsole.DialogWindow.ViewModel
{
item.OrderStatus = ORDER_STATUS.WAIT;
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");


+ 4
- 0
HBLConsole/View/OrderStatusView.xaml Visa fil

@@ -146,6 +146,8 @@

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />
@@ -301,6 +303,8 @@

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />


+ 1
- 0
HBLConsole/ViewModel/ViewModelBase.cs Visa fil

@@ -129,6 +129,7 @@ namespace HBLConsole.ViewModel
private void Test()
{
#if test
GeneralConfig.Healthy = true;
ThreadManage.GetInstance.StartLong(new Action(() =>
{
while (morkOrderPushes.Count > 0)


Laddar…
Avbryt
Spara