NXX 1 anno fa
parent
commit
bba7e82a85
15 ha cambiato i file con 537 aggiunte e 52 eliminazioni
  1. +1
    -1
      BPASmartClient.AGV/AGVHelper.cs
  2. +18
    -7
      BPASmartClient.Business/Plugin/OrderProxy.cs
  3. +104
    -17
      BPASmartClient.MorkMW/Control_MorkMW.cs
  4. +42
    -10
      BPASmartClient.MorkMW/GVL_MorkMW.cs
  5. +32
    -0
      BPASmartClient.MorkMW/Model/VaribleModel.cs
  6. +32
    -0
      BPASmartClient.MorkMW/Model/VariblesAttribute.cs
  7. +147
    -0
      BPASmartClient.MorkMW/View/MonitorView.xaml
  8. +28
    -0
      BPASmartClient.MorkMW/View/MonitorView.xaml.cs
  9. +3
    -3
      BPASmartClient.MorkMW/ViewModel/DebugViewModel.cs
  10. +17
    -0
      BPASmartClient.MorkMW/ViewModel/MonitorViewModel.cs
  11. +4
    -4
      BPASmartClient/App.config
  12. +3
    -4
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  13. +12
    -2
      FryPot_DosingSystem/View/DebugView.xaml
  14. +90
    -0
      FryPot_DosingSystem/View/DebugView.xaml.cs
  15. +4
    -4
      FryPot_DosingSystem/View/FlowProcessView.xaml

+ 1
- 1
BPASmartClient.AGV/AGVHelper.cs Vedi File

@@ -85,7 +85,7 @@ namespace BPASmartClient.AGV
string Id = resId.FirstOrDefault(p => p == reqId);
if (Id != null)
goto eq;
resId.Add(Id);
resId.Add(reqId);
if (resId.Count > 15)
{
resId.RemoveRange(0,5);//定期清理请求Id


+ 18
- 7
BPASmartClient.Business/Plugin/OrderProxy.cs Vedi File

@@ -9,6 +9,7 @@ using BPASmartClient.Http;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.Model.调酒机;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
@@ -28,7 +29,9 @@ namespace BPASmartClient.Business
{
//订单队列
private ConcurrentDictionary<int, ConcurrentQueue<MorkOrderPush>> orders = new ConcurrentDictionary<int, ConcurrentQueue<MorkOrderPush>>();
//运行标识
/// <summary>
/// 运行标识
/// </summary>
private bool running = false;
//设备管理
private DeviceMgr deviceMgr;
@@ -73,15 +76,15 @@ namespace BPASmartClient.Business
{
if (!orders.ContainsKey(morkOrderpush.DeviceId))
{
orders.TryAdd(morkOrderpush.DeviceId, new ConcurrentQueue<MorkOrderPush>());
StartTargetDeviceOrderJob(morkOrderpush.DeviceId);
}
if( orders[morkOrderpush.DeviceId].FirstOrDefault(p=>p.SuborderId == morkOrderpush.SuborderId) == null)
if (orders[morkOrderpush.DeviceId].FirstOrDefault(p => p.SuborderId == morkOrderpush.SuborderId) == null)
{
orders[morkOrderpush.DeviceId].Enqueue(morkOrderpush);
}
}
//辅料信息
else if (message is RecipeBoms recipe)
@@ -113,11 +116,19 @@ namespace BPASmartClient.Business
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 28);
new StirFryGoodsEvent() {
DeviceId = device.DeviceId,
stirFrymessage =frybom
stirFrymessage = frybom
}.Publish();
MessageLog.GetInstance.Show("接受到【MQTT】的小炒流程信息");
}
else if (message is MORKMWPushMessage morkMWBom)
{
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 113);
new MorkMWGoodsEvent()
{
DeviceId = device.DeviceId,
morkMWPushMessage = morkMWBom
}.Publish();
MessageLog.GetInstance.Show("接收到【MQTT】获取的调酒机配方信息");
}
});



+ 104
- 17
BPASmartClient.MorkMW/Control_MorkMW.cs Vedi File

@@ -14,8 +14,10 @@ using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http.Json;
using System.Reflection;
using System.Threading;
using System.Windows.Documents;
using static BPASmartClient.EventBus.EventBus;
@@ -24,18 +26,34 @@ namespace BPASmartClient.MorkMW
{
public class Control_MorkMW : BaseDevice
{
int id = 0;
ModbusTcp modbus;
public override DeviceClientType DeviceType => DeviceClientType.MORKMW;
GVL_MorkMW morkMW = new GVL_MorkMW();
public override void DoMain()
{

Json<KeepDataBase>.Read();
VaribleMonitorDis();
ConnectKlpRobot("192.168.0.100", 8001);
ServerInit();
DataParse();
ThreadManage.GetInstance().StartLong(new Action(() => { VariableMonitor();Thread.Sleep(5); }),"机器人变量状态监控线程",true);
}

private void VaribleMonitorDis()
{
PropertyInfo[] pros= morkMW.GetType().GetProperties();
foreach (var item in pros)
{
var res= item.GetCustomAttribute<VariblesAttribute>();
if(res!=null)
{
GVL_MorkMW.varibleInfos.Add(new VaribleModel { Id = id + 1, VaribleName = res.VarName,RobotAddress=res.RobotAddress,ModbusAddress=res.ModbusTcpAddress,Notes=res.Notes });
id++;
}
}
}
private void ServerInit()
{
//配方数据信息
@@ -44,14 +62,18 @@ namespace BPASmartClient.MorkMW
if (@event == null) return;
if (@event is MorkMWGoodsEvent recipe)
{
listMorkMWGoods= recipe.morkMWPushMessage.MorkMWGoods;
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods.Count}】个商品配方数据");
listMorkMWGoods= recipe.morkMWPushMessage?.MorkMWGoods;
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods?.Count}】个商品配方数据");
}
});
}

public override void MainTask()
{
if (Json<KeepDataBase>.Data.IsVerify)
IsHealth = modbus.Connected;
else
IsHealth = true;//心跳上报
ToGetWink();
ToMixWink();
ToPourWink();
@@ -64,12 +86,14 @@ namespace BPASmartClient.MorkMW
{
if (!GVL_MorkMW.AllowLocalSimOrder)
{
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal)
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal&&modbus.Connected)
{
DeviceProcessLogShow("订单开始制作");
morkMW.TaskLock = true;
if (orderLocInfos.TryDequeue(out OrderLocInfo res))
{
morkMW.CurrentSuborderId = res.SuborderId;
OrderChange(res.SuborderId,ORDER_STATUS.COOKING);
foreach (var item in res.mixWink)
{
switch (item.Loc)
@@ -81,7 +105,6 @@ namespace BPASmartClient.MorkMW
case 4: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
case 5: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;
case 6: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break;

}
switch (item.Loc)
{
@@ -105,7 +128,7 @@ namespace BPASmartClient.MorkMW
}
else
{
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal)
if (morkMW.RobotIdle && simOrderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal)
{
DeviceProcessLogShow("订单开始制作");
morkMW.TaskLock = true;
@@ -153,7 +176,7 @@ namespace BPASmartClient.MorkMW
{
// modbus.WriteSingleRegister(0000, 7);//机器人调酒

if (morkMW.AllowMixWink)
if (morkMW.AllowMixWink && modbus.Connected)
{
DeviceProcessLogShow("开始调酒");
modbus.WriteSingleRegister(0000, 7);//机器人调酒
@@ -214,7 +237,7 @@ namespace BPASmartClient.MorkMW
// modbus.WriteSingleRegister(0000, 8);//倒酒

//}
if (morkMW.CupSignal && RTrig.GetInstance("AllowOut").Start(morkMW.MixWinkComplte))
if (morkMW.CupSignal && RTrig.GetInstance("AllowOut").Start(morkMW.MixWinkComplte) && modbus.Connected)
{
DeviceProcessLogShow("开始倒酒");
modbus.WriteSingleRegister(0000, 8);//倒酒
@@ -229,6 +252,7 @@ namespace BPASmartClient.MorkMW
{
if (RTrig.GetInstance("AllComplete").Start(morkMW.ProcessComplete))
{
OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_COOK);
morkMW.PourWinkComplete = true;
DeviceProcessLogShow("订单制作完成,请取走调好酒杯");
}
@@ -236,6 +260,7 @@ namespace BPASmartClient.MorkMW
{
if (TTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
{
OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow("客户取走调好酒杯,请放置空酒杯,以待下次订单制作");
}
if (RTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
@@ -281,6 +306,8 @@ namespace BPASmartClient.MorkMW
morkMW.TakeWinkSixComplete = modbus.ReadCoils(4611);
morkMW.MixWinkComplte = modbus.ReadCoils(4612);
morkMW.ProcessComplete = modbus.ReadCoils(4613);

}
else
{
@@ -288,6 +315,30 @@ namespace BPASmartClient.MorkMW
}
}

public void VariableMonitor()
{
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkOneLoc").CurrentValue = morkMW.ArriveWinkOneLoc;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkTwoLoc").CurrentValue = morkMW.ArriveWinkTwoLoc;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkThreeLoc").CurrentValue = morkMW.ArriveWinkThreeLoc;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFourLoc").CurrentValue = morkMW.ArriveWinkFourLoc;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFiveLoc").CurrentValue = morkMW.ArriveWinkFiveLoc;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkSixLoc").CurrentValue = morkMW.ArriveWinkSixLoc;

GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "RobotIdle").CurrentValue = morkMW.RobotIdle;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "CupSignal").CurrentValue = morkMW.CupSignal;

GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkOneComplete").CurrentValue = morkMW.TakeWinkOneComplete;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkTwoComplete").CurrentValue = morkMW.TakeWinkTwoComplete;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkThreeComplete").CurrentValue = morkMW.TakeWinkThreeComplete;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFourComplete").CurrentValue = morkMW.TakeWinkFourComplete;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFiveComplete").CurrentValue = morkMW.TakeWinkFiveComplete;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkSixComplete").CurrentValue = morkMW.TakeWinkSixComplete;

GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "MixWinkComplte").CurrentValue = morkMW.MixWinkComplte;
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ProcessComplete").CurrentValue = morkMW.ProcessComplete;

}

public override void ResetProgram()
{
morkMW = null;
@@ -347,25 +398,59 @@ namespace BPASmartClient.MorkMW

if (@event != null && @event is DoOrderEvent order)
{
var res= listMorkMWGoods.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);
morkMW.doOrderEvents.Add(order);
if (listMorkMWGoods.Count == 0) return;
if (morkMW.historySuborderId.FirstOrDefault(p => p == order.MorkOrder.SuborderId) != null) return;
OrderCount++;
var res= listMorkMWGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);
if (res != null)
{
string guid = Guid.NewGuid().ToString();
orderLocInfos.Enqueue(new OrderLocInfo { mixWink = res.MorkMWBoms, SuborderId = order.MorkOrder.SuborderId });
DeviceProcessLogShow($"收到小程序订单,订单号【{order.MorkOrder.SuborderId}】");

morkMW.historySuborderId.Add(order.MorkOrder.SuborderId);
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"收到【{OrderCount}】次小程序订单,当前订单【{order.MorkOrder.GoodsName}】,订单号【{order.MorkOrder.SuborderId}】");
}
else
{
DeviceProcessLogShow($"未找到订单对应商品,订单号【{order.MorkOrder.SuborderId}】");
}
}

});
}
/// <summary>
/// 连接卡乐普机器人
/// 订单状态上报
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void ConnectKlpRobot(string ip, int port)
/// <param name="subid"></param>
/// <param name="oRDER_STATUS"></param>
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
try
{
var res = morkMW.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
{
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}
catch (Exception)
{
DeviceProcessLogShow($"订单状态上报失败,订单号【{morkMW.CurrentSuborderId}】");
//throw;
}
}
/// <summary>
/// 连接卡乐普机器人
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
public void ConnectKlpRobot(string ip, int port)
{
modbus = new ModbusTcp();
modbus.Show += new Action<string>((s) =>
@@ -394,6 +479,8 @@ namespace BPASmartClient.MorkMW
/// 调酒机配方集合
/// </summary>
public List<MORKMWGoods> listMorkMWGoods = new List<MORKMWGoods>();

}
}

+ 42
- 10
BPASmartClient.MorkMW/GVL_MorkMW.cs Vedi File

@@ -1,5 +1,9 @@
using System;

using BPASmartClient.Model;
using BPASmartClient.MorkMW.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -9,42 +13,50 @@ namespace BPASmartClient.MorkMW
public class GVL_MorkMW
{
#region 机器人信号

[Varibles("RobotIdle", "初始化位置", "M105", "4201")]
/// <summary>
/// 机器人空闲信号
/// </summary>
public bool RobotIdle { get; set; }
[Varibles("TakeWinkOneComplete", "1号接酒完成", "M510", "4606")]
public bool TakeWinkOneComplete { get; set; }
[Varibles("TakeWinkTwoComplete", "2号接酒完成", "M511", "4607")]
public bool TakeWinkTwoComplete { get; set; }
[Varibles("TakeWinkThreeComplete", "3号接酒完成", "M512", "4608")]
public bool TakeWinkThreeComplete { get; set; }
[Varibles("TakeWinkFourComplete", "4号接酒完成", "M513", "4609")]
public bool TakeWinkFourComplete { get; set; }
[Varibles("TakeWinkFiveComplete", "5号接酒完成", "M514", "4610")]
public bool TakeWinkFiveComplete { get; set; }
[Varibles("TakeWinkSixComplete", "6号接酒完成", "M515", "4611")]
public bool TakeWinkSixComplete { get; set; }



[Varibles("ArriveWinkOneLoc", "到达1号接酒位置", "M520", "4616")]
public bool ArriveWinkOneLoc { get; set; }
[Varibles("ArriveWinkTwoLoc", "到达2号接酒位置", "M521", "4617")]
public bool ArriveWinkTwoLoc { get; set; }
[Varibles("ArriveWinkThreeLoc", "到达3号接酒位置", "M522", "4618")]
public bool ArriveWinkThreeLoc { get; set; }
[Varibles("ArriveWinkFourLoc", "到达4号接酒位置", "M523", "4619")]
public bool ArriveWinkFourLoc { get; set; }
[Varibles("ArriveWinkFiveLoc", "到达5号接酒位置", "M524", "4620")]
public bool ArriveWinkFiveLoc { get; set; }
[Varibles("ArriveWinkSixLoc", "到达6号接酒位置", "M525", "4621")]
public bool ArriveWinkSixLoc { get; set; }
[Varibles("CupSignal", "放杯处传感器信号", "X0", "0")]
/// <summary>
/// 放杯处传感器信号
/// </summary>
public bool CupSignal { get; set; }
[Varibles("MixWinkComplte", "摇酒完成信号", "M516", "4612")]
/// <summary>
/// 摇酒完成信号
/// </summary>
public bool MixWinkComplte { get; set; }
[Varibles("ProcessComplete", "倒酒完成信号", "M517", "4613")]
/// <summary>
/// 机器人倒完酒并回到初始位的完成信号
/// </summary>
@@ -71,7 +83,27 @@ namespace BPASmartClient.MorkMW
/// </summary>
public bool PourWinkComplete { get; set; }
#endregion

/// <summary>
/// 允许本地下单
/// </summary>
public static bool AllowLocalSimOrder { get; set; }

/// <summary>
/// 订单集合
/// </summary>
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();
/// <summary>
/// 历史订单号
/// </summary>
public List<string> historySuborderId = new List<string>();
/// <summary>
/// 当前订单号
/// </summary>
public string CurrentSuborderId { get; set; }

/// <summary>
///
/// </summary>
public static ObservableCollection<VaribleModel> varibleInfos = new ObservableCollection<VaribleModel>();
}
}

+ 32
- 0
BPASmartClient.MorkMW/Model/VaribleModel.cs Vedi File

@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;

namespace BPASmartClient.MorkMW.Model
{
public class VaribleModel:ObservableObject
{
private int _id;
public int Id { get { return _id; }set { _id = value; OnPropertyChanged(); } }

private string _varibleName;
public string VaribleName { get { return _varibleName; } set { _varibleName = value;OnPropertyChanged(); } }

private string _robotAddress;
public string RobotAddress { get { return _robotAddress; } set { _robotAddress = value; OnPropertyChanged(); } }

private string _modbusAddress;
public string ModbusAddress { get { return _modbusAddress; }set { _modbusAddress = value;OnPropertyChanged(); } }

private string _notes;
public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } }

private bool _currentValue;
public bool CurrentValue { get { return _currentValue; } set { _currentValue = value; OnPropertyChanged(); } }
}
}

+ 32
- 0
BPASmartClient.MorkMW/Model/VariblesAttribute.cs Vedi File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkMW.Model
{
public class VariblesAttribute : Attribute
{

public string VarName { get; set; }
public string Notes { get; set; }
public string RobotAddress { get; set; }
public string ModbusTcpAddress { get; set; }
/// <summary>
///
/// </summary>
/// <param name="name">变量名</param>
/// <param name="notes">描述</param>
/// <param name="robotaddress">机器人地址</param>
/// <param name="modbustcpaddress">modbustcp地址</param>
public VariblesAttribute(string name, string notes, string plcaddress, string modbustcpaddress)
{
VarName = name;
Notes = notes;
RobotAddress = plcaddress;
ModbusTcpAddress = modbustcpaddress;
}

}
}

+ 147
- 0
BPASmartClient.MorkMW/View/MonitorView.xaml Vedi File

@@ -0,0 +1,147 @@
<UserControl x:Class="BPASmartClient.MorkMW.View.MonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkMW.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkMW.ViewModel"
mc:Ignorable="d"
Name="变量监控"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:MonitorViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<SolidColorBrush Color="White" x:Key="TitleFontColor"/>
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
</UserControl.Resources>
<Grid Margin="10,0">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />
<GridSplitter Background="White" Width="2" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="变量名" />
<GridSplitter Background="White" Width="2" Grid.Column="1"/>
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="机器人地址" />
<GridSplitter Background="White" Width="2" Grid.Column="2"/>
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="Modbus地址" />
<GridSplitter Background="White" Width="2" Grid.Column="3"/>
<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="注释" />
<GridSplitter Background="White" Width="2" Grid.Column="4"/>
<TextBlock
Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="当前值" />
<GridSplitter Background="White" Width="2" Grid.Column="5"/>
</Grid>
<ItemsControl ItemsSource="{Binding vars}" Grid.Row="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Id}"
Height="30"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
<TextBlock Text="{Binding VaribleName}" Grid.Column="1"
Height="30"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
<TextBlock Text="{Binding RobotAddress}" Grid.Column="2" HorizontalAlignment="Center"
Height="30"
Margin="0,5"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
<TextBlock Text="{Binding ModbusAddress}" Grid.Column="3" HorizontalAlignment="Center"
Height="30"
Margin="0,5"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
<TextBlock Text="{Binding Notes}" Grid.Column="4" HorizontalAlignment="Center"
Height="30"
Margin="0,5"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
<TextBlock Text="{Binding CurrentValue}" Grid.Column="5" HorizontalAlignment="Center"
Height="30"
Margin="0,5"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkMW/View/MonitorView.xaml.cs Vedi File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkMW.View
{
/// <summary>
/// MonitorView.xaml 的交互逻辑
/// </summary>
public partial class MonitorView : UserControl
{
public MonitorView()
{
InitializeComponent();
}
}
}

+ 3
- 3
BPASmartClient.MorkMW/ViewModel/DebugViewModel.cs Vedi File

@@ -33,13 +33,13 @@ namespace BPASmartClient.MorkMW.ViewModel
});

AddMaterial = new RelayCommand(() => {
SimRecipe.recipe.Insert(0, new MixWinkModel());
});

ClearMaterial = new RelayCommand(() => {
if(SimRecipe.recipe.Count>1)
SimRecipe.recipe.RemoveAt(SimRecipe.recipe.Count - 2);
if(SimRecipe.recipe.Count>0)
SimRecipe.recipe.RemoveAt(SimRecipe.recipe.Count - 1);
});

StartLocalSim = new RelayCommand(() => {


+ 17
- 0
BPASmartClient.MorkMW/ViewModel/MonitorViewModel.cs Vedi File

@@ -0,0 +1,17 @@
using BPASmartClient.MorkMW.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkMW.ViewModel
{
internal class MonitorViewModel:ObservableObject
{
public MonitorViewModel() { }
public ObservableCollection<VaribleModel> vars { get; set; } = GVL_MorkMW.varibleInfos;
}
}

+ 4
- 4
BPASmartClient/App.config Vedi File

@@ -7,9 +7,9 @@
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="test1_HostComputer"/>
<add key ="Namespaces" value="DEV.test1.Config"/>
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
@@ -17,9 +17,9 @@
<add key ="Namespaces" value="DEV.Config"/>-->

<!--正式环境-->
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="appid" value="hostcomputer"/>
<add key ="namespaces" value="test1.config"/>-->
<add key ="namespaces" value="test1.config"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 3
- 4
FryPot_DosingSystem/Control/DosingLogicControl.cs Vedi File

@@ -778,7 +778,7 @@ namespace FryPot_DosingSystem.Control
if (objData.equipmentId == 40 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
{
globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置
MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶下料请求");
MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
}
//炒锅2,5到线体4
if ((objData.equipmentId == 6 || objData.equipmentId == 9) && objData.command == "LOAD")
@@ -791,8 +791,7 @@ namespace FryPot_DosingSystem.Control
if (objData.equipmentId == 41 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
{
globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置
MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶下料请求");

MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
}
//炒锅3到线体4
if (objData.equipmentId == 7 && objData.command == "LOAD")
@@ -804,7 +803,7 @@ namespace FryPot_DosingSystem.Control
if (objData.equipmentId == 42 && objData.command == "UNLOAD")//同一任务号且处于下料阶段
{
globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置
MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶下料请求");
MessageNotify.GetInstance.ShowRunLog($"收到编号【{objData.agvCode}】AGV回桶线下料请求");
}
#endregion
#region 线体123到清洗台请求上下料


+ 12
- 2
FryPot_DosingSystem/View/DebugView.xaml Vedi File

@@ -62,10 +62,10 @@
<Button Content="AGV线体1上料就位" Margin="3,3" Width="120" Command="{Binding AGVLOneArrive}"/>

<Button Content="AGV线体1空桶上料就位" Margin="3,3" Width="145" VerticalAlignment="Top" Command="{Binding AgvArriveLineOneEmptyRollerLoc}"/>
<Button Content="线体1信号总复位" Margin="3,3" Width="145" Click="Button_Click_50"/>


<!--<WrapPanel Orientation="Horizontal">
<!--<WrapPanel Orientation="Horizontal">
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/>
</WrapPanel>
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/>-->
@@ -83,6 +83,7 @@
<Button Content="线体2出桶复位" Width="140" Click="Button_Click_16" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV线体2上料就位" Margin="3,3" Width="120" Command="{Binding AGVLTwoArrive}"/>
<Button Content="AGV线体2空桶上料就位" Margin="3,3" Width="145" VerticalAlignment="Top" Command="{Binding AgvArriveLineTwoEmptyRollerLoc}"/>
<Button Content="线体2信号总复位" Margin="3,3" Width="145" Click="Button_Click_51"/>
<!--
<Button Content="AGV线体1上料完成" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLineOneLoadCom}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotDownArrive}">
@@ -124,6 +125,8 @@
<Button Content="线体3出桶复位" Width="140" Click="Button_Click_17" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV线体3上料就位" Margin="3,3" Width="120" Command="{Binding AGVLThreeArrive}"/>
<Button Content="AGV线体3空桶上料就位" Margin="3,3" Width="145" VerticalAlignment="Top" Command="{Binding AgvArriveLineThreeEmptyRollerLoc}"/>

<Button Content="线体3信号总复位" Margin="3,3" Width="145" Click="Button_Click_52"/>
<!--<WrapPanel Orientation="Horizontal">
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/>
</WrapPanel>-->
@@ -163,6 +166,7 @@
<Button Content="炒锅1配方复位" Width="140" Click="Button_Click_45" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV炒锅1下料就位" RenderTransformOrigin="0.5,0.5" Margin="3,3" Width="145" Command="{Binding AGVFryPotDownArrive}"/>
<Button Content="AGV炒锅1空桶上料就位" Margin="3,3" Width="145" Command="{Binding AGVFryPotUpArrive}"/>
<Button Content="炒锅1信号总复位" Margin="3,3" Width="145" Click="Button_Click_53"/>
<!--<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineThreeRunning}"></Button>
-->
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
@@ -189,6 +193,7 @@
<Button Content="炒锅2配方复位" Width="140" Click="Button_Click_46" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV炒锅2下料就位" Margin="3,3" RenderTransformOrigin="0.5,0.5" Width="145" Command="{Binding AGVFryPotTwoDownArrive}"/>
<Button Content="AGV炒锅2空桶上料就位" Margin="3,3" Width="145" Command="{Binding AGVFryPotTwoUpArrive}"/>
<Button Content="炒锅2信号总复位" Margin="3,3" Width="145" Click="Button_Click_54"/>
<!--<Button Content="AGV线体3上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLThreeArrive}"/>
<Button Content="AGV线体3上料完成" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLineThreeLoadCom}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotThreeDownArrive}">
@@ -219,6 +224,8 @@
<Button Content="炒锅3配方复位" Width="140" Click="Button_Click_47" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV炒锅3下料就位" RenderTransformOrigin="0.5,0.5" Margin="3,3" Width="145" Command="{Binding AGVFryPotThreeDownArrive}"/>
<Button Content="AGV炒锅3空桶上料就位" Margin="3,3" Width="145" Command="{Binding AGVFryPotThreeUpArrive}"/>

<Button Content="炒锅3信号总复位" Margin="3,3" Width="145" Click="Button_Click_55"/>
<!--<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineThreeRunning}"></Button>
-->
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
@@ -245,6 +252,7 @@
<Button Content="炒锅4配方复位" Width="140" Click="Button_Click_48" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV炒锅4下料就位" RenderTransformOrigin="0.5,0.5" Margin="3,3" Width="145" Command="{Binding AGVFryPotDownArrive}"/>
<Button Content="AGV炒锅4空桶上料就位" Margin="3,3" Width="145" Command="{Binding AGVFryPotUpArrive}"/>
<Button Content="炒锅4信号总复位" Margin="3,3" Width="145" Click="Button_Click_56"/>
<!--<Button Content="AGV线体3上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLThreeArrive}"/>
<Button Content="AGV线体3上料完成" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLineThreeLoadCom}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotThreeDownArrive}">
@@ -276,6 +284,8 @@
<Button Content="炒锅5配方复位" Width="140" Click="Button_Click_49" Margin="3,3" VerticalAlignment="Top" />
<Button Content="AGV炒锅5下料就位" Margin="3,3" RenderTransformOrigin="0.5,0.5" Width="145" Command="{Binding AGVFryPotTwoDownArrive}"/>
<Button Content="AGV炒锅5空桶上料就位" Margin="3,3" Width="145" Command="{Binding AGVFryPotTwoUpArrive}"/>

<Button Content="炒锅5信号总复位" Margin="3,3" Width="145" Click="Button_Click_57"/>
<!--<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineThreeRunning}"></Button>
-->
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->


+ 90
- 0
FryPot_DosingSystem/View/DebugView.xaml.cs Vedi File

@@ -467,5 +467,95 @@ namespace FryPot_DosingSystem.View
DeviceOperate.GetInstance.WritePotFivePlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotFivePlcData("D2999", 0); }));
}
/// <summary>
/// 线体1总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_50(object sender, RoutedEventArgs e)
{
ActionManage.GetInstance.Send("LineOneTaskExit");
DeviceOperate.GetInstance.WritePlcData("D1052", 0);
}
/// <summary>
/// 线体2总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_51(object sender, RoutedEventArgs e)
{
ActionManage.GetInstance.Send("LineTwoTaskExit");
DeviceOperate.GetInstance.WritePlcData("D1053", 0);
}
/// <summary>
/// 线体3总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_52(object sender, RoutedEventArgs e)
{
ActionManage.GetInstance.Send("LineThreeTaskExit");
DeviceOperate.GetInstance.WritePlcData("D1054", 0);
}
/// <summary>
/// 炒锅1信号总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_53(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1055", 0);
DeviceOperate.GetInstance.WritePlcData("D1060", 0);
DeviceOperate.GetInstance.WritePotOnePlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotOnePlcData("D2999", 0); }));
}
/// <summary>
/// 炒锅2信号总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_54(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1056", 0);
DeviceOperate.GetInstance.WritePlcData("D1061", 0);
DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
}
/// <summary>
/// 炒锅3信号总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_55(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1057", 0);
DeviceOperate.GetInstance.WritePlcData("D1062", 0);
DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
}
/// <summary>
/// 炒锅4信号总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_56(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1058", 0);
DeviceOperate.GetInstance.WritePlcData("D1063", 0);
DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
}
/// <summary>
/// 炒锅5信号总复位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click_57(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1059", 0);
DeviceOperate.GetInstance.WritePlcData("D1064", 0);
DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 1);
Task.Run(new Action(() => { Thread.Sleep(2000); DeviceOperate.GetInstance.WritePotTwoPlcData("D2999", 0); }));
}
}
}

+ 4
- 4
FryPot_DosingSystem/View/FlowProcessView.xaml Vedi File

@@ -437,13 +437,13 @@
<GridSplitter Grid.Column="5" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="6" Text="时间(M)" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="6" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="7" Text="火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="7" Text="一圈火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="7" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="8" Text="火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="8" Text="二圈火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="8" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="9" Text="火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="9" Text="三圈火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="9" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="10" Text="火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="10" Text="四圈火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
</Grid>
<StackPanel Grid.Row="3" VerticalAlignment="Center" Orientation="Horizontal" Margin="0,0,0,5">
<TextBlock Text="目标重量偏差设置:" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/>


Caricamento…
Annulla
Salva