@@ -8,8 +8,8 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.33" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<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" /> | |||
@@ -6,6 +6,7 @@ using BPASmartClient.Http; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.小炒机; | |||
using BPASmartClient.Model.调酒机; | |||
using BPASmartClient.Peripheral; | |||
using Newtonsoft.Json; | |||
using System; | |||
@@ -95,7 +96,7 @@ namespace BPASmartClient.Business | |||
#region 获取物料数据 | |||
string result = string.Empty; | |||
for (int i = 0; i < 3; i++) | |||
for (int i = 0; i < 4; i++) | |||
{ | |||
try | |||
{ | |||
@@ -138,6 +139,15 @@ namespace BPASmartClient.Business | |||
}.Publish(); | |||
MessageLog.GetInstance.Show("接收到【 API 】获取的小炒流程信息"); | |||
} | |||
else if (PushType == 3) | |||
{ | |||
new MorkMWGoodsEvent() | |||
{ | |||
DeviceId = device.DeviceId, | |||
morkMWPushMessage = JsonConvert.DeserializeObject<MORKMWPushMessage>(result) | |||
}.Publish(); | |||
MessageLog.GetInstance.Show("接收到【API】获取的调酒机配方信息"); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -410,7 +410,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
@@ -7,7 +7,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -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()))); | |||
@@ -8,7 +8,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
@@ -17,7 +17,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using BPA.Models; | |||
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>(); | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using BPA.Message; | |||
using BPA.Models; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Model.调酒机 | |||
{ | |||
public class MorkMWGoodsEvent : BaseEvent | |||
{ | |||
public MORKMWPushMessage morkMWPushMessage = new MORKMWPushMessage(); | |||
} | |||
} |
@@ -10,7 +10,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -0,0 +1,99 @@ | |||
using BPA.Helper; | |||
using Org.BouncyCastle.Asn1.X509; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkF.Model | |||
{ | |||
internal class MaterialCoordinate : Singleton<MaterialCoordinate> | |||
{ | |||
public List<string> MLNumberList { get; set; } = new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" | |||
, "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27" }; | |||
public List<Coordinate> MLCoordinateList { get;set;} = new List<Coordinate>() | |||
{ new Coordinate() { X = 34500, Y = 0 }, new Coordinate() { X = 34500, Y = 9000 } , new Coordinate() { X = 34500, Y = 0 } , //第1层 | |||
new Coordinate(){ X = 34500,Y=0} , new Coordinate() { X = 34500, Y = 83000 }, new Coordinate(){ X = 34500,Y=0}, //第1层 | |||
new Coordinate(){ X = 34500,Y=0} , new Coordinate() { X = 34500, Y = 0 }, new Coordinate(){ X = 34500,Y=0}, //第1层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0}, //第2层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0}, //第2层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0}, //第2层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0}, //第3层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0}, //第3层 | |||
new Coordinate(){ X = 0,Y=0} , new Coordinate() { X = 0, Y = 0 }, new Coordinate(){ X = 0,Y=0} //第3层 | |||
}; | |||
public MaterialCoordinate() | |||
{ | |||
if(MLNumberList.Count == MLCoordinateList.Count && MLNumberList.Count == 27) | |||
{ | |||
for(int i = 0;i<MLNumberList.Count;i++) | |||
{ | |||
//判断是否已经有该值了 | |||
if (!dicNoMaterialCoordinate.ContainsKey(MLNumberList[i])) | |||
{ | |||
dicNoMaterialCoordinate.Add(MLNumberList[i], MLCoordinateList[i]); | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 更新键值对 | |||
/// </summary> | |||
/// <param name="mlNumber"></param> | |||
/// <param name="coordinate"></param> | |||
/// <returns></returns> | |||
public bool UpdateMLCoordinateList(string mlNumber,Coordinate coordinate) | |||
{ | |||
if(dicNoMaterialCoordinate.ContainsKey(mlNumber)) | |||
{ | |||
dicNoMaterialCoordinate[mlNumber] = coordinate; | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 每个取菜点的编号与坐标字典 | |||
/// </summary> | |||
public Dictionary<string, Coordinate> dicNoMaterialCoordinate { get; set; } = new Dictionary<string, Coordinate>(); | |||
//{ | |||
// {"A1",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"A2",new Coordinate(){ X = 34500,Y=9000} }, | |||
// {"A3",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"B1",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"B2",new Coordinate(){ X = 34500,Y=83000} }, | |||
// {"B3",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"C1",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"C2",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"C3",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"D1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"D2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"D3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"E1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"E2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"E3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"F1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"F2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"F3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"G1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"G2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"G3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"H1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"H2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"H3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"I1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"I2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"I3",new Coordinate(){ X = 0,Y=0} }, | |||
// {"J1",new Coordinate(){ X = 0,Y=0} }, | |||
// {"J2",new Coordinate(){ X = 0,Y=0} }, | |||
// {"J3",new Coordinate(){ X = 0,Y=0} }, | |||
//}; | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Models; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -20,6 +21,18 @@ namespace BPASmartClient.MorkF | |||
{ | |||
public Coordinate coordinate { get; set; } = new Coordinate(); | |||
/// <summary> | |||
/// 菜品编号 | |||
/// </summary> | |||
public string id; | |||
/// <summary> | |||
/// 菜品位置 | |||
/// </summary> | |||
public string loc; | |||
public MaterialInfo materialInfo; | |||
/// <summary> | |||
/// 炒锅编号 | |||
/// </summary> |
@@ -0,0 +1,207 @@ | |||
using BPA.Helper; | |||
using BPA.Models; | |||
using BPASmartClient.MorkF.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkF | |||
{ | |||
internal class MaterialSurplusOperation : Singleton<MaterialSurplusOperation> | |||
{ | |||
public MaterialSurplus materialSurplus { get; set; } = new MaterialSurplus(); | |||
/// <summary> | |||
/// 更新余量 | |||
/// </summary> | |||
/// <param name="number">编号</param> | |||
/// <param name="surplus">余量</param> | |||
public bool UpdateSurplus(string loc, int surplus) | |||
{ | |||
//找到所有id对应的 | |||
MaterialInfo material = materialSurplus.dicSurplus.Find(t => t.Loc == loc); | |||
if(material == null) | |||
{ | |||
return false; | |||
} | |||
else | |||
{ | |||
material.Qty = decimal.Parse(surplus.ToString()); | |||
return true; | |||
} | |||
} | |||
/// <summary> | |||
/// 返回有效的菜品库对象 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public MaterialInfo GetVailedMaterial(string id) | |||
{ | |||
int surplus = 0; | |||
//获取该菜品所有的余量 | |||
if(!GetAllSurplus(id,out surplus)) | |||
{ | |||
return null; | |||
} | |||
//判断库存数量是否有效 | |||
if(surplus <= 0) | |||
{ | |||
return null; | |||
} | |||
return GetMaterial(id); | |||
} | |||
/// <summary> | |||
/// 根据编号返回余量 | |||
/// </summary> | |||
/// <param name="number">编号</param> | |||
/// <param name="surplus">余量</param> | |||
/// <returns></returns> | |||
private MaterialInfo GetMaterial(string id) | |||
{ | |||
//找到所有id对应的 | |||
MaterialInfo material = materialSurplus.dicSurplus.Find(t => t.Id == id && t.Qty != 0); | |||
return material; | |||
} | |||
/// <summary> | |||
/// 根据编号返回余量 | |||
/// </summary> | |||
/// <param name="number">编号</param> | |||
/// <param name="surplus">余量</param> | |||
/// <returns></returns> | |||
private bool GetAllSurplus(string id, out int surplus) | |||
{ | |||
surplus = 0; | |||
//找到所有id对应的 | |||
List<MaterialInfo> materials = materialSurplus.dicSurplus.FindAll(t=>t.Id == id); | |||
if (materials != null) | |||
{ | |||
foreach(MaterialInfo material in materials) | |||
{ | |||
//surplus += int.Parse(material.Qty.ToString()); | |||
surplus += Convert.ToInt32(material.Qty); | |||
} | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 余量减少 | |||
/// </summary> | |||
/// <param name="number"></param> | |||
/// <returns></returns> | |||
public bool ReduceSurplus(string loc) | |||
{ | |||
MaterialInfo materialInfo = materialSurplus.dicSurplus.Find(t => t.Loc == loc); | |||
if (materialInfo != null) | |||
{ | |||
materialInfo.Qty--; | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 余量增加 | |||
/// </summary> | |||
/// <param name="number"></param> | |||
/// <returns></returns> | |||
public bool AddSurplus(string loc) | |||
{ | |||
MaterialInfo materialInfo = materialSurplus.dicSurplus.Find(t => t.Loc == loc); | |||
if (materialInfo != null) | |||
{ | |||
materialInfo.Qty++; | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="newMaterialSurplus"></param> | |||
public void UpdateSurplusAll(List<MaterialInfo> newMaterialSurplus) | |||
{ | |||
if (newMaterialSurplus != null) | |||
{ | |||
List<MaterialInfo> materialInfos = materialSurplus.dicSurplus; | |||
if(materialInfos.Count != newMaterialSurplus.Count) | |||
{ | |||
materialInfos.Clear(); | |||
materialSurplus.dicSurplus = newMaterialSurplus; | |||
} | |||
else | |||
{ | |||
MaterialInfo findMaterial = null; | |||
//遍历旧菜品库,是否与服务器的新菜品库一致 | |||
foreach (MaterialInfo materialInfo in materialSurplus.dicSurplus) | |||
{ | |||
//查找该菜品是否还在 | |||
findMaterial = newMaterialSurplus.Find(t => (t.Id == materialInfo.Id && t.Loc == materialInfo.Loc)); | |||
//不存在则准备移除 | |||
if (findMaterial == null) | |||
{ | |||
//查找该菜品是否还在 | |||
//位置上的菜品可能会更变 | |||
findMaterial = newMaterialSurplus.Find(t => (t.Loc == materialInfo.Loc)); | |||
if (findMaterial != null) | |||
{ | |||
materialInfo.Qty = findMaterial.Qty; | |||
materialInfo.Key = findMaterial.Key; | |||
materialInfo.Id = findMaterial.Id; | |||
materialInfo.Name = findMaterial.Name; | |||
} | |||
} | |||
//存在则更新菜品库数据 | |||
else | |||
{ | |||
materialInfo.Qty = findMaterial.Qty; | |||
materialInfo.Key = findMaterial.Key; | |||
materialInfo.Name = findMaterial.Name; | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
//materialSurplus.dicSurplus.Clear(); | |||
} | |||
} | |||
} | |||
internal class MaterialSurplus | |||
{ | |||
/// <summary> | |||
/// 余量字典,key:菜品库编号,value:余量 | |||
/// </summary> | |||
public List<MaterialInfo> dicSurplus = new List<MaterialInfo>(); | |||
//public MaterialSurplus() | |||
//{ | |||
// //增加新的 | |||
// foreach (var item in MaterialCoordinate.MLNumberList) | |||
// { | |||
// dicSurplus.Add(item, 0); | |||
// } | |||
//} | |||
} | |||
} |
@@ -76,6 +76,7 @@ | |||
<TextBox Text="{Binding RealY}" Width="70" Margin="5,0" VerticalAlignment="Top" IsReadOnly="True"/> | |||
<TextBlock Text="{Binding PawPosition}" Margin="10,0,5,0"/> | |||
<Button Content="菜品库初始化" Margin="10,0,5,0" Command="{Binding FoodLibInit}"/> | |||
<Button Content="菜品库余量检测" Margin="10,0,5,0" Command="{Binding SurplusCheck}"/> | |||
<Button Content="电磁阀启动" Margin="10,0,5,0" Command="{Binding StartElectromagnetism}"/> | |||
<Button Content="电磁阀停止" Margin="10,0,5,0" Command="{Binding StopElectromagnetism}"/> | |||
</WrapPanel> | |||
@@ -86,6 +86,7 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标 | |||
public RelayCommand FoodLibInit { get; set; }//初始化 | |||
public RelayCommand SurplusCheck { get; set; }//初始化 | |||
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动 | |||
public RelayCommand StopElectromagnetism { get; set; } | |||
public RelayCommand SetSpeed { get; set; }//速度设定 | |||
@@ -206,6 +207,7 @@ namespace BPASmartClient.MorkF.ViewModel | |||
#region 菜品控制 | |||
FoodLibInit = new RelayCommand(() => { ActionManage.GetInstance.Send("FoodLibInit"); });//菜品库初始化 | |||
SurplusCheck = new RelayCommand(() => { ActionManage.GetInstance.Send("SurplusCheck"); });//菜品库初始化 | |||
StartElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { false }); });//电磁阀启动 | |||
StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true });});//电磁阀关闭 | |||
SetSpeed = new RelayCommand(() => | |||
@@ -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.84" /> | |||
<PackageReference Include="BPA.Models" Version="1.0.38" /> | |||
<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> |
@@ -0,0 +1,399 @@ | |||
using BPA.Helper; | |||
using BPA.Message.Enum; | |||
using BPA.Models; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Modbus; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.PLC; | |||
using BPASmartClient.Model.订单; | |||
using BPASmartClient.Model.调酒机; | |||
using BPASmartClient.MorkMW.Model; | |||
using Newtonsoft.Json; | |||
using Org.BouncyCastle.Bcpg.OpenPgp; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Net.Http.Json; | |||
using System.Threading; | |||
using System.Windows.Documents; | |||
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); | |||
ServerInit(); | |||
DataParse(); | |||
} | |||
private void ServerInit() | |||
{ | |||
//配方数据信息 | |||
EventBus.EventBus.GetInstance().Subscribe<MorkMWGoodsEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is MorkMWGoodsEvent recipe) | |||
{ | |||
listMorkMWGoods= recipe.morkMWPushMessage.MorkMWGoods; | |||
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods.Count}】个商品配方数据"); | |||
} | |||
}); | |||
} | |||
public override void MainTask() | |||
{ | |||
ToGetWink(); | |||
ToMixWink(); | |||
ToPourWink(); | |||
SignalDetect(); | |||
} | |||
/// <summary> | |||
/// 接酒过程 | |||
/// </summary> | |||
public void ToGetWink() | |||
{ | |||
if (!GVL_MorkMW.AllowLocalSimOrder) | |||
{ | |||
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.Qty); break; | |||
case 2: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break; | |||
case 3: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break; | |||
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) | |||
{ | |||
//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;//调酒完成,允许倒酒 | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal) | |||
{ | |||
DeviceProcessLogShow("订单开始制作"); | |||
morkMW.TaskLock = true; | |||
if (simOrderLocInfos.TryDequeue(out SimOrderLocInfo 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; | |||
} | |||
} | |||
DeviceProcessLogShow($"所有位置接酒完成"); | |||
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);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
case 2: modbus.WriteSingleRegister(0000, 2);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
case 3: modbus.WriteSingleRegister(0000, 3);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
case 4: modbus.WriteSingleRegister(0000, 4);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
case 5: modbus.WriteSingleRegister(0000, 5);DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
case 6: modbus.WriteSingleRegister(0000, 6); DeviceProcessLogShow($"开始接【{loc}】号位置原酒"); break; | |||
} | |||
//等待机器人到达接酒位置 | |||
switch (loc) | |||
{ | |||
case 1: while (!morkMW.ArriveWinkOneLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
case 2: while (!morkMW.ArriveWinkTwoLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
case 3: while (!morkMW.ArriveWinkThreeLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
case 4: while (!morkMW.ArriveWinkFourLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
case 5: while (!morkMW.ArriveWinkFiveLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
case 6: while (!morkMW.ArriveWinkSixLoc) { Thread.Sleep(5); } DeviceProcessLogShow($"机械臂到达【{loc}】号接酒位置"); break; | |||
} | |||
Thread.Sleep(time * 1000);//接酒等待时间 | |||
//发送接酒完成信号 | |||
switch (loc) | |||
{ | |||
case 1: modbus.WriteSingleCoil(4596, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break; | |||
case 2: modbus.WriteSingleCoil(4597, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break; | |||
case 3: modbus.WriteSingleCoil(4598, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break; | |||
case 4: modbus.WriteSingleCoil(4599, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break; | |||
case 5: modbus.WriteSingleCoil(4600, true);DeviceProcessLogShow($"【{loc}】号位置接酒完成"); break; | |||
case 6: modbus.WriteSingleCoil(4601, true); DeviceProcessLogShow($"【{loc}】号位置接酒完成"); 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(); | |||
simOrderLocInfos.Enqueue(new SimOrderLocInfo { 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) | |||
{ | |||
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}】"); | |||
} | |||
} | |||
}); | |||
} | |||
/// <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); | |||
} | |||
/// <summary> | |||
/// 调酒小程序订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> orderLocInfos = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 调酒模拟订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<SimOrderLocInfo> simOrderLocInfos = new ConcurrentQueue<SimOrderLocInfo>(); | |||
/// <summary> | |||
/// 调酒机配方集合 | |||
/// </summary> | |||
public List<MORKMWGoods> listMorkMWGoods = new List<MORKMWGoods>(); | |||
} | |||
} |
@@ -0,0 +1,77 @@ | |||
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 | |||
public static bool AllowLocalSimOrder { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using BPA.Models; | |||
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<MORKMWBoms> mixWink=new List<MORKMWBoms>(); | |||
public string GoodName { get; set; } | |||
} | |||
} |
@@ -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 SimOrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
/// <summary> | |||
/// 单个订单的制作流程 | |||
/// </summary> | |||
public List<MixWinkModel> mixWink = new List<MixWinkModel>(); | |||
public string GoodName { get; set; } | |||
} | |||
} |
@@ -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} }; | |||
} | |||
} |
@@ -0,0 +1,76 @@ | |||
<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}"/> | |||
<CheckBox Content="运行本地模拟程序" Command="{Binding StartLocalSim}" IsChecked="{Binding IsSimOrder}"/> | |||
</StackPanel> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,30 @@ | |||
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(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,69 @@ | |||
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); | |||
}); | |||
StartLocalSim = new RelayCommand(() => { | |||
GVL_MorkMW.AllowLocalSimOrder = IsSimOrder; | |||
}); | |||
} | |||
/// <summary> | |||
/// 模拟订单 | |||
/// </summary> | |||
public RelayCommand<object> SimOrderSetDown { get; set; } | |||
public RelayCommand AddMaterial { get; set; } | |||
public RelayCommand ClearMaterial { get; set; } | |||
public RelayCommand StartLocalSim { get; set; } | |||
public bool IsSimOrder { get; set; } | |||
public SimRecipeModel SimRecipe { get; set; } | |||
public List<int> location { get; set; } = new List<int>() { 1, 2, 3, 4, 5, 6 }; | |||
} | |||
} |
@@ -9,8 +9,8 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Models" Version="1.0.37" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="BPA.Models" Version="1.0.38" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="System.Speech" Version="6.0.0" /> | |||
</ItemGroup> | |||
@@ -9,7 +9,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Models" Version="1.0.37" /> | |||
<PackageReference Include="BPA.Models" Version="1.0.38" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
@@ -19,7 +19,7 @@ | |||
</COMReference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.CustomResource" Version="1.0.16" /> | |||
<PackageReference Include="BPA.CustomResource" Version="1.0.19" /> | |||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" /> | |||
</ItemGroup> | |||
@@ -1,188 +1,189 @@ | |||
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl3" | |||
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.ScreenLib" | |||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | |||
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource" | |||
mc:Ignorable="d" | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Margin="0,10,0,0"> | |||
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start"> | |||
<StackPanel> | |||
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/> | |||
<Grid Height="160" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<TextBlock.Style> | |||
<Style TargetType="TextBlock"> | |||
<Setter Property="Foreground" Value="Lime"></Setter> | |||
<Style.Triggers> | |||
<Trigger Property="Text" Value="停止"> | |||
<Setter Property="Foreground" Value="Red"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</TextBlock.Style> | |||
</TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock> | |||
</StackPanel> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/> | |||
<Grid Height="160"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</GroupBox> | |||
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start"> | |||
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<WrapPanel> | |||
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" > | |||
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock> | |||
</Border> | |||
</WrapPanel> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</GroupBox> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" > | |||
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start"> | |||
<Grid> | |||
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/> | |||
</Grid> | |||
</GroupBox> | |||
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}"> | |||
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Width="250"> | |||
<DataGridTemplateColumn.Header> | |||
<TextBlock Text="信息时间" Foreground="White"/> | |||
</DataGridTemplateColumn.Header> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Width="*"> | |||
<DataGridTemplateColumn.Header> | |||
<TextBlock Text="详细描述" Foreground="White"/> | |||
</DataGridTemplateColumn.Header> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</GroupBox> | |||
</StackPanel> | |||
<StackPanel Grid.Column="2" Margin="0,10,0,0"> | |||
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="5 号档口" Style="{DynamicResource from}" Tag="Start"> | |||
<StackPanel> | |||
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/> | |||
<Grid Height="160" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<TextBlock.Style> | |||
<Style TargetType="TextBlock"> | |||
<Setter Property="Foreground" Value="Lime"></Setter> | |||
<Style.Triggers> | |||
<Trigger Property="Text" Value="停止"> | |||
<Setter Property="Foreground" Value="Red"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</TextBlock.Style> | |||
</TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock> | |||
</StackPanel> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/> | |||
<Grid Height="160"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</GroupBox> | |||
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start"> | |||
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<WrapPanel> | |||
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" > | |||
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock> | |||
</Border> | |||
</WrapPanel> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</GroupBox> | |||
</StackPanel> | |||
</Grid> | |||
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl3" | |||
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.ScreenLib" | |||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | |||
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource" | |||
mc:Ignorable="d" | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Margin="0,10,0,0"> | |||
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start"> | |||
<StackPanel> | |||
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/> | |||
<Grid Height="160" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<TextBlock.Style> | |||
<Style TargetType="TextBlock"> | |||
<Setter Property="Foreground" Value="Lime"></Setter> | |||
<Style.Triggers> | |||
<Trigger Property="Text" Value="停止"> | |||
<Setter Property="Foreground" Value="Red"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</TextBlock.Style> | |||
</TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock> | |||
</StackPanel> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/> | |||
<Grid Height="160"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</GroupBox> | |||
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start"> | |||
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<WrapPanel> | |||
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" > | |||
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock> | |||
</Border> | |||
</WrapPanel> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</GroupBox> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" VerticalAlignment="Bottom" Margin="0,0,0,10"> | |||
<GroupBox x:Name="guanggao" Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start"> | |||
<Grid> | |||
<wv2:WebView2 Name="webView" /> | |||
</Grid> | |||
</GroupBox> | |||
<Grid x:Name="diqiu" Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding ViewData.FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="故障次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding OrderCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid> | |||
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}"> | |||
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Width="250"> | |||
<DataGridTemplateColumn.Header> | |||
<TextBlock Text="信息时间" Foreground="White"/> | |||
</DataGridTemplateColumn.Header> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Width="*"> | |||
<DataGridTemplateColumn.Header> | |||
<TextBlock Text="详细描述" Foreground="White"/> | |||
</DataGridTemplateColumn.Header> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</GroupBox> | |||
</StackPanel> | |||
<StackPanel Grid.Column="2" Margin="0,10,0,0"> | |||
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="5 号档口" Style="{DynamicResource from}" Tag="Start"> | |||
<StackPanel> | |||
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/> | |||
<Grid Height="160" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<TextBlock.Style> | |||
<Style TargetType="TextBlock"> | |||
<Setter Property="Foreground" Value="Lime"></Setter> | |||
<Style.Triggers> | |||
<Trigger Property="Text" Value="停止"> | |||
<Setter Property="Foreground" Value="Red"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</TextBlock.Style> | |||
</TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock> | |||
</StackPanel> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/> | |||
<Grid Height="160"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border> | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</GroupBox> | |||
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start"> | |||
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<WrapPanel> | |||
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" > | |||
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock> | |||
</Border> | |||
</WrapPanel> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</GroupBox> | |||
</StackPanel> | |||
</Grid> | |||
</UserControl> |
@@ -23,8 +23,55 @@ namespace BPASmartClient.ScreenLib | |||
public ScreenSplitMealsControl3() | |||
{ | |||
InitializeComponent(); | |||
this.DataContext = new ScreenSplitMealsControl3ViewModel(); | |||
if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0) | |||
{ | |||
guanggao.Visibility = Visibility.Visible; | |||
diqiu.Visibility = Visibility.Collapsed; | |||
} | |||
else | |||
{ | |||
guanggao.Visibility = Visibility.Collapsed; | |||
diqiu.Visibility = Visibility.Visible; | |||
} | |||
Show(); | |||
} | |||
/// <summary> | |||
/// 点击切换广告 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
try | |||
{ | |||
guanggao.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed; | |||
diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed; | |||
Show(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 显示广告 | |||
/// </summary> | |||
public void Show() | |||
{ | |||
string str = string.Empty; | |||
if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >= 6) | |||
{ | |||
AdDTO dto = Main.GetInstance.SaasRouteReturn?.Find(par => par.Address == "02"); | |||
if (dto != null) | |||
{ | |||
str = dto.Ad; | |||
Main.GetInstance.InitView2(str, webView, guanggao); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -38,6 +38,19 @@ namespace BPASmartClient.ScreenLib | |||
/// 当前刷新数据类型 | |||
/// </summary> | |||
public ScreenDeviceType type = ScreenDeviceType.分餐机; | |||
/// <summary> | |||
/// 订单总数 | |||
/// </summary> | |||
public int OrderCount | |||
{ | |||
get { return _OrderCount; } | |||
set | |||
{ | |||
_OrderCount = value; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private int _OrderCount = 0; | |||
#endregion | |||
public ScreenSplitMealsControl3ViewModel() | |||
@@ -52,6 +65,7 @@ namespace BPASmartClient.ScreenLib | |||
if (modelMaxWok != null && modelMaxWok.Alarm != null) | |||
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList(); | |||
ViewData = modelMaxWok; | |||
OrderCount = modelMaxWok.SplitMeals_CreditCardCount_5 + modelMaxWok.SplitMeals_CreditCardCount_6; | |||
} | |||
})); | |||
Thread.Sleep(1000); | |||
@@ -115,7 +115,7 @@ | |||
<Border x:Name="kaishi" Background="{DynamicResource 椭圆}" BorderBrush="Aqua" Margin="60"/> | |||
<Border Background="{DynamicResource 椭圆}" > | |||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock> | |||
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock> | |||
<TextBlock x:Name="xs" Style="{DynamicResource 数码管Text}" FontSize="24" Margin="0,0,0,0" Text="{Binding Id}"></TextBlock> | |||
</StackPanel> | |||
</Border> | |||
@@ -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,调用接口查询“设备连接信息”--> | |||
@@ -15,6 +15,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<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" /> | |||
@@ -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> | |||
@@ -22,7 +22,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.82" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
@@ -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} | |||
@@ -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; | |||
} | |||
} |
@@ -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(); | |||
} | |||
} | |||
} |
@@ -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)); | |||
} | |||
} | |||
} |
@@ -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> | |||