Kaynağa Gözat

调酒机更新

样式分支
taoye 1 yıl önce
ebeveyn
işleme
10c8853414
27 değiştirilmiş dosya ile 798 ekleme ve 30 silme
  1. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  2. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  3. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  4. +1
    -1
      BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs
  5. +1
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  6. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  7. +25
    -0
      BPASmartClient.Model/MixWinkModel.cs
  8. +13
    -0
      BPASmartClient.Model/订单/MorkMWSimOrder.cs
  9. +1
    -1
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  10. +21
    -0
      BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
  11. +313
    -0
      BPASmartClient.MorkMW/Control_MorkMW.cs
  12. +75
    -0
      BPASmartClient.MorkMW/GVL_MorkMW.cs
  13. +19
    -0
      BPASmartClient.MorkMW/Model/OrderLocInfo.cs
  14. +18
    -0
      BPASmartClient.MorkMW/Model/SimRecipeModel.cs
  15. +75
    -0
      BPASmartClient.MorkMW/View/DebugView.xaml
  16. +28
    -0
      BPASmartClient.MorkMW/View/DebugView.xaml.cs
  17. +58
    -0
      BPASmartClient.MorkMW/ViewModel/DebugViewModel.cs
  18. +1
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  19. +4
    -4
      BPASmartClient/App.config
  20. +2
    -0
      BPASmartClient/BPASmartClient.csproj
  21. +16
    -5
      BPASmartClient/DeviceInfo.xml
  22. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  23. +24
    -1
      SmartClient.sln
  24. +37
    -0
      TestDemo/Form1.Designer.cs
  25. +40
    -11
      TestDemo/Form1.cs
  26. +20
    -0
      TestDemo/MixWinkRecipe.cs
  27. +1
    -0
      TestDemo/TestDemo.csproj

+ 1
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj Dosyayı Görüntüle

@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Dosyayı Görüntüle

@@ -410,7 +410,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj Dosyayı Görüntüle

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs Dosyayı Görüntüle

@@ -12,7 +12,7 @@ namespace BPASmartClient.JXJFoodBigStation.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj Dosyayı Görüntüle

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj Dosyayı Görüntüle

@@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 25
- 0
BPASmartClient.Model/MixWinkModel.cs Dosyayı Görüntüle

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

namespace BPASmartClient.Model
{
public class MixWinkModel:ObservableObject
{
private string _materialName;
public string materialName { get { return _materialName; } set { _materialName = value;OnPropertyChanged(); } }
/// <summary>
/// 位置
/// </summary>
private int _loc;
public int Loc { get { return _loc; } set { _loc = value;OnPropertyChanged(); } }
/// <summary>
/// 停留时间
/// </summary>
public int Time { get { return _time; } set { _time = value;OnPropertyChanged(); } }
private int _time;
}
}

+ 13
- 0
BPASmartClient.Model/订单/MorkMWSimOrder.cs Dosyayı Görüntüle

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

namespace BPASmartClient.Model.订单
{
public class MorkMWSimOrder:BaseEvent
{
public List<MixWinkModel> mixWink = new List<MixWinkModel>();
}
}

+ 1
- 1
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj Dosyayı Görüntüle

@@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
</ItemGroup>

<ItemGroup>


+ 21
- 0
BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj Dosyayı Görüntüle

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="CommunityToolkit.Common" Version="8.0.0" />
</ItemGroup>

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

</Project>

+ 313
- 0
BPASmartClient.MorkMW/Control_MorkMW.cs Dosyayı Görüntüle

@@ -0,0 +1,313 @@
using BPA.Helper;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Modbus;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.Model.订单;
using BPASmartClient.MorkMW.Model;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Concurrent;
using System.Threading;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkMW
{
public class Control_MorkMW : BaseDevice
{
ModbusTcp modbus;
public override DeviceClientType DeviceType => DeviceClientType.MORKMW;
GVL_MorkMW morkMW = new GVL_MorkMW();
public override void DoMain()
{

ConnectKlpRobot("192.168.0.100", 8001);
}

public override void MainTask()
{
ToGetWink();
ToMixWink();
ToPourWink();
SignalDetect();
}
/// <summary>
/// 接酒过程
/// </summary>
public void ToGetWink()
{
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock&&!morkMW.PourWinkComplete&& morkMW.CupSignal)
{
DeviceProcessLogShow("订单开始制作");
morkMW.TaskLock = true;
if (orderLocInfos.TryDequeue(out OrderLocInfo res))
{
foreach (var item in res.mixWink)
{
switch (item.Loc)
{
// case 7: ToMixWink(); break;
case 1: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
case 2: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
case 3: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
case 4: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
case 5: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;
case 6: ToSpecifiedLocTakeWink(item.Loc, item.Time); break;

}
switch (item.Loc)
{
//case 7: while (!morkMW.MixWinkComplte) { Thread.Sleep(5); } break;
case 1: while (!morkMW.TakeWinkOneComplete) { Thread.Sleep(5); } break;
case 2: while (!morkMW.TakeWinkTwoComplete) { Thread.Sleep(5); } break;
case 3: while (!morkMW.TakeWinkThreeComplete) { Thread.Sleep(5); } break;
case 4: while (!morkMW.TakeWinkFourComplete) { Thread.Sleep(5); } break;
case 5: while (!morkMW.TakeWinkFiveComplete) { Thread.Sleep(5); } break;
case 6: while (!morkMW.TakeWinkSixComplete) { Thread.Sleep(5); } break;

}


}
morkMW.AllowMixWink = true;//接酒完成,允许调酒
// morkMW.AllowPourWink = true;//调酒完成,允许倒酒
}
}
}
/// <summary>
/// 调酒过程
/// </summary>
public void ToMixWink()
{
// modbus.WriteSingleRegister(0000, 7);//机器人调酒

if (morkMW.AllowMixWink)
{
DeviceProcessLogShow("开始调酒");
modbus.WriteSingleRegister(0000, 7);//机器人调酒
morkMW.AllowMixWink = false;
}
}
/// <summary>
/// 去对应位置接酒
/// </summary>
/// <param name="loc"></param>
/// <param name="time"></param>
public void ToSpecifiedLocTakeWink(int loc, int time)
{
//发送接酒信号
switch (loc)
{
case 1: modbus.WriteSingleRegister(0000, 1); break;
case 2: modbus.WriteSingleRegister(0000, 2); break;
case 3: modbus.WriteSingleRegister(0000, 3); break;
case 4: modbus.WriteSingleRegister(0000, 4); break;
case 5: modbus.WriteSingleRegister(0000, 5); break;
case 6: modbus.WriteSingleRegister(0000, 6); break;

}
//等待机器人到达接酒位置
switch (loc)
{
case 1: while (!morkMW.ArriveWinkOneLoc) { Thread.Sleep(5); } break;
case 2: while (!morkMW.ArriveWinkTwoLoc) { Thread.Sleep(5); } break;
case 3: while (!morkMW.ArriveWinkThreeLoc) { Thread.Sleep(5); } break;
case 4: while (!morkMW.ArriveWinkFourLoc) { Thread.Sleep(5); } break;
case 5: while (!morkMW.ArriveWinkFiveLoc) { Thread.Sleep(5); } break;
case 6: while (!morkMW.ArriveWinkSixLoc) { Thread.Sleep(5); } break;

}
Thread.Sleep(time * 1000);//接酒等待时间
//发送接酒完成信号
switch (loc)
{
case 1: modbus.WriteSingleCoil(4596, true); break;
case 2: modbus.WriteSingleCoil(4597, true); break;
case 3: modbus.WriteSingleCoil(4598, true); break;
case 4: modbus.WriteSingleCoil(4599, true); break;
case 5: modbus.WriteSingleCoil(4600, true); break;
case 6: modbus.WriteSingleCoil(4601, true); break;

}

}
/// <summary>
/// 倒酒过程
/// </summary>
public void ToPourWink()
{
//if (morkMW.AllowPourWink && morkMW.CupSignal)
//{
// morkMW.AllowPourWink = false;
// modbus.WriteSingleRegister(0000, 8);//倒酒

//}
if (morkMW.CupSignal && RTrig.GetInstance("AllowOut").Start(morkMW.MixWinkComplte))
{
DeviceProcessLogShow("开始倒酒");
modbus.WriteSingleRegister(0000, 8);//倒酒

}

}
/// <summary>
/// 信号检测
/// </summary>
public void SignalDetect()
{
if (RTrig.GetInstance("AllComplete").Start(morkMW.ProcessComplete))
{
morkMW.PourWinkComplete = true;
DeviceProcessLogShow("订单制作完成,请取走调好酒杯");
}
if (morkMW.PourWinkComplete)
{
if (TTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
{
DeviceProcessLogShow("客户取走调好酒杯,请放置空酒杯,以待下次订单制作");
}
if (RTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal))
{
DeviceProcessLogShow("空酒杯就位,允许执行下一订单");
morkMW.PourWinkComplete = false;
morkMW.TaskLock = false;
Thread.Sleep(2000);
}
}
}


/// <summary>
/// 读卡乐普机器人状态
/// </summary>
public override void ReadData()
{
//GetStatus("M230.0", new Action<object>((obj) =>
//{

//}));
if (modbus.Connected)
{
morkMW.ArriveWinkOneLoc = modbus.ReadCoils(4616);
morkMW.ArriveWinkTwoLoc = modbus.ReadCoils(4617);
morkMW.ArriveWinkThreeLoc = modbus.ReadCoils(4618);
morkMW.ArriveWinkFourLoc = modbus.ReadCoils(4619);
morkMW.ArriveWinkFiveLoc = modbus.ReadCoils(4620);
morkMW.ArriveWinkSixLoc = modbus.ReadCoils(4621);

morkMW.RobotIdle = modbus.ReadCoils(4201);


morkMW.CupSignal = modbus.ReadInputs(0);


morkMW.TakeWinkOneComplete = modbus.ReadCoils(4606);
morkMW.TakeWinkTwoComplete = modbus.ReadCoils(4607);
morkMW.TakeWinkThreeComplete = modbus.ReadCoils(4608);
morkMW.TakeWinkFourComplete = modbus.ReadCoils(4609);
morkMW.TakeWinkFiveComplete = modbus.ReadCoils(4610);
morkMW.TakeWinkSixComplete = modbus.ReadCoils(4611);
morkMW.MixWinkComplte = modbus.ReadCoils(4612);
morkMW.ProcessComplete = modbus.ReadCoils(4613);
}
else
{
modbus.ModbusTcpConnect("192.168.0.100", 8001);
}
}

public override void ResetProgram()
{
morkMW = null;
morkMW = new GVL_MorkMW();
}


public override void SimOrder()
{
EventBus.EventBus.GetInstance().Subscribe<MorkMWSimOrder>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{

if (@event != null && @event is MorkMWSimOrder order)
{
if (order.mixWink.Count > 0)
{
string guid = Guid.NewGuid().ToString();
orderLocInfos.Enqueue(new OrderLocInfo { mixWink = order.mixWink, SuborderId = guid });
DeviceProcessLogShow("收到订单");
}
}

});
}

public override void Stop()
{

}
private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}
/// <summary>
/// 卡乐普写数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
private void WriteData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}
/// <summary>
/// 数据解析
/// </summary>
public void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{

if (@event != null && @event is DoOrderEvent order)
{

}

});
}
#region 调试代码
/// <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) =>
{
if (s != null) DeviceProcessLogShow(s);
});
modbus.ShowEx += new Action<string>((s) =>
{
if ((s != null)) DeviceProcessLogShow(s);
});
modbus.ModbusTcpConnect(ip, port);

}
#endregion
/// <summary>
/// 调酒订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> orderLocInfos = new ConcurrentQueue<OrderLocInfo>();

}
}

+ 75
- 0
BPASmartClient.MorkMW/GVL_MorkMW.cs Dosyayı Görüntüle

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

namespace BPASmartClient.MorkMW
{
public class GVL_MorkMW
{
#region 机器人信号

/// <summary>
/// 机器人空闲信号
/// </summary>
public bool RobotIdle { get; set; }

public bool TakeWinkOneComplete { get; set; }
public bool TakeWinkTwoComplete { get; set; }
public bool TakeWinkThreeComplete { get; set; }
public bool TakeWinkFourComplete { get; set; }
public bool TakeWinkFiveComplete { get; set; }
public bool TakeWinkSixComplete { get; set; }



public bool ArriveWinkOneLoc { get; set; }

public bool ArriveWinkTwoLoc { get; set; }

public bool ArriveWinkThreeLoc { get; set; }

public bool ArriveWinkFourLoc { get; set; }

public bool ArriveWinkFiveLoc { get; set; }

public bool ArriveWinkSixLoc { get; set; }
/// <summary>
/// 放杯处传感器信号
/// </summary>
public bool CupSignal { get; set; }
/// <summary>
/// 摇酒完成信号
/// </summary>
public bool MixWinkComplte { get; set; }
/// <summary>
/// 机器人倒完酒并回到初始位的完成信号
/// </summary>
public bool ProcessComplete { get; set; }
#endregion


#region 流程控制
/// <summary>
/// 任务锁
/// </summary>
public bool TaskLock { get; set; }
/// <summary>
/// 接酒完成
/// </summary>
public bool AllowMixWink { get; set; }
/// <summary>
/// 调酒完成
/// </summary>
public bool AllowPourWink { get; set; }
/// <summary>
/// 倒酒结束标志
/// </summary>
public bool PourWinkComplete { get; set; }
#endregion
}
}

+ 19
- 0
BPASmartClient.MorkMW/Model/OrderLocInfo.cs Dosyayı Görüntüle

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

namespace BPASmartClient.MorkMW.Model
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
/// <summary>
/// 单个订单的制作流程
/// </summary>
public List<MixWinkModel> mixWink=new List<MixWinkModel>();
public string GoodName { get; set; }
}
}

+ 18
- 0
BPASmartClient.MorkMW/Model/SimRecipeModel.cs Dosyayı Görüntüle

@@ -0,0 +1,18 @@
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkMW.Model
{
public class SimRecipeModel
{

public string GoodsName { get; set; }

public ObservableCollection<MixWinkModel> recipe { get; set; } = new ObservableCollection<MixWinkModel>();// { new MixWinkModel { materialName="白兰地",Loc=7,Time=2} };
}
}

+ 75
- 0
BPASmartClient.MorkMW/View/DebugView.xaml Dosyayı Görüntüle

@@ -0,0 +1,75 @@
<UserControl x:Class="BPASmartClient.MorkMW.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.MorkMW.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkMW.ViewModel"
mc:Ignorable="d"
Name="本地调试"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<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 />
<RowDefinition Height="500"/>
</Grid.RowDefinitions>
<StackPanel>
<Grid Width="600">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="物料名称" HorizontalAlignment="Center" />
<TextBlock Text="物料位置" Grid.Column="1" HorizontalAlignment="Center"/>
<TextBlock Text="时间" Grid.Column="2" HorizontalAlignment="Center"/>
</Grid>
<StackPanel Width="600">
<ItemsControl ItemsSource="{Binding SimRecipe.recipe}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding materialName}" Margin="10,10" />
<ComboBox Text="{Binding Loc}" ItemsSource="{Binding DataContext.location,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Grid.Column="1" Margin="10,10"/>
<TextBox Text="{Binding Time}" Grid.Column="2" Margin="10,10"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
<Button Content="添加原料" Width="150" Command="{Binding AddMaterial}" Margin="10,10"></Button >
<Button Content="删除原料" Width="150" Command="{Binding ClearMaterial}"></Button >
<Button Content="本地订单下发" Width="150" Margin="10,10" Command="{Binding SimOrderSetDown}" CommandParameter="{Binding SimRecipe}"/>
</StackPanel>

</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkMW/View/DebugView.xaml.cs Dosyayı Görüntüle

@@ -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>
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
public DebugView()
{
InitializeComponent();
}
}
}

+ 58
- 0
BPASmartClient.MorkMW/ViewModel/DebugViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,58 @@
using BPASmartClient.EventBus;
using BPASmartClient.Model;
using BPASmartClient.Model.订单;
using BPASmartClient.MorkMW.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.MorkMW.ViewModel
{
public class DebugViewModel:ObservableObject
{
public DebugViewModel()
{
//SimOrderSetDown = new RelayCommand((s) =>
//{

// //new MorkMWSimOrder() { mixWink = new List<MixWinkModel> { new MixWinkModel { Loc = 1,Time=3000 } } }.Publish();


//});
SimRecipe = new SimRecipeModel();
SimOrderSetDown = new RelayCommand<object>((s) => {

if (s is SimRecipeModel res)
{
new MorkMWSimOrder() {mixWink=res.recipe.ToList() }.Publish();
}
});

AddMaterial = new RelayCommand(() => {

SimRecipe.recipe.Insert(0, new MixWinkModel());
});

ClearMaterial = new RelayCommand(() => {
if(SimRecipe.recipe.Count>1)
SimRecipe.recipe.RemoveAt(SimRecipe.recipe.Count - 2);
});
}
/// <summary>
/// 模拟订单
/// </summary>
public RelayCommand<object> SimOrderSetDown { get; set; }

public RelayCommand AddMaterial { get; set; }

public RelayCommand ClearMaterial { get; set; }
public SimRecipeModel SimRecipe { get; set; }

public List<int> location { get; set; } = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
}
}

+ 1
- 1
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Dosyayı Görüntüle

@@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.77" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />


+ 4
- 4
BPASmartClient/App.config Dosyayı Görüntüle

@@ -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,调用接口查询“设备连接信息”-->


+ 2
- 0
BPASmartClient/BPASmartClient.csproj Dosyayı Görüntüle

@@ -15,6 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

@@ -32,6 +33,7 @@
<ProjectReference Include="..\BPASmartClient.MorkBF\BPASmartClient.MorkBF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />


+ 16
- 5
BPASmartClient/DeviceInfo.xml Dosyayı Görüntüle

@@ -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,9 +71,9 @@
</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>
@@ -84,8 +84,8 @@
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
</Device>-->
<!--<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
@@ -95,6 +95,17 @@
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->
<Device Name="MorkMW" Module="BPASmartClient.MorkMW.Control_MorkMW" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.0.100</IpAddress>
<Port>8001</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>


+ 1
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj Dosyayı Görüntüle

@@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="BPA.Message" Version="1.0.79" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>



+ 24
- 1
SmartClient.sln Dosyayı Görüntüle

@@ -194,7 +194,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenLib",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTest", "WpfTest\WpfTest.csproj", "{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{81D03688-7361-45B8-A3EB-9B0A9222A338}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{81D03688-7361-45B8-A3EB-9B0A9222A338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkMW", "BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj", "{C763BF70-2416-4A64-9011-8EF8549473FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1830,6 +1832,26 @@ Global
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x64.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x86.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x86.Build.0 = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|ARM.Build.0 = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|ARM64.Build.0 = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|x64.ActiveCfg = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|x64.Build.0 = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|x86.ActiveCfg = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Debug|x86.Build.0 = Debug|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|Any CPU.Build.0 = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|ARM.ActiveCfg = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|ARM.Build.0 = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|ARM64.ActiveCfg = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|ARM64.Build.0 = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|x64.ActiveCfg = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|x64.Build.0 = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|x86.ActiveCfg = Release|Any CPU
{C763BF70-2416-4A64-9011-8EF8549473FD}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1920,6 +1942,7 @@ Global
{798BBFFE-3BA2-40BA-BFE1-9502398F1F08} = {C6984F48-A0FE-47A4-B63B-E4E5BCFCD6D3}
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{81D03688-7361-45B8-A3EB-9B0A9222A338} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{C763BF70-2416-4A64-9011-8EF8549473FD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


+ 37
- 0
TestDemo/Form1.Designer.cs Dosyayı Görüntüle

@@ -35,6 +35,9 @@
this.button4 = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button7 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
@@ -106,11 +109,42 @@
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(408, 13);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(104, 40);
this.button6.TabIndex = 7;
this.button6.Text = "卡乐普写测试";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(410, 71);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(219, 81);
this.textBox1.TabIndex = 8;
//
// button7
//
this.button7.Location = new System.Drawing.Point(518, 12);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(104, 40);
this.button7.TabIndex = 9;
this.button7.Text = "卡乐普读测试";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(641, 298);
this.Controls.Add(this.button7);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.button4);
@@ -136,5 +170,8 @@
private Button button4;
private SplitContainer splitContainer1;
private Button button5;
private Button button6;
private TextBox textBox1;
private Button button7;
}
}

+ 40
- 11
TestDemo/Form1.cs Dosyayı Görüntüle

@@ -4,12 +4,13 @@ using BPASmartClient.Http;
using BPASmartClient.HubHelper;
using Newtonsoft.Json;
using BPASmartClient.S7Net;
using BPASmartClient.Modbus;

namespace TestDemo
{
public partial class Form1 : Form
{
ModbusTcp modbus;
int count = 0;
SiemensHelper siemensHelper = new SiemensHelper();
public Form1()
@@ -20,16 +21,16 @@ namespace TestDemo
//{
// label1.Text = (count++).ToString();
//}), \"加数值\");
SiemensHelper siemensHelper = new SiemensHelper();
siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
var res = siemensHelper.ReadClass<ReadClass>(1);
//SiemensHelper siemensHelper = new SiemensHelper();
//siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
//var res = siemensHelper.ReadClass<ReadClass>(1);

siemensHelper.WriteClass(new ReadClass() { temp1 = "我", temp2 = "你" }, 1);
//siemensHelper.WriteClass(new ReadClass() { temp1 = "我", temp2 = "你" }, 1);

ActionManage.GetInstance.Register(new Action(() =>
{
label1.Text = (count++).ToString();
}), "加数值");
//ActionManage.GetInstance.Register(new Action(() =>
//{
// label1.Text = (count++).ToString();
//}), "加数值");

//ActionManage.GetInstance.Register(new Action(() =>
//{
@@ -37,6 +38,17 @@ namespace TestDemo
// Thread.Sleep(20000);
// Console.WriteLine(\"阻塞方法执行完成\");
//}), \"阻塞方法\");
modbus = new ModbusTcp();
modbus.ModbusTcpConnect("192.168.0.100", 8001);
MessageBox.Show("卡乐普机器人连接成功");

}

private void ReadData()
{
textBox1.Text= modbus.ReadCoils(4201).ToString(); //初始位
//textBox1.Text = modbus.ReadInputs(0000).ToString();
}

private void button1_Click(object sender, EventArgs e)
@@ -88,7 +100,24 @@ namespace TestDemo
}
siemensHelper.WriteClass(tt, 3);
}

/// <summary>
/// 卡乐普写
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button6_Click(object sender, EventArgs e)
{
modbus.WriteSingleCoil(2000,true);
//modbus.WriteSingleRegister(0000,1);
}
/// <summary>
/// 卡乐普读
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button7_Click(object sender, EventArgs e)
{
ReadData();
}
}
}

+ 20
- 0
TestDemo/MixWinkRecipe.cs Dosyayı Görüntüle

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

namespace TestDemo
{
/// <summary>
/// 调酒配方
/// </summary>
internal class MixWinkRecipe
{
public MixWinkRecipe() {

Thread.Sleep(new TimeSpan(0,1,0));
}
}
}

+ 1
- 0
TestDemo/TestDemo.csproj Dosyayı Görüntüle

@@ -22,6 +22,7 @@
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Http\BPASmartClient.Http.csproj" />
<ProjectReference Include="..\BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" />
</ItemGroup>


Yükleniyor…
İptal
Kaydet