diff --git a/BPASmartClient.CustomResource/Pages/Model/Config.cs b/BPASmartClient.CustomResource/Pages/Model/Config.cs
index e07be50c..cf2e3fe3 100644
--- a/BPASmartClient.CustomResource/Pages/Model/Config.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/Config.cs
@@ -38,7 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
private void AddData()
{
- Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); ;
+ Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); ;
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
diff --git a/BPASmartClient.JXJFoodBigStation/App.config b/BPASmartClient.JXJFoodBigStation/App.config
new file mode 100644
index 00000000..5ff78b1a
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/App.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml b/BPASmartClient.JXJFoodBigStation/App.xaml
new file mode 100644
index 00000000..07a8c441
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/App.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs
new file mode 100644
index 00000000..02b20491
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/App.xaml.cs
@@ -0,0 +1,180 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using BPASmartClient.CustomResource.Pages.Enums;
+using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.CustomResource.Pages.View;
+using BPASmartClient.CustomResource.Pages.ViewModel;
+using BPASmartClient.Helper;
+using BPASmartClient.JXJFoodBigStation.Model;
+using BPASmartClient.Nfc;
+
+namespace BPASmartClient.JXJFoodBigStation
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ public static Window MainWindow;
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+ MenuInit();
+ DataInit();
+ ProcessControl.GetInstance.Init();
+ MainView mv = new MainView();
+ //mv.Show();
+ LoginView lv = new LoginView();
+ var res = lv.ShowDialog();
+ if (res != null && res == true)
+ {
+ MessageLog.GetInstance.ShowUserLog("用户登录");
+ mv.Show();
+ }
+ else
+ mv.Close();
+ MainWindow = mv;
+ }
+
+ protected override void OnExit(ExitEventArgs e)
+ {
+ base.OnExit(e);
+ MessageLog.GetInstance.LogSave();
+ ThreadManage.GetInstance().Dispose();
+ }
+
+ private void MenuInit()
+ {
+ NfcServer.GetInstance.Init();
+
+ #region 配方管理菜单
+ ObservableCollection RecipeManage = new ObservableCollection();
+ RecipeManage.Add(new SubMenumodel()
+ {
+ SubMenuName = "服务配方管理",
+ SubMenuPermission = new Permission[] { Permission.管理员 },
+ AssemblyName = "BPASmartClient.JXJFoodBigStation",
+ ToggleWindowPath = "View.RecipeReceiveView"
+ });
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "配方管理",
+ Alias = "Recipe Management",
+ subMenumodels = RecipeManage,
+ });
+ #endregion
+
+ #region 消息日志
+ ObservableCollection InfoLog = new ObservableCollection();
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "操作日志",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.UserLogView"
+ });
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "运行日志",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.RunLogView"
+ });
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "报警记录",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.AlarmView"
+ });
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "调试日志",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.DebugLogView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "消息日志",
+ Alias = "Message Log",
+ subMenumodels = InfoLog,
+ });
+ #endregion
+
+ #region 硬件设备监控
+ ObservableCollection DeviceMonitor = new ObservableCollection();
+ DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "原料设备列表",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.DosingSystem",
+ ToggleWindowPath = "View.DeviceListView"
+ });
+
+ DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "设备状态",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.DosingSystem",
+ ToggleWindowPath = "View.HardwareStatusView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "设备监控",
+ Alias = "Device Monitor",
+ subMenumodels = DeviceMonitor,
+ });
+ #endregion
+
+ #region 用户管理
+ ObservableCollection UserManager = new ObservableCollection();
+ UserManager.Add(new SubMenumodel()
+ {
+ SubMenuName = "用户登录",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.SubPagLoginView"
+ });
+
+ UserManager.Add(new SubMenumodel()
+ {
+ SubMenuName = "密码修改",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.PasswordChangeView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "用户管理",
+ Alias = "User Management",
+ subMenumodels = UserManager,
+ });
+ #endregion
+ }
+
+ private void DataInit()
+ {
+ Config.GetInstance.Init();
+ //Json.Read();
+ }
+
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/AssemblyInfo.cs b/BPASmartClient.JXJFoodBigStation/AssemblyInfo.cs
new file mode 100644
index 00000000..8b5504ec
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
new file mode 100644
index 00000000..18cc382e
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
@@ -0,0 +1,30 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
+
+ $(DefaultXamlRuntime)
+ Designer
+
+
+ $(DefaultXamlRuntime)
+ Designer
+
+
+ $(DefaultXamlRuntime)
+ Designer
+
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs
new file mode 100644
index 00000000..864395d9
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class DeviceCurrentStatus : ObservableObject
+ {
+
+ public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } }
+ private double _mWeight;
+
+
+ public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } }
+ private bool _mRunStatus;
+
+
+ public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
+ private string _mDeviceName;
+
+
+
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs
new file mode 100644
index 00000000..df85bc0c
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs
@@ -0,0 +1,41 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Modbus;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
+{
+ public class DataComm
+ {
+ public volatile static DataComm Instance;
+ public static DataComm GetInstance => Instance ?? (new DataComm());
+ public DataComm() { }
+ ///
+ /// 是否允许配料
+ ///
+ public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } }
+ private bool _mIsAllowDosing;
+
+ public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } }
+ private bool _mDosingFinishToPLC;
+
+ private int _mStockBinLocationToPLC;
+ public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } }
+
+ public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } }
+ private bool _mStatusSignToBPA;
+
+ private int _mStockBinLocationToBPA;
+ public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } }
+
+ private int _mBarrelNumToPLC;
+ public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } }
+
+ /*public ConcurrentDictionary DeviceLists = new ConcurrentDictionary();*/
+ }
+
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
new file mode 100644
index 00000000..7b5fbaa2
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
@@ -0,0 +1,74 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Modbus;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
+{
+ public class HKDeviceStatus
+ {
+ public ModbusTcp ModBusHK = new ModbusTcp();
+ public string IpAddress => ModBusHK.IPAdress;
+ public bool IsConnected => ModBusHK.Connected;
+
+ public void Init()
+ {
+ if (IsConnected)
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+
+ }),"信号收发处理");
+ }
+ }
+ ///
+ /// 单个配料机配料完成
+ ///
+ ///
+ public void SingleDosing(uint value)
+ {
+ if (IsConnected)
+ {
+ ModBusHK.SetUint(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
+ ModBusHK.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
+ }
+ }
+ ///
+ /// 复位plc允许接料信号
+ ///
+ public void AllowDosingSignReset()
+ {
+ ModBusHK.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
+ }
+ ///
+ /// 复位plc到达某料仓信号
+ ///
+ public void StockStateSignReset()
+ {
+ ModBusHK.Write(HKPlcCommAddress.StockState, (ushort)0);
+ }
+ ///
+ /// 复位一个配方配料完成信号
+ ///
+ public void RecipeDosingFinishReset()
+ {
+ ModBusHK.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
+ }
+ ///
+ /// 下发配方数据
+ ///
+ /// 单个桶的编号
+ /// 单个桶对应的料仓位置
+ public void StockBinPar(uint BarrelNum, ushort StockBinLocation)
+ {
+ if (IsConnected)
+ {
+ ModBusHK.SetUint(HKPlcCommAddress.BarrelNumToPLC, BarrelNum);
+ ModBusHK.Write(HKPlcCommAddress.StockBinLocationToPLC, StockBinLocation);
+ }
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
new file mode 100644
index 00000000..4cb3917d
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
+{
+ public class HKPlcCommAddress
+ {
+ #region 海科PLC ==> 上位机
+ ///
+ /// 是否允许配料
+ ///
+ public static string IsAllowDosing { get; set; } = "";
+ ///
+ /// 当前料仓位置
+ ///
+ public static string StockBinLocation { get; set; } = "";
+ ///
+ /// 当前料仓的状态(0:无意义,1:到达接料位置)
+ ///
+ public static string StockState { get; set; } = "";
+ #endregion
+
+ #region 上位机 ==> 海科PLC
+ ///
+ /// 料仓位置(配置该配方,所需要多个原料桶,每个原料桶有多个料仓位置)
+ ///
+ public static string StockBinLocationToPLC { get; set; } = "";
+ ///
+ /// 对应桶号
+ ///
+ public static string BarrelNumToPLC { get; set; } = "";
+ ///
+ /// 当前配料机配料完成
+ ///
+ public static string SingleDosingFinishToPLC { get; set; } = "";
+ ///
+ /// 当前配料料仓的位置
+ ///
+ public static string SingleStockBinLocationToPLC { get; set; } = "";
+
+ public static string RecipeDosingFinish { get; set; } = "";
+ #endregion
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
new file mode 100644
index 00000000..e3008fd8
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
@@ -0,0 +1,154 @@
+using BPASmartClient.Helper;
+using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
+using BPASmartClient.JXJFoodBigStation.Model.Siemens;
+using BPASmartClient.Modbus;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class ProcessControl
+ {
+ private volatile static ProcessControl _Instance;
+ public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
+ private ProcessControl() { }
+
+ public ObservableCollection RemoteRecipes;
+ ConcurrentQueue RecipeQueue = new ConcurrentQueue();
+ ConcurrentQueue DeviceQueue = new ConcurrentQueue();
+ public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
+ public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
+ public HKDeviceStatus HKDevice = new HKDeviceStatus();
+ public void Init()
+ {
+ string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
+ string HK_PLC_Port = ConfigurationManager.AppSettings["HKPlc_Port"];
+ string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
+ string Siemens_PLC_Port = ConfigurationManager.AppSettings["Siemens_Port"];
+ Task.Run(new Action(() =>
+ {
+ HKDevice.ModBusHK.ModbusTcpConnect(HK_PLC_IP, int.Parse(HK_PLC_Port));
+ SiemensDevice.SiemensTcp.ModbusTcpConnect(Siemens_PLC_IP, int.Parse(Siemens_PLC_Port));
+ if (HKDevice.IsConnected)
+ {
+ HKDevice.Init();
+ }
+ if (SiemensDevice.IsConnected)
+ {
+ SiemensDevice.Init();
+ }
+ }));
+ ActionManage.GetInstance.Register(new Action(()=>
+ {
+
+ }), "给流水线下发配方数据", true);
+ ActionManage.GetInstance.Register(new Action(() =>
+ {
+ if (SiemensDevice.IsConnected)
+ {
+ var res = SiemensDevice.SiemensTcp.GetString(SiemensCommAddress.RecipeName, (ushort)20);
+ var res1 = SiemensDevice.SiemensTcp.Read(SiemensCommAddress.RecipeID);
+ var res2 = SiemensDevice.SiemensTcp.Read(SiemensCommAddress.RawMaterial);
+ if ((res != null && res is string recipeName) &&
+ (res1 != null && res1 is uint recipeID) &&
+ (res2 != null && res2 is ushort[] rawMaterial))
+ {
+ RawMaterials.Clear();
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ RawMaterialBarrelNum = rawMaterial[0],
+ RawMaterialLocation= rawMaterial[1],
+ RawMaterialWeight= rawMaterial[2]
+ });
+ Json.Data.Recipes.Add(new RemoteRecipeData()
+ {
+ RecipeName = recipeName,
+ RecipeCode = recipeID,
+ RawMaterial = RawMaterials
+ });
+ }
+ }
+ }), "西门子下发配方", true);
+ ActionManage.GetInstance.Register(new Action(() =>
+ {
+ if (SiemensDevice.IsConnected)
+ {
+ var res = SiemensDevice.SiemensTcp.Read(SiemensCommAddress.TrayLocationNum);
+ var res1 = SiemensDevice.SiemensTcp.Read(SiemensCommAddress.RecipeID);
+ if (res != null && res is int TrayLocation && res1 != null && res1 is int recipeId)
+ {
+ int index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeCode == recipeId);
+ if (index >= 0 && index < Json.Data.Recipes.Count)
+ {
+ Json.Data.Recipes.ElementAt(index).TrayCode = TrayLocation;
+ }
+ }
+ }
+ }), "AGV到位信号", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
+
+ RecipeQueue.Clear();
+ ReceviceData();
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ RecipeInfoToHKPLC();
+ }), "流程处理", true);
+ }
+
+ private void ReceviceData()
+ {
+ RemoteRecipes = Json.Data.Recipes;
+ RawMaterials = TestData.GetInstance.RawMaterials;//添加测试数据
+ if (Json.Data.Recipes.Count > 0)
+ {
+ foreach (var data in Json.Data.Recipes)
+ {
+ if(!(RecipeQueue.Contains(data.RecipeCode)))
+ RecipeQueue.Enqueue(data.RecipeCode);
+ }
+ }
+ }
+ ///
+ /// 当前料仓的位置
+ ///
+ private int StockInIsWork;
+ ///
+ /// 单个配方执行完成标志
+ ///
+ private bool RecipeFinfish;
+ private void RecipeInfoToHKPLC()
+ {
+ if (RecipeQueue.Count > 0)
+ {
+ int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0));
+ if (index >= 0 && index <= RemoteRecipes.Count)
+ {
+ long code = RemoteRecipes.ElementAt(index).RecipeCode;
+ if (RTrig.GetInstance("IsAllowDosing").Start(HKDevice.ModBusHK.Read(HKPlcCommAddress.IsAllowDosing) is bool a))
+ {
+ foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
+ {
+ HKDevice.StockBinPar((uint)item.RawMaterialBarrelNum, (ushort)item.RawMaterialLocation);
+ }
+ HKDevice.AllowDosingSignReset();
+
+ }
+
+ if (RTrig.GetInstance("StockState").Start(HKDevice.ModBusHK.Read(HKPlcCommAddress.RecipeDosingFinish) is bool))
+ {
+ HKDevice.RecipeDosingFinishReset();
+ RecipeQueue.TryDequeue(out code);
+ }
+ }
+ }
+ }
+ private void HKPLCIsWork()
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs
new file mode 100644
index 00000000..19d26ded
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class RemoteRecipeData
+ {
+ ///
+ /// 配方名称
+ ///
+ public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; } }
+ private string _mRecipeName;
+
+ ///
+ /// 配方ID
+ ///
+ public long RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; } }
+ private long _mRecipeCode;
+
+ ///
+ /// 托盘编号
+ ///
+ public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; } }
+ private int _mTrayCode;
+
+ ///
+ /// 原料数据
+ ///
+ public ObservableCollection RawMaterial { get; set; } = new ObservableCollection();
+
+
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs
new file mode 100644
index 00000000..0d65fdad
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
+{
+ public class RemoteRecipeDataColl
+ {
+ public ObservableCollection Recipes { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs
new file mode 100644
index 00000000..47112da9
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class RemoteRecipeRawMaterial
+ {
+ private int _mIp;
+ public int DeviceIp { get { return _mIp; } set { _mIp = value; } }
+
+ private int _mRawMaterialBarrelNum;
+ ///
+ /// 原料对应的桶号
+ ///
+ public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; } }
+
+ private double _mRawMaterialWeight;
+ ///
+ /// 需要原料重量
+ ///
+ public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value;} }
+
+
+ private int _mRawMaterialLocation;
+ ///
+ /// 原料对应料仓的位置
+ ///
+ public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;} }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs
new file mode 100644
index 00000000..8288bc9b
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
+{
+ public class SiemensCommAddress
+ {
+ #region 配方地址
+ ///
+ /// 配方状态
+ ///
+ public static string RecipeState { get; set; } = "";
+ ///
+ /// 配方名称
+ ///
+ public static string RecipeName { get; set; } = "";
+ ///
+ /// 配方ID
+ ///
+ public static string RecipeID { get; set; } = "";
+ ///
+ /// 原料信息
+ ///
+ public static string RawMaterial { get; set; } = "";
+ #endregion
+
+ #region AGV到位(与西门子PLC交互)西门子PLC ==> 上位机
+ public static string TrayLocationNum { get; set; } = "";
+ public static string TrayRecipeID { get; set; } = "";
+ public static string TrayState { get; set; } = "";
+ #endregion
+
+ #region Tray配料完成(与西门子PLC交互)上位机 ==> 西门子PLC
+ public static string TrayLocationNumToPLC { get; set; } = "";
+ public static string TrayRecipeIDToPLC { get; set; } = "";
+ public static string TrayStateToPLC { get; set; } = "";
+ #endregion
+ }
+
+
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
new file mode 100644
index 00000000..ac0106bf
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
@@ -0,0 +1,64 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Modbus;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
+{
+ public class SiemensDeviceStatus
+ {
+ public ModbusTcp SiemensTcp = new ModbusTcp();
+ public bool IsConnected => SiemensTcp.Connected;
+ public string IpAddress => SiemensTcp.IPAdress;
+
+ ///
+ /// 配方接收信号复位
+ ///
+ public void RecipeSignReset()
+ {
+ this.SiemensTcp.Write(SiemensCommAddress.RecipeState, (ushort)0);
+ }
+ ///
+ /// AGV到位信号复位
+ ///
+ public void AgvSignReset()
+ {
+ this.SiemensTcp.Write(SiemensCommAddress.TrayState, (ushort)0);
+ }
+ public void Init()
+ {
+ if (IsConnected)
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ var res = this.SiemensTcp.Read(SiemensCommAddress.RecipeState);
+ if (res != null && RTrig.GetInstance("RecipeTrig").Start(res is bool SignTrig))
+ {
+ ActionManage.GetInstance.Send("西门子下发配方");
+ RecipeSignReset();
+ }
+ var AgvState = this.SiemensTcp.Read(SiemensCommAddress.TrayState);
+ if (AgvState != null && RTrig.GetInstance("AgvTrig").Start(res is bool AgvSignTrig))
+ {
+ ActionManage.GetInstance.Send("AGV到位信号");
+ AgvSignReset();
+ }
+ }),"监听服务数据");
+ }
+ }
+ ///
+ /// 配方配料完成信号
+ ///
+ ///
+ ///
+ private void DosingFinsih(int TrayLocation,int recipeID)
+ {
+ this.SiemensTcp.Write(SiemensCommAddress.TrayLocationNumToPLC, TrayLocation);
+ this.SiemensTcp.Write(SiemensCommAddress.TrayStateToPLC, 1);
+ this.SiemensTcp.Write(SiemensCommAddress.TrayRecipeIDToPLC, recipeID);
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/TestData.cs b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs
new file mode 100644
index 00000000..d28bf9d5
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs
@@ -0,0 +1,111 @@
+using BPASmartClient.Helper;
+using BPASmartClient.JXJFoodBigStation.Model.Siemens;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class TestData
+ {
+ public volatile static TestData Instance;
+ public static TestData GetInstance => Instance ?? (Instance = new TestData());
+ public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
+ public TestData()
+ {
+ string recipeName = "配方1";
+ long recipeCode = 10001;
+ int Traycode = 1;
+
+ double RawmaterialWeight = 10;
+ int RawMaterialbarrelNum = 1;
+ int RawMaterialLocation = 5;
+
+ double RawmaterialWeight1 = 20;
+ int RawMaterialbarrelNum1 = 2;
+ int RawMaterialLocation1 = 7;
+
+ double RawmaterialWeight2 = 30;
+ int RawMaterialbarrelNum2 = 3;
+ int RawMaterialLocation2 = 9;
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight,
+ RawMaterialBarrelNum = RawMaterialbarrelNum,
+ RawMaterialLocation = RawMaterialLocation
+ });
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight1,
+ RawMaterialBarrelNum = RawMaterialbarrelNum1,
+ RawMaterialLocation = RawMaterialLocation1
+ });
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight2,
+ RawMaterialBarrelNum = RawMaterialbarrelNum2,
+ RawMaterialLocation = RawMaterialLocation2
+ });
+
+ Json.Data.Recipes.Add(new Model.RemoteRecipeData()
+ {
+ RecipeName = recipeName,
+ RecipeCode = recipeCode,
+ TrayCode = Traycode,
+ RawMaterial = RawMaterials
+ });
+
+ RawMaterials.Clear();
+ string recipeName_2 = "配方2";
+ long recipeCode_2 = 20001;
+ int Traycode_2 = 3;
+
+ double RawmaterialWeight_2 = 10;
+ int RawMaterialbarrelNum_2 = 1;
+ int RawMaterialLocation_2 = 5;
+
+ double RawmaterialWeight1_2 = 20;
+ int RawMaterialbarrelNum1_2 = 2;
+ int RawMaterialLocation1_2 = 7;
+
+ double RawmaterialWeight2_2 = 30;
+ int RawMaterialbarrelNum2_2 = 3;
+ int RawMaterialLocation2_2 = 9;
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight_2,
+ RawMaterialBarrelNum = RawMaterialbarrelNum_2,
+ RawMaterialLocation = RawMaterialLocation_2
+ });
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight1_2,
+ RawMaterialBarrelNum = RawMaterialbarrelNum1_2,
+ RawMaterialLocation = RawMaterialLocation1_2
+ });
+ RawMaterials.Add(new RemoteRecipeRawMaterial()
+ {
+ DeviceIp = RawMaterials.Count + 1,
+ RawMaterialWeight = RawmaterialWeight2_2,
+ RawMaterialBarrelNum = RawMaterialbarrelNum2_2,
+ RawMaterialLocation = RawMaterialLocation2_2
+ });
+
+ Json.Data.Recipes.Add(new Model.RemoteRecipeData()
+ {
+ RecipeName = recipeName_2,
+ RecipeCode = recipeCode_2,
+ TrayCode = Traycode_2,
+ RawMaterial = RawMaterials
+ });
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
new file mode 100644
index 00000000..833cae7a
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml.cs b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml.cs
new file mode 100644
index 00000000..5be01d0b
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml.cs
@@ -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.JXJFoodBigStation.View
+{
+ ///
+ /// HardwareStatusView.xaml 的交互逻辑
+ ///
+ public partial class HardwareStatusView : UserControl
+ {
+ public HardwareStatusView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
new file mode 100644
index 00000000..4256a586
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 小料
+
+
+
+
+
+
+
+
+
+
+
+ 原料桶号
+ 原料位置
+ 原料重量
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml.cs b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml.cs
new file mode 100644
index 00000000..5742f815
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml.cs
@@ -0,0 +1,31 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.JXJFoodBigStation.View
+{
+ ///
+ /// NewRecipeView.xaml 的交互逻辑
+ ///
+ public partial class RecipeInfosView : Window
+ {
+ public RecipeInfosView()
+ {
+ InitializeComponent();
+
+ ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView");
+ ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView");
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
new file mode 100644
index 00000000..2713578d
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml.cs b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml.cs
new file mode 100644
index 00000000..6201e8df
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+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.JXJFoodBigStation.View
+{
+ ///
+ /// RecipeSettingsView.xaml 的交互逻辑
+ ///
+ public partial class RecipeReceiveView : UserControl
+ {
+ public RecipeReceiveView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
new file mode 100644
index 00000000..4a082b5f
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.Concurrent;
+using System.Collections.ObjectModel;
+using System.Windows;
+using BPASmartClient.Helper;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.JXJFoodBigStation.Model;
+
+namespace BPASmartClient.JXJFoodBigStation.ViewModel
+{
+ public class HardwareStatusViewModel : ObservableObject
+ {
+ public HardwareStatusViewModel()
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
+ {
+ DeviceName = i.ToString(),
+ RunStatus = false,
+ Weight = new Random().Next(0, 100)
+ });
+ }
+ }
+
+ public ObservableCollection TopDeviceCurrentStatuses { get; set; } = new ObservableCollection();
+ public ObservableCollection BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
new file mode 100644
index 00000000..65ad9e20
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.Helper;
+using BPASmartClient.JXJFoodBigStation.Model;
+using BPASmartClient.CustomResource.Pages.Model;
+
+namespace BPASmartClient.JXJFoodBigStation.ViewModel
+{
+ public class RecipeInfosViewModel : ObservableObject
+ {
+ public RecipeInfosViewModel()
+ {
+ ActionManage.GetInstance.Register(new Action