taoye 2 лет назад
Родитель
Сommit
675180b29b
22 измененных файлов: 994 добавлений и 390 удалений
  1. +4
    -0
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  2. +54
    -36
      BPASmartClient.MorkF/Control_MorkF.cs
  3. +6
    -2
      BPASmartClient.MorkF/GVL_MorkF.cs
  4. +45
    -0
      BPASmartClient.MorkF/View/DebugView.xaml
  5. +30
    -0
      BPASmartClient.MorkF/View/DebugView.xaml.cs
  6. +55
    -0
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  7. +2
    -7
      BPASmartClient.MorkM/BPASmartClient.MorkM.csproj
  8. +112
    -278
      BPASmartClient.MorkM/Control_MORKM.cs
  9. +16
    -0
      BPASmartClient.MorkM/Model/GeneralConfig.cs
  10. +0
    -32
      BPASmartClient.MorkM/View/Debug.xaml
  11. +154
    -0
      BPASmartClient.MorkM/View/DebugView.xaml
  12. +6
    -4
      BPASmartClient.MorkM/View/DebugView.xaml.cs
  13. +206
    -0
      BPASmartClient.MorkM/View/SimOrderConfitView.xaml
  14. +56
    -0
      BPASmartClient.MorkM/View/SimOrderConfitView.xaml.cs
  15. +121
    -7
      BPASmartClient.MorkM/ViewModel/DebugViewModel.cs
  16. +7
    -8
      BPASmartClient.MorkM/ViewModel/MonitorViewModel.cs
  17. +6
    -7
      BPASmartClient.MorkM/ViewModel/ParSetViewModel.cs
  18. +90
    -0
      BPASmartClient.MorkM/ViewModel/SimOrderConfitViewModel.cs
  19. +4
    -4
      BPASmartClient/App.config
  20. +1
    -0
      BPASmartClient/BPASmartClient.csproj
  21. +16
    -4
      BPASmartClient/DeviceInfo.xml
  22. +3
    -1
      BPASmartClient/MainWindow.xaml.cs

+ 4
- 0
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj Просмотреть файл

@@ -18,4 +18,8 @@
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>

</Project>

+ 54
- 36
BPASmartClient.MorkF/Control_MorkF.cs Просмотреть файл

@@ -30,7 +30,7 @@ namespace BPASmartClient.MorkF
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
MessageLog.GetInstance.Show("MORKF 设备初始化完成");
DeviceProcessLogShow("MORKF 设备初始化完成");
}
#region 调试代码
public void CommandRegist()
@@ -324,7 +324,7 @@ namespace BPASmartClient.MorkF
// //配方数据地址范围:VW2000 - VW2278
// WriteData("VW2000", recipeBoms.ToArray());
//}
//else { MessageLog.GetInstance.Show("配方数据为空"); }
//else {DeviceProcessLogShow("配方数据为空"); }
}

/// <summary>
@@ -339,7 +339,7 @@ namespace BPASmartClient.MorkF
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
MessageLog.GetInstance.Show($"接收到{OrderCount}次订单");
DeviceProcessLogShow($"接收到{OrderCount}次订单");
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
@@ -347,7 +347,7 @@ namespace BPASmartClient.MorkF
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
//if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
//将一个商品的ABC料位置存入队列
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, MaterialLoc = ushort.Parse(res.BatchingLoc) });
@@ -405,7 +405,7 @@ namespace BPASmartClient.MorkF
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)
{
MessageLog.GetInstance.Show($"执行流程{res.Time}");
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
{
@@ -524,7 +524,7 @@ namespace BPASmartClient.MorkF
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)//遍历所有流程
{
MessageLog.GetInstance.Show($"执行流程{res.Time}");
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
{
@@ -635,7 +635,7 @@ namespace BPASmartClient.MorkF
{


//出餐完成,相应变量复位
//主流程出餐完成,相应变量复位
if (morkF.MainOutMealComplete)
{
morkF.TakePlateLock = false;
@@ -643,7 +643,7 @@ namespace BPASmartClient.MorkF
morkF.MainProcessExcuteLock = false;
morkF.MainOrderMaterialCom = false;
}
//辅流程出餐完成,相应变量复位
if (morkF.MinorOutMealComplete)
{
morkF.TakePlateLock = false;
@@ -669,11 +669,11 @@ namespace BPASmartClient.MorkF
// if (ushort.TryParse(result[0].BatchingLoc, out ushort loc))
// {
// TurnMaterialStore(loc);
// MessageLog.GetInstance.Show($"转台转到【{loc}】位置");
// DeviceProcessLogShow($"转台转到【{loc}】位置");
// morkF.TurnTableLock = true; //取料完成后置false
// }
// }
// else MessageLog.GetInstance.Show("未找到可用的物料信息");
// elseDeviceProcessLogShow("未找到可用的物料信息");
//}

//调试代码
@@ -684,12 +684,15 @@ namespace BPASmartClient.MorkF
{

TurnMaterialStore(resultorder[0]);
MessageLog.GetInstance.Show($"转台转到【{resultorder[0]}】位置");
DeviceProcessLogShow($"转台转到【{resultorder[0]}】位置");
resultorder.RemoveAt(0);
morkF.TurnTableLock = true; //取料完成后置false

}
else MessageLog.GetInstance.Show("未找到可用的物料信息");
else
{
DeviceProcessLogShow("未找到可用的物料信息");
}
}

}
@@ -707,12 +710,15 @@ namespace BPASmartClient.MorkF
if (morkF.TakePlateQueue.TryDequeue(out OrderLocInfo order))
{
StartTakePlate();
morkF.CurrentOrderId = order.SuborderId;
if (morkF.MainProcessStatus)
morkF.MainCurrentOrderId = order.SuborderId;
if (morkF.MinorProessStatus)
morkF.MinorCurrentOrderId = order.SuborderId;
morkF.TakePlateLock = true; //订单完成后置false
morkF.MainOutMealComplete = false;
morkF.MinorOutMealComplete = false;
// OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING);
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取碗控制");
DeviceProcessLogShow($"订单【{order.SuborderId}】执行取碗控制");
}
}
}
@@ -727,7 +733,7 @@ namespace BPASmartClient.MorkF
//{
// Task.Delay(5).Wait();
//}
while (!(!morkF.CleanModule||!morkF.SecondCleanModule)&&(!morkF.KitchenOneStatus||!morkF.KitchenSecondStatus)&&(morkF.CleanComplete|| morkF.SecondCleanComplete))//等待取锅条件满足
while (!(!morkF.CleanModule || !morkF.SecondCleanModule) && (!morkF.KitchenOneStatus || !morkF.KitchenSecondStatus) && (morkF.CleanComplete || morkF.SecondCleanComplete))//等待取锅条件满足
{
Task.Delay(5).Wait();
}
@@ -738,7 +744,11 @@ namespace BPASmartClient.MorkF
TakePotToKitchen();
WriteData("M1.5", false);//清洗模组1完成复位
WriteData("M2.0", false);//清洗模组2完成复位
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取锅到灶台控制");
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");

while (!morkF.PutPotToKitchenComlete)
{
Task.Delay(5).Wait();
@@ -783,7 +793,7 @@ namespace BPASmartClient.MorkF
TakeBurden(loc);
TurnReset(loc);//转台复位

MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
}
//等待取料完成
while (!morkF.TakeMaterialComplete)
@@ -810,7 +820,7 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
TakeBurden(loc);
TurnReset(loc);//转台复位
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行取B料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取B料");
}
//等待取料完成
while (!morkF.TakeMaterialComplete)
@@ -841,9 +851,9 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
TakeBurden(loc);
TurnReset(loc);//转台复位
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行取C料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料");
}
MessageLog.GetInstance.ShowEx($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
//等待取料完成
while (!morkF.TakeMaterialComplete)
{
@@ -873,14 +883,17 @@ namespace BPASmartClient.MorkF
{
Task.Delay(5).Wait();
}
if (morkF.TakePlateQueue.Count == 0)
{
WriteData("M0.7", false);//无订单关闭抽风机
}
RobotOutMeal();
WriteData("M1.2", false);//供盘复位
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】正在出餐");
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");

}

@@ -893,7 +906,10 @@ namespace BPASmartClient.MorkF
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】出餐完成");
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
WriteData("M14.2", false);//机器人出餐完成复位
//OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK);
CleanModuleControl("Start");
@@ -946,7 +962,7 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
}
WriteData("M8.3", false);//下降完成复位
MessageLog.GetInstance.Show($"翻转机下降完成");
DeviceProcessLogShow($"翻转机下降完成");
//if (morkF.MaterialCount == 3 && morkF.MainProcessStatus)
//{
// morkF.MainProcessWait = true;
@@ -991,9 +1007,9 @@ namespace BPASmartClient.MorkF

}
morkF.MainOrderMaterialCom = true;
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】,配料倒料完成");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成");
}
else //主流程准备阻塞
else //程准备阻塞
{
morkF.MainProcessWait = true;
}
@@ -1017,15 +1033,15 @@ namespace BPASmartClient.MorkF

}
morkF.MinorOrderMaterialCom = true;
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】,配料倒料完成");
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成");
}
else //流程准备阻塞
else //流程准备阻塞
{
morkF.MinorProcessWait = true;
}
}

MessageLog.GetInstance.Show("翻转机上升完成");
DeviceProcessLogShow("翻转机上升完成");

}
private void GetStatus(string key, Action<bool[]> action)
@@ -1088,8 +1104,10 @@ namespace BPASmartClient.MorkF
break;

}
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】,加热档位调至{number}挡");

if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
}
public void TurnMaterialStore(int loc)
{
@@ -1151,12 +1169,12 @@ namespace BPASmartClient.MorkF

WriteData("M2.7", true);//加油
WriteData("M0.7", true);//打开抽风机
MessageLog.GetInstance.Show("开始注油");
DeviceProcessLogShow("开始注油");
while (!morkF.FallOilComplete)
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show("注油完成");
DeviceProcessLogShow("注油完成");

}
/// <summary>
@@ -1171,7 +1189,7 @@ namespace BPASmartClient.MorkF
// case "Middle": WriteData("", 1); break;
case "Down": WriteData("M8.2", true); break;
}
MessageLog.GetInstance.Show($"翻转机执行{orientation}操作");
DeviceProcessLogShow($"翻转机执行{orientation}操作");
}
/// <summary>
/// 翻转机档位控制
@@ -1189,7 +1207,7 @@ namespace BPASmartClient.MorkF
case 2: WriteData("M7.2", true); break;//翻炒机2挡
case 3: WriteData("M7.3", true); break;//翻炒机3挡
}
MessageLog.GetInstance.Show($"翻转机档位调至{gear}挡");
DeviceProcessLogShow($"翻转机档位调至{gear}挡");
}
/// <summary>
/// 取A,B,C料
@@ -1211,7 +1229,7 @@ namespace BPASmartClient.MorkF
{
WriteData("M1.4", false);
}
MessageLog.GetInstance.Show($"清洗模组执行【{status}】操作");
DeviceProcessLogShow($"清洗模组执行【{status}】操作");
}

public override void Stop()


+ 6
- 2
BPASmartClient.MorkF/GVL_MorkF.cs Просмотреть файл

@@ -91,9 +91,13 @@ namespace BPASmartClient.MorkF
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakePlateQueue = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 存放当前订单唯一ID
/// 存放主流程当前订单唯一ID
/// </summary>
public string CurrentOrderId { get; set; }
public string MainCurrentOrderId { get; set; }
/// <summary>
/// 存放辅流程当前订单唯一ID
/// </summary>
public string MinorCurrentOrderId { get; set; }
/// <summary>
/// PLC上升沿初始化触发信号
/// </summary>


+ 45
- 0
BPASmartClient.MorkF/View/DebugView.xaml Просмотреть файл

@@ -0,0 +1,45 @@
<UserControl x:Class="BPASmartClient.MorkF.View.DebugView"
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.MorkF.View"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal" Grid.Row="0">
<Button Content="初始化" Command="{Binding PlcInite}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="模拟订单" Command="{Binding SimulateOrder}" Margin="10,0,10,0"></Button>
<Button Content="手撕包菜" Command="{Binding ShreddCabbage}" Margin="10,0,10,0"></Button>
<Button Content="盐煎肉" Command="{Binding FryPork}" Margin="10,0,10,0"></Button>
<Button Content="酱烧杏鲍菇" Command="{Binding XingBaoGu}" Margin="10,0,10,0"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<Button Content="取锅" Command="{Binding TakePot}" Margin="10,0,10,0"></Button>
<Button Content="取锅复位" Command="{Binding TakePotReset}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding TempTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="加热1挡" Command="{Binding OneBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热2挡" Command="{Binding TwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热3挡" Command="{Binding ThreeBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机关闭" Command="{Binding OverTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机上升" Command="{Binding OverGoOn}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机下降" Command="{Binding OverGoDown}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机1挡" Command="{Binding OverOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机2挡" Command="{Binding OverTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机3挡" Command="{Binding OverThreeBlock}" Margin="10,0,10,0"></Button>
</StackPanel>
</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MorkF/View/DebugView.xaml.cs Просмотреть файл

@@ -0,0 +1,30 @@
using BPASmartClient.MorkF.ViewModel;
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.MorkF.View
{
/// <summary>
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
public DebugView()
{
InitializeComponent();
this.DataContext = new DebugViewModel();
}
}
}

+ 55
- 0
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs Просмотреть файл

@@ -0,0 +1,55 @@
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkF.ViewModel
{
internal class DebugViewModel : ObservableObject
{

public RelayCommand PlcInite { get; set; }
public RelayCommand SimulateOrder { get; set; }
public RelayCommand TakePot { get; set; }
public RelayCommand TakePotReset { get; set; }
public RelayCommand TempTurnOff { get; set; }
public RelayCommand OneBlock { get; set; }
public RelayCommand TwoBlock { get; set; }
public RelayCommand ThreeBlock { get; set; }

public RelayCommand OverTurnOff { get; set; }
public RelayCommand OverOneBlock { get; set; }
public RelayCommand OverTwoBlock { get; set; }
public RelayCommand OverThreeBlock { get; set; }
public RelayCommand OverGoOn { get; set; }
public RelayCommand OverGoDown { get; set; }
public RelayCommand ShreddCabbage { get; set; }
public RelayCommand FryPork { get; set; }
public RelayCommand XingBaoGu { get; set; }
public DebugViewModel()
{
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
SimulateOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("SimultaorOrder"); });
TakePot = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePot"); });
TakePotReset = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePotReset"); });
TempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff"); });
OneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OneBlock"); });
TwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("TwoBlock"); });
ThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("ThreeBlock"); });
OverTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTurnOff"); });
OverOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverOneBlock"); });
OverTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTwoBlock"); });
OverThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverThreeBlock"); });
OverGoOn = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoOn"); });
OverGoDown = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoDown"); });
ShreddCabbage = new RelayCommand(() => { ActionManage.GetInstance.Send("ShreddCabbage"); });
FryPork = new RelayCommand(() => { ActionManage.GetInstance.Send("FryPork"); });
XingBaoGu = new RelayCommand(() => { ActionManage.GetInstance.Send("XingBaoGu"); });
}

}
}

+ 2
- 7
BPASmartClient.MorkM/BPASmartClient.MorkM.csproj Просмотреть файл

@@ -7,13 +7,12 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="View\Debug.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\Monitor.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -23,10 +22,6 @@
</ItemGroup>

<ItemGroup>
<Page Update="View\Debug.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\Monitor.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


+ 112
- 278
BPASmartClient.MorkM/Control_MORKM.cs Просмотреть файл

@@ -11,231 +11,81 @@ using BPA.Message.Enum;
using BPASmartClient.Model;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.MorkS.ViewModel;
using BPASmartClient.MorkM.Model;
using System.Collections.ObjectModel;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkM.ViewModel;

namespace BPASmartClient.MorkM
{
public class Control_MORKM : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKM;
GVL_MORKM mORKS = new GVL_MORKM();
Alarm alarm = new Alarm();
HardwareStatus hardwareStatus = new HardwareStatus();

public void Init()
{
ActionManage.GetInstance.Register(new Action(() => { WriteRecipeBoms(); }), "recipeBom");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitCommand");
}
//public void ConnectOk()
//{
// WriteRecipeBoms();
// ReadData();
// Main();
// ResetProgram();
// ActionManage.GetInstance.Register(new Action(() =>
// {
// Random rd = new Random();
// ThreadManage.GetInstance().StartLong(new Action(() =>
// {
// int NoodleLoc = rd.Next(1, 6);
// int BowlLoc = rd.Next(10, 11);
// string guid = new Guid().ToString();

// mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
// DeviceProcessLogShow($"添加订单:面条位置【{NoodleLoc}】");

// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
// DeviceProcessLogShow($"添加订单:碗位置【{BowlLoc}】");
// Thread.Sleep(60000);
// }), "ForOrder");
// }), "EnableForOrder");

// ActionManage.GetInstance.Register(new Action(() =>
// {
// ThreadManage.GetInstance.StopTask("ForOrder", new Action(() =>
// {
// mORKS.RBTakeNoodleTask.Clear();
// mORKS.TakeBowlTask.Clear();
// }));
// }), "StopForOrder");

// DeviceProcessLogShow("MORKM 设备初始化完成");
//}

//private void ResetProgram()
//{
// ThreadManage.GetInstance.StartLong(new Action(() =>
// {
// if (RTrig.GetInstance("ResetProgram").Start(DeviceData.Initing))
// {
// ThreadManage.GetInstance.StopTask("MainTask", new Action(() =>
// {
// ThreadManage.GetInstance.StopTask("ReadPLCData", new Action(() =>
// {
// mORKS = null;
// mORKS = new GVL_MORKM();
// ActionManage.GetInstance.Send("ResetProgram");
// ActionManage.GetInstance.Send("ClearOrders");
// ReadData();
// Main();
// }));
// }));
// }

// Thread.Sleep(10);
// }), "ResetProgram");
//}

/// <summary>
/// 数据读取
/// </summary>
//public void ReadData()
//{
// ThreadManage.GetInstance.StartLong(new Action(() =>
// {
// ModbusTcpHelper.GetInstance.Readbool(323, 3, new Action<bool[]>((bools) =>
// {
// mORKS.RobotTakeNoodle = bools[0];
// mORKS.RobotOutMeal = bools[1];
// mORKS.MoveTurntable = bools[2];
// }));

// ModbusTcpHelper.GetInstance.Readbool(1120, 16, new Action<bool[]>((bools) =>
// {
// mORKS.InitComplete = bools[0];
// mORKS.TakeBowlIdle = bools[1];
// mORKS.TemperatureReached = bools[2];
// mORKS.AllowFallNoodle = bools[3];
// mORKS.RbTakeNoodleComplete = bools[4];
// mORKS.RbFallNoodleComplete = bools[5];
// mORKS.RbOutMealComplete = bools[6];
// mORKS.RobotIdle = bools[7];
// mORKS.TakeMealDetect = bools[8];
// mORKS.MissingBowl = bools[9];
// DeviceData.Initing = bools[10];
// mORKS.TurntableLowerLimit = bools[11];
// mORKS.MissingBowlSignal2 = bools[12];
// mORKS.TurntableUpLimit = bools[13];
// mORKS.FeedComplete = bools[14];
// mORKS.TurntableMoveInPlace = bools[15];
// }));

// var errorStatus = ModbusTcpHelper.GetInstance.Read((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M235.0"), ReadType.Coils, 1);
// if (errorStatus != null && errorStatus is bool error) mORKS.Error = error;

// ModbusTcpHelper.GetInstance.Readbool(1136, 7, new Action<bool[]>((bools) =>
// {
// for (int i = 0; i < 6; i++)
// {
// mORKS.NoodleCookerStatus[i] = bools[i];
// }
// mORKS.Feeding = bools[6];
// }));

// ModbusTcpHelper.GetInstance.Readbool(1144, 6, new Action<bool[]>((bools) =>
// {
// for (int i = 0; i < 6; i++)
// {
// mORKS.CookNoodlesComplete[i] = bools[i];
// }
// }));

// 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)
// {
// if (ResLoc is ushort loc)
// {
// mORKS.TurntableFeedbackloc = loc;
// }
// }

// Thread.Sleep(500);
// }), "ReadPLCData");
//}

//public void SimOrder<T>(T simOrder)
//{
public void SimOrder<T>(T simOrder)
{

// if (simOrder != null)
// {
if (simOrder != null)
{

// if (simOrder is List<ushort> locs)
// {
// OrderInformation newOrder = new OrderInformation();//新加
// List<OrderLocInfo> orders = new List<OrderLocInfo>();
// string subId = Guid.NewGuid().ToString();
// foreach (var item in locs)
// {
// if (item >= 1 && item <= 5)
// {
// orders.Add(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
// //mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId });
// //DeviceProcessLogShow($"添加订单:面条位置【{item}】");
// }
// if (item >= 10 && item <= 11)
// {
// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
// DeviceProcessLogShow($"添加订单:碗位置【{item}】");
// }
// }
// mORKS.DishNumber = orders.Count;//订单中配菜的数量
// while (orders.Count > 0)
// {
// for (int i = 0; i < orders.Count; i++)
// {
// var res = orders.FirstOrDefault(p => p.Loc % 2 != 0);
// if (res != null)
// {
// //if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == res.SuborderId) == null)
// mORKS.RBTakeNoodleTask.Enqueue(res);
if (simOrder is List<ushort> locs)
{
OrderInformation newOrder = new OrderInformation();//新加
List<OrderLocInfo> orders = new List<OrderLocInfo>();
string subId = Guid.NewGuid().ToString();
foreach (var item in locs)
{
if (item >= 1 && item <= 5)
{
orders.Add(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
//mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId });
//DeviceProcessLogShow($"添加订单:面条位置【{item}】");
}
if (item >= 10 && item <= 11)
{
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
DeviceProcessLogShow($"添加订单:碗位置【{item}】");
}
}
mORKS.DishNumber = orders.Count;//订单中配菜的数量
while (orders.Count > 0)
{
for (int i = 0; i < orders.Count; i++)
{
var res = orders.FirstOrDefault(p => p.Loc % 2 != 0);
if (res != null)
{
//if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == res.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(res);

// orders.Remove(res);
orders.Remove(res);

// }
// else
// {
// //if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == orders[i].SuborderId) == null)
// mORKS.RBTakeNoodleTask.Enqueue(orders[i]);
// mORKS.VegtabNum++;
// orders.RemoveAt(i);
}
else
{
//if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == orders[i].SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(orders[i]);
mORKS.VegtabNum++;
orders.RemoveAt(i);

// }
// }
// }
// Dictionary<string, OrderInformation> dic = new Dictionary<string, OrderInformation>();
// newOrder.DishNum = mORKS.DishNumber;
// newOrder.VegatableNumber = mORKS.VegtabNum;
// dic.Add(subId, newOrder);
// mORKS.Conqueue.Enqueue(dic);
// mORKS.VegtabNum = 0;
// mORKS.DishNumber = 0;
// }
// }
//}
}
}
}
Dictionary<string, OrderInformation> dic = new Dictionary<string, OrderInformation>();
newOrder.DishNum = mORKS.DishNumber;
newOrder.VegatableNumber = mORKS.VegtabNum;
dic.Add(subId, newOrder);
mORKS.Conqueue.Enqueue(dic);
mORKS.VegtabNum = 0;
mORKS.DishNumber = 0;
}
}
}

///// <summary>
///// IOT 广播消息命令
@@ -282,9 +132,6 @@ namespace BPASmartClient.MorkM
//}

int OrderCount = 0;

public override DeviceClientType DeviceType => DeviceClientType.MORKM;

///// <summary>
///// 数据解析
///// </summary>
@@ -378,26 +225,25 @@ namespace BPASmartClient.MorkM
});
}

public void Main()
public override void MainTask()
{
//ThreadManage.GetInstance.StartLong(new Action(() =>
//{
// mORKS.AllowRun = mORKS.InitComplete;
// GeneralConfig.Healthy = mORKS.Error && mORKS.InitComplete && !GeneralConfig.EnableLocalSimOrder;
// //GeneralConfig.Healthy = true;
// TakeBowlTask();

// TakeNoodleTask();
mORKS.AllowRun = mORKS.InitComplete;
if (Json<KeepDataBase>.Data.IsVerify)
IsHealth = mORKS.Error && mORKS.InitComplete;
else
IsHealth = true;

// OutNoodleTask();
//if (mORKS.AllowRun)
//{
TakeBowlTask();

// SingleDetect();
TakeNoodleTask();

// TurntableControl();
OutNoodleTask();

// Thread.Sleep(100);
SingleDetect();

//}), "MainTask");
TurntableControl();
}

/// <summary>
@@ -425,24 +271,24 @@ namespace BPASmartClient.MorkM
/// </summary>
private void TurntableControl()
{
//if (GeneralConfig.EnableLocalSimOrder)
//{
// //不做轮询,直接取面,模拟订单使用
// if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
// {
// if (mORKS.TurntableLowerLimit)
// {
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
// if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == mORKS.TurntableFeedbackloc)
// {
// mORKS.TurntableLocLists.Clear();
// mORKS.AllowTakeNoodle = true;
// DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
// }
// }
// }
//}
//else
if (GeneralConfig.EnableLocalSimOrder)
{
//不做轮询,直接取面,模拟订单使用
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.TurntableLowerLimit)
{
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == mORKS.TurntableFeedbackloc)
{
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
}
}
}
}
else
{
//正常轮询
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
@@ -453,7 +299,6 @@ namespace BPASmartClient.MorkM
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
if (mORKS.TurntableLowerLimit && res != null)
{
//if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc != mORKS.TurntableFeedbackloc)
TurntableStart(mORKS.TurntableFeedbackloc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
@@ -532,7 +377,6 @@ namespace BPASmartClient.MorkM
{
values.Add(2);//分
values.Add(0);//秒
// //ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address =$"VW{ 116 + (loc * 6) }" , Value = values.ToArray() });
}
else //荤菜
@@ -780,8 +624,8 @@ namespace BPASmartClient.MorkM
private void WriteRecipeBoms()
{
List<ushort> recipeBoms = new List<ushort>();
if (Json<BatchingInfoPar>.Data.recipeBoms == null) return;
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds)
if (this.recipeBoms == null) return;
foreach (var item in this.recipeBoms.RecipeIds)
{
foreach (var rec in item.Recipes)
{
@@ -790,10 +634,9 @@ namespace BPASmartClient.MorkM
}
if (recipeBoms.Count > 0)
{
//if (//ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray()))
//{
// DeviceProcessLogShow("成功写入配方数据");
//}
//配方数据地址范围:VW2000 - VW2278
WriteData("VW2000", recipeBoms.ToArray());
DeviceProcessLogShow("写配方成功");
}
else { DeviceProcessLogShow("配方数据为空"); }
}
@@ -803,7 +646,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void TakeNoodleCompleteReset()
{
////ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false);
WriteData("M100.4", false);
}

/// <summary>
@@ -814,8 +657,7 @@ namespace BPASmartClient.MorkM
{
if (num >= 1 && num <= 6)
{
ushort addRess = (ushort)(1136 + num - 1);
//ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false);
WriteData($"102.{num - 1}", false);
DeviceProcessLogShow($"{num}号煮面口占用复位");
}

@@ -827,7 +669,7 @@ namespace BPASmartClient.MorkM
/// <param name="num"></param>
private void SetRecipeNumber(ushort num)
{
//ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num);
WriteData("VW0", num);
}

/// <summary>
@@ -839,8 +681,8 @@ namespace BPASmartClient.MorkM
mORKS.CurrentLoc = loc;
mORKS.TurntableInterlock = true;
mORKS.TurntableLocLists.Add(loc);
//ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc);
//ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true);
WriteData("VW2", loc);
WriteData("M0.5", true);
}

/// <summary>
@@ -849,7 +691,7 @@ namespace BPASmartClient.MorkM
/// <param name="loc"></param>
private void SetFallNoodleLoc(ushort loc)
{
//ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc);
WriteData("VW4", loc);
}

/// <summary>
@@ -858,7 +700,7 @@ namespace BPASmartClient.MorkM
/// <param name="loc"></param>
private void SetTakeNoodleLoc(ushort loc)
{
//ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc);
WriteData("VW6", loc);
}

/// <summary>
@@ -869,11 +711,11 @@ namespace BPASmartClient.MorkM
{
if (loc == 10)//小碗
{
//ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true);
WriteData("M0.1", true);
}
else if (loc == 11)//大碗
{
//ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true);
WriteData("M0.2", true);
}
}

@@ -882,7 +724,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void RobotTakeNoodle()
{
//ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true);
WriteData("M0.3", true);
}

/// <summary>
@@ -890,13 +732,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void RobotOutMeal()
{
// ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true);
// var result = ModbusTcpHelper.GetInstance.Read(324, ReadType.Coils);
//if (result is bool res)
// while (!res)
// {
//ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true);
// }
WriteData("M0.4", true);
}

/// <summary>
@@ -904,7 +740,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void ResetCookComplete()
{
//ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false);
WriteData("M100.6", false);
}

/// <summary>
@@ -912,7 +748,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void ResetAllowFallNoodle()
{
//ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false);
WriteData("M100.3", false);
}

/// <summary>
@@ -920,9 +756,9 @@ namespace BPASmartClient.MorkM
/// </summary>
public async void DeviceInit()
{
//ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true);
WriteData("M0.0", true);
await Task.Delay(1000);
//ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false);
WriteData("M0.0", false);

}

@@ -1000,7 +836,9 @@ namespace BPASmartClient.MorkM
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");//设备初始化注册
ActionManage.GetInstance.Register(new Action<object>((o) => {SimOrder(o); }), "SimOrder");//模拟订单委托注册
}
private void WriteData(string address, object value)
{
@@ -1039,7 +877,7 @@ namespace BPASmartClient.MorkM

public override void Stop()
{
throw new NotImplementedException();
}

public override void ReadData()
@@ -1149,11 +987,7 @@ namespace BPASmartClient.MorkM
}));
}

public override void MainTask()
{
throw new NotImplementedException();
}


#endregion



+ 16
- 0
BPASmartClient.MorkM/Model/GeneralConfig.cs Просмотреть файл

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

namespace BPASmartClient.MorkM.Model
{
internal class GeneralConfig
{
/// <summary>
/// 激活本地模拟订单
/// </summary>
public static bool EnableLocalSimOrder { get; set; }
}
}

+ 0
- 32
BPASmartClient.MorkM/View/Debug.xaml Просмотреть файл

@@ -1,32 +0,0 @@
<UserControl
x:Class="BPASmartClient.MorkM.View.Debug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkM.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkM.ViewModel"
Name="调试界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:DebugViewModel />
</UserControl.DataContext>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>
<Button
Grid.Row="0"
Width="150"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Command="{Binding InitCommand}"
Content="初始化设备"
Style="{StaticResource ButtonStyle}" />
</Grid>
</UserControl>

+ 154
- 0
BPASmartClient.MorkM/View/DebugView.xaml Просмотреть файл

@@ -0,0 +1,154 @@
<UserControl x:Class="BPASmartClient.MorkM.View.DebugView"
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"
Name="调试界面"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid Grid.Column="0">
<!--<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>-->

<StackPanel Orientation="Vertical">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding simOrderConfig}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Foreground="#00c2f4"
Text="{Binding Text}" />

<TextBox
Grid.Column="1"
Margin="10,0"
IsEnabled="{Binding IsEnable}"
Text="{Binding Loc}" />

<CheckBox
Grid.Column="2"
Height="20"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="启用随机数"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsSelected}"
/>

<Button
Grid.Column="3"
Margin="10,0,0,0"
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding Text}"
Content="编辑"
FontSize="14"
/>

<Button
Grid.Column="4"
Margin="5,0,0,0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding Text}"
Content="删除"
FontSize="14"
/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

<UniformGrid Grid.Row="1" Columns="2">
<Button
Margin="10,10,10,0"
Grid.Column="1"
Command="{Binding SimOrderCommand}"
Content="模拟订单" Cursor="Hand"
/>
<Button
Margin="10,10,10,0"
Command="{Binding AddSimDataCommand}"
Content="新增模拟数据"
/>
</UniformGrid>
</StackPanel>
</Grid>

<Grid Grid.Column="1" Margin="20,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal">

<!--#region 控制按钮-->
<Button
Margin="10,10,10,0"
Command="{Binding InitCommand}"
Content="初始化" Cursor="Hand"
/>

<Button
Margin="10,10,10,0"
Command="{Binding InitCommand}"
Content="停止"
/>

<Button
x:Name="button_loop"
Margin="10,10,10,0"
Command="{Binding LoopSimOrderCommand}"
Content="{Binding LoopOrderButtonContent}"
/>
<!--#endregion-->

</StackPanel>

<CheckBox
Grid.Row="2"
Height="20"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="启用本地模拟程序"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding EnableLocalSimOrder}"
/>
</Grid>

</Grid>

</UserControl>

BPASmartClient.MorkM/View/Debug.xaml.cs → BPASmartClient.MorkM/View/DebugView.xaml.cs Просмотреть файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.MorkM.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -16,13 +17,14 @@ using System.Windows.Shapes;
namespace BPASmartClient.MorkM.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
public partial class DebugView : UserControl
{
public Debug()
public DebugView()
{
InitializeComponent();
this.DataContext = new DebugViewModel();
}
}
}

+ 206
- 0
BPASmartClient.MorkM/View/SimOrderConfitView.xaml Просмотреть файл

@@ -0,0 +1,206 @@
<Window x:Class="BPASmartClient.MorkM.View.SimOrderConfitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.MorkM.View"
mc:Ignorable="d"
Title="SimOrderConfitView" Height="450" Width="800"
WindowStyle="None"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Width" Value="100" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="Aqua" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="gr">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
<Polygon
x:Name="poly"
Points="0 0,80 0,100 30,20 30"
Stroke="#FF34F7F7"
StrokeThickness="2" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="poly" Property="Fill" Value="#2234F7F7" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Grid Background="#103153">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="79*"/>
<ColumnDefinition Width="321*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Border
x:Name="MoveBorder"
Height="35"
VerticalAlignment="Center"
Background="#0C2349"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal">
<Image Margin="15,5,0,5" Source="/BPASmartClient.CustomResource;component/Image/hbl.ico" />
<TextBlock
Name="tbTitle"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="White"
Text="模拟设备参数配置" />
</StackPanel>
</Border>

<UniformGrid
Width="150"
Height="30"
HorizontalAlignment="Left"
Columns="3" Grid.Column="1" Margin="492,2,0,3">
<Button
Name="ButMin"
Content="&#xe664;"
Style="{StaticResource TitleBarStyle}"
Visibility="Hidden" />
<Button
Name="ButMax"
Content="&#xe65d;"
Style="{StaticResource TitleBarStyle}"
Visibility="Hidden" />
<Button
Name="ButClose"
Content="&#xe639;"
FontSize="30"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 内容显示区-->
<Grid KeyDown="Grid_KeyDown" Grid.Row="1" Margin="10,10,10,10" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="260"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="18"
Foreground="#FF34F7F7"
Text="请输入模拟数据名称:" />
<TextBox
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="0"
Text="{Binding Name}" />

<TextBlock
Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="#FF34F7F7"
Text="模拟位置最小值:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="1"
Text="{Binding Min}" />

<TextBlock
Grid.Row="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="#FF34F7F7"
Text="模拟位置最大值:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="2"
Text="{Binding Max}" />


<Button
Grid.Row="3"
Margin="20,10"
Command="{Binding CancelCommand}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Content="取消"
Style="{StaticResource buttonStyle}" />
<Button
Grid.Row="3"
Grid.Column="1"
Margin="20,10,120,10"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Command="{Binding ConfirmCommand}"
Content="确认"
Style="{StaticResource buttonStyle}" />

</Grid>
<!--#endregion-->

</Grid>
</Window>

+ 56
- 0
BPASmartClient.MorkM/View/SimOrderConfitView.xaml.cs Просмотреть файл

@@ -0,0 +1,56 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkM.ViewModel;
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.Shapes;

namespace BPASmartClient.MorkM.View
{
/// <summary>
/// SimOrderConfitView.xaml 的交互逻辑
/// </summary>
public partial class SimOrderConfitView : Window
{
public SimOrderConfitView()
{
InitializeComponent();
this.DataContext = new SimOrderConfitViewModel();
this.MoveBorder.MouseLeftButtonDown += (o, e) => { this.DragMove(); };
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); ActionManage.GetInstance.CancelRegister("SendSimData"); };
this.MaxWidth = SystemParameters.WorkArea.Width;
this.MaxHeight = SystemParameters.WorkArea.Height;

ActionManage.GetInstance.Register(new Action(() =>
{
this.Close();
ActionManage.GetInstance.CancelRegister("SimOrderConfitViewModelExit");
ActionManage.GetInstance.CancelRegister("SendSimData");
}), "SimOrderConfitViewModelExit");
}

private void Grid_KeyDown(object sender, KeyEventArgs e)
{
var uie = e.OriginalSource as TextBox;
if (uie != null)
{
if (e.Key == Key.Enter)
{
uie.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
e.Handled = true;
}
}
}
}
}

+ 121
- 7
BPASmartClient.MorkM/ViewModel/DebugViewModel.cs Просмотреть файл

@@ -1,21 +1,135 @@
using System;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkM.Model;
using BPASmartClient.MorkM.View;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.MorkS.ViewModel
namespace BPASmartClient.MorkM.ViewModel
{
public class DebugViewModel : ObservableObject
internal class DebugViewModel : ObservableObject
{
public DebugViewModel()
{
InitCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("InitDevice"); });


AddSimDataCommand = new RelayCommand(() =>
{
SimOrderConfitView simOrderConfitView = new SimOrderConfitView();
simOrderConfitView.Show();
});

SimOrderCommand = new RelayCommand(() =>
{
List<ushort> locs = new List<ushort>();
foreach (var item in simOrderConfig)
{
if (item.IsSelected)
locs.Add((ushort)(new Random().Next(item.MinValue, item.MaxValue + 1)));
else
locs.Add(item.Loc);
}
if (locs.Count == 0)
{
locs.Add((ushort)(new Random().Next(1, 5)));
locs.Add(10);
}

ActionManage.GetInstance.Send("SimOrder", locs);
//下发模拟订单
Trace.WriteLine("下发模拟订单。。。");
});

InitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("InitDevice");
//初始化按钮
Trace.WriteLine("已点击初始化按钮。。。");
});

LoopSimOrderCommand = new RelayCommand(() =>
{
if (LoopOrderButtonContent == "循环跑单") ActionManage.GetInstance.Send("EnableForOrder");
if (LoopOrderButtonContent == "停止跑单") ActionManage.GetInstance.Send("StopForOrder");
LoopOrderButtonContent = LoopOrderButtonContent == "循环跑单" ? "停止跑单" : "循环跑单";

});


EditCommand = new RelayCommand<object>((o) =>
{
if (o != null)
{
var res = Json<KeepDataBase>.Data.simOrderConfig.FirstOrDefault(p => p.Text == o.ToString());
if (res != null)
{
SimOrderConfitView simOrderConfitView = new SimOrderConfitView();
simOrderConfitView.Show();
ActionManage.GetInstance.Send("SendSimData", res);
}
}

});

RemoveCommand = new RelayCommand<object>((o) =>
{
if (o != null)
{
var res = Json<KeepDataBase>.Data.simOrderConfig.FirstOrDefault(p => p.Text == o.ToString());
if (res != null) Json<KeepDataBase>.Data.simOrderConfig.Remove(res);
}
});
}

public static bool EnableLocalSimOrder { get { return GeneralConfig.EnableLocalSimOrder; } set { GeneralConfig.EnableLocalSimOrder = value; OnStaticPropertyChanged(); } }

public ObservableCollection<SimOrderVisibleData> simOrderConfig
{
get
{
return Json<KeepDataBase>.Data.simOrderConfig;
}
set
{
Json<KeepDataBase>.Data.simOrderConfig = value;
}
}

public RelayCommand AddSimDataCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand InitCommand { get; set; }

public RelayCommand LoopSimOrderCommand { get; set; }

public RelayCommand<object> EditCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }


public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}

public static string LoopOrderButtonContent { get { return _mLoopOrderButtonContent; } set { _mLoopOrderButtonContent = value; OnStaticPropertyChanged(); } }
private static string _mLoopOrderButtonContent = "循环跑单";





}
}


+ 7
- 8
BPASmartClient.MorkM/ViewModel/MonitorViewModel.cs Просмотреть файл

@@ -1,16 +1,16 @@
using System;
using BPASmartClient.Business;
using BPASmartClient.Device;
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;
using BPASmartClient.Business;
using BPASmartClient.Device;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

namespace BPASmartClient.MorkS.ViewModel
namespace BPASmartClient.MorkM.ViewModel
{
public class MonitorViewModel : ObservableObject
internal class MonitorViewModel : ObservableObject
{
public MonitorViewModel()
{
@@ -20,6 +20,5 @@ namespace BPASmartClient.MorkS.ViewModel
public static int DeviceId { get; set; }

public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;

}
}

+ 6
- 7
BPASmartClient.MorkM/ViewModel/ParSetViewModel.cs Просмотреть файл

@@ -1,17 +1,16 @@
using System;
using BPASmartClient.Helper;
using BPASmartClient.MorkM.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;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkS.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.MorkS.ViewModel
namespace BPASmartClient.MorkM.ViewModel
{
public class ParSetViewModel : ObservableObject
internal class ParSetViewModel: ObservableObject
{
public ParSetViewModel()
{


+ 90
- 0
BPASmartClient.MorkM/ViewModel/SimOrderConfitViewModel.cs Просмотреть файл

@@ -0,0 +1,90 @@
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkM.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.ViewModel
{
internal class SimOrderConfitViewModel: ObservableObject
{
bool IsEdit = false;
SimOrderVisibleData simOrderVisibleData;
string DeviceType = string.Empty;
public SimOrderConfitViewModel()
{
// DeviceType = GeneralConfig.StartDevice;
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null)
{
if (o is SimOrderVisibleData sim)
{
Name = sim.Text;
Max = sim.MaxValue;
Min = sim.MinValue;
IsEdit = true;
simOrderVisibleData = sim;
}
}
}), "SendSimData");

ConfirmCommand = new RelayCommand(() =>
{
//if (!Json<KeepDataBase>.Data.simOrderConfig.ContainsKey(DeviceType))
//{
// Json<KeepDataBase>.Data.simOrderConfig.TryAdd(DeviceType, new ObservableCollection<SimOrderVisibleData>());
//}

if (!IsEdit)
{
Json<KeepDataBase>.Data.simOrderConfig.Add(new SimOrderVisibleData()
{
IsEnable = true,
IsSelected = true,
Text = Name,
Loc = Min,
MaxValue = Max,
MinValue = Min,
});
}
else
{
int index = Array.FindIndex(Json<KeepDataBase>.Data.simOrderConfig.ToArray(), p => p.Text == simOrderVisibleData.Text);
if (index >= 0 && index < Json<KeepDataBase>.Data.simOrderConfig.Count())
{
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).Text = Name;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).MinValue = Min;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).MaxValue = Max;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).IsEnable = simOrderVisibleData.IsEnable;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).IsSelected = simOrderVisibleData.IsSelected;
}
}
ActionManage.GetInstance.Send("SimOrderConfitViewModelExit");
});
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("SimOrderConfitViewModelExit"); });
}


public RelayCommand ConfirmCommand { get; set; }

public RelayCommand CancelCommand { get; set; }

public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged();; } }
private string _mName;

public ushort Min { get { return _mMin; } set { _mMin = value; OnPropertyChanged(); } }
private ushort _mMin;

public ushort Max { get { return _mMax; } set { _mMax = value; OnPropertyChanged(); } }
private ushort _mMax;


}
}


+ 4
- 4
BPASmartClient/App.config Просмотреть файл

@@ -7,14 +7,14 @@
<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="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>-->
<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="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key ="Namespaces" value="TEST1.Config"/>-->

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


+ 1
- 0
BPASmartClient/BPASmartClient.csproj Просмотреть файл

@@ -31,6 +31,7 @@
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />


+ 16
- 4
BPASmartClient/DeviceInfo.xml Просмотреть файл

@@ -61,7 +61,7 @@
</Device>-->-->


<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
<!--<Device Name="MorkF" Module="BPASmartClient.MorkF.Control_MorkF" DeviceId="2">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
@@ -71,16 +71,28 @@
</Parameters>
</Peripheral>
</Peripherals>
</Device>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<!--<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
--><!--<PLCReadAddress>M,M230.0,24</PLCReadAddress>--><!--
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->-->
<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<!--<PLCReadAddress>M,M230.0,24</PLCReadAddress>-->
<PLCReadAddress>M,M230.0,24</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>


+ 3
- 1
BPASmartClient/MainWindow.xaml.cs Просмотреть файл

@@ -251,7 +251,9 @@ namespace BPASmartClient
{
if (sender is MenuItem)
{
Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView");
// Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView");
// Type type = Assembly.Load("BPASmartClient.MorkF").GetType("BPASmartClient.MorkF.View.DebugView");
Type type = Assembly.Load("BPASmartClient.MorkM").GetType("BPASmartClient.MorkM.View.DebugView");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
Title.Text = (sender as MenuItem).Header?.ToString() + "界面";


Загрузка…
Отмена
Сохранить