diff --git a/BPASmartClient.AgvApi/Properties/launchSettings.json b/BPASmartClient.AgvApi/Properties/launchSettings.json index 821e5716..520b6845 100644 --- a/BPASmartClient.AgvApi/Properties/launchSettings.json +++ b/BPASmartClient.AgvApi/Properties/launchSettings.json @@ -1,23 +1,23 @@ -{ +{ "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:38659", - "sslPort": 0 + "applicationUrl": "http://localhost:50969/", + "sslPort": 44385 } }, "profiles": { "BPASmartClient.AgvApi": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5175", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:5175", + "dotnetRunMessages": true }, "IIS Express": { "commandName": "IISExpress", @@ -28,4 +28,4 @@ } } } -} +} \ No newline at end of file diff --git a/BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs b/BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs index 7a052229..c8f7eea0 100644 --- a/BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs +++ b/BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs @@ -120,7 +120,7 @@ namespace BPASmartClient.DosingSystemSingle ThreadManage.GetInstance().StartLong(new Action(() => { if (IPQueues.Count >= IPLists.Count) - IpAddressLines(); + //IpAddressLines(); Thread.Sleep(5000); }), "配料机设备上线监听", true); } @@ -372,9 +372,11 @@ namespace BPASmartClient.DosingSystemSingle var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed); if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5; prop6: + res.SiloUpperLimitWeight = (int)res.SiloUpperLimitWeight + 1; modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight); - if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6; + Thread.Sleep(1000); + /*if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString())*/ goto prop6; prop7: modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo); diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs index cd559cf7..6c3282c2 100644 --- a/BPASmartClient.JXJFoodBigStation/App.xaml.cs +++ b/BPASmartClient.JXJFoodBigStation/App.xaml.cs @@ -91,7 +91,23 @@ namespace BPASmartClient.JXJFoodBigStation subMenumodels = RecipeManage, }); #endregion - + #region 料仓管理 + ObservableCollection StockBinManage = new ObservableCollection(); + StockBinManage.Add(new SubMenumodel() + { + SubMenuName = "料仓原料配置", + SubMenuPermission = new Permission[] { Permission.管理员 }, + AssemblyName = "BPASmartClient.JXJFoodBigStation", + ToggleWindowPath = "View.StockBinRawMaterialView" + }); + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "料仓管理", + Alias = "Recipe Management", + subMenumodels = StockBinManage, + }); + #endregion #region 消息日志 ObservableCollection InfoLog = new ObservableCollection(); InfoLog.Add(new SubMenumodel() diff --git a/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj index a25c4d61..bbf2290a 100644 --- a/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj +++ b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj @@ -31,6 +31,9 @@ True Settings.settings + + Code + Code @@ -48,6 +51,10 @@ $(DefaultXamlRuntime) Designer + + $(DefaultXamlRuntime) + Designer + $(DefaultXamlRuntime) Designer diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs index 4edb4386..b311851b 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs @@ -13,7 +13,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC /// public bool HeartBeat { get; set; } /// - /// 配方锁定(暂时不使用) + /// 订单类型(false:正常工单执行 true:洗桶) /// public bool RecipeLock { get; set; } /// diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs index 2248ce6d..23dbd280 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs @@ -231,7 +231,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model }), "西门子配方执行流程", true); } private void LocalRecipeRecevice() - { + { if (LocalRecipes.Count > 0) { foreach (var data in LocalRecipes) @@ -1504,7 +1504,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model RawMaterialsInfo.Clear(); if (GVL_BigStation.IsUseLocalName) { - RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0007", RawMaterialLocation = 1 });//香菇丁 RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0015", RawMaterialLocation = 2 });//竹笋丁 RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//卤牛肉丁 diff --git a/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml b/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml new file mode 100644 index 00000000..ef94f4c8 --- /dev/null +++ b/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml.cs b/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml.cs new file mode 100644 index 00000000..61e25f65 --- /dev/null +++ b/BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.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 +{ + /// + /// HKPlcCommMonitor.xaml 的交互逻辑 + /// + public partial class StockBinRawMaterialView : UserControl + { + public StockBinRawMaterialView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs new file mode 100644 index 00000000..5a39a510 --- /dev/null +++ b/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs @@ -0,0 +1,42 @@ +using BPASmartClient.Helper; +using BPASmartClient.JXJFoodBigStation.Model; +using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace BPASmartClient.JXJFoodBigStation.ViewModel +{ + public class StockBinRawMaterialViewModel : ObservableObject + { + public StockBinRawMaterialViewModel() + { + RawMaterialInfo = ProcessControl.GetInstance.RawMaterialsInfo; + int serialNum = 0; + foreach (var rawMaterialInfo in RawMaterialInfo) + { + serialNum = serialNum + 1; + rawMaterialInfo.RawMaterialCount = (short)serialNum; + } + RemoveCommand = new RelayCommand((loc) => + { + var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == loc); + if(res!= null) RawMaterialInfo.Remove(res); + }); + } + public ObservableCollection RawMaterialInfo { get; set; } = new ObservableCollection(); + + public RelayCommand DetailsCommand { get; set; } + public RelayCommand RemoveCommand { get; set; } + public RelayCommand SaveRawMaterialPara { get; set; } + public RelayCommand UpdateMaterial { get; set; } + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs index 73615e77..312b269d 100644 --- a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs +++ b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs @@ -124,6 +124,14 @@ namespace BPASmartClient.JXJFoodSmallStation AssemblyName = "BPASmartClient.JXJFoodSmallStation", ToggleWindowPath = "View.WindSendParView" }); + ParSet.Add(new SubMenumodel() + { + SubMenuName = "系统参数设置", + SubMenuPermission = new Permission[] { Permission.管理员 }, + AssemblyName = "BPASmartClient.JXJFoodSmallStation", + ToggleWindowPath = "View.SystemParView" + }); + MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", @@ -142,14 +150,14 @@ namespace BPASmartClient.JXJFoodSmallStation AssemblyName = "BPASmartClient.JXJFoodSmallStation", ToggleWindowPath = "View.ManualControlView" }); - ManualControl.Add(new SubMenumodel() + /*ManualControl.Add(new SubMenumodel() { SubMenuName = "手动控制信号", SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, AssemblyName = "BPASmartClient.JXJFoodSmallStation", ToggleWindowPath = "View.ManualCommView" - }); + });*/ ManualControl.Add(new SubMenumodel() { SubMenuName = "手动控制流程", diff --git a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj index cff86372..65130edf 100644 --- a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj +++ b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj @@ -50,6 +50,10 @@ $(DefaultXamlRuntime) Designer + + $(DefaultXamlRuntime) + Designer + $(DefaultXamlRuntime) Designer diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs index 977e1c62..72e17586 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs @@ -60,15 +60,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model /// public static int SiemensSendRecipeStatus { get; set; } = 0; /// - /// 往输送带下发配方完成 - /// - public bool IssueRecipeFinishStation1 { get; set; } = false; - - /// - /// 往输送带下发配方完成 - /// - public bool IssueRecipeFinishStation2 { get; set; } = false; - /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// public int RecipeStatusID { get; set; } = 0; @@ -136,7 +127,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model /// 粉料仓配料完成 /// public static bool WindSendDosingComple { get; set; } = false; - + /// + /// 系统模式 + /// + public static bool SystemMode { get; set; } = false; + /// + /// 系统状态 + /// + public static bool SystemStatus { get; set; } = false; + /// + /// 系统运行状态 + /// + public static bool SystemRunStatus { get; set; } = false; #endregion } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Par/ConnectParMode.cs b/BPASmartClient.JXJFoodSmallStation/Model/Par/ConnectParMode.cs new file mode 100644 index 00000000..a9d552d9 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/Model/Par/ConnectParMode.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Toolkit.Mvvm.ComponentModel; + +namespace BPASmartClient.JXJFoodSmallStation.Model.Par +{ + public class ConnectParMode: ObservableObject + { + public bool SiemensConnect { get { return _mSiemensConnect; } set { _mSiemensConnect = value; OnPropertyChanged(); } } + private bool _mSiemensConnect; + public bool WindSendConnect { get { return _mWindSendConnect; } set { _mWindSendConnect = value; OnPropertyChanged(); } } + private bool _mWindSendConnect; + public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } } + private bool _mHKPlcConnect; + + public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } } + private short _mAxisLoadSpeed; + public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } } + private short _mAxisMidSpeed; + public short AxisUnLoadSpeed { get { return _mAxisUnLoadSpeed; } set { _mAxisUnLoadSpeed = value; OnPropertyChanged(); } } + private short _mAxisUnLoadSpeed; + public float Axis1Speed { get { return _mAxis1Speed; } set { _mAxis1Speed = value; OnPropertyChanged(); } } + private float _mAxis1Speed; + public float Axis2Speed { get { return _mAxis2Speed; } set { _mAxis2Speed = value; OnPropertyChanged(); } } + private float _mAxis2Speed; + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs index d75ee1f5..189889f9 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs @@ -172,9 +172,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model try { - HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); - SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); - WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); + if (Json.Data.deviceConnectPar.HKPlcConnect) + { + HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); + } + if (Json.Data.deviceConnectPar.SiemensConnect) + { + SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); + } + if (Json.Data.deviceConnectPar.WindSendConnect) + { + WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); + } if (HKDevice.IsConnected) { HKDevice.Init(); @@ -196,67 +205,84 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } ThreadManage.GetInstance().StartLong(new Action(() => { - if (!HKDevice.IsConnected) + if (!HKDevice.IsConnected && Json.Data.deviceConnectPar.HKPlcConnect) { HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接"); if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功"); } - if (!SiemensDevice.IsConnected) + if (!SiemensDevice.IsConnected && Json.Data.deviceConnectPar.SiemensConnect) { SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接"); if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功"); } - if (!WindSendDevice.IsConnected) + if (!WindSendDevice.IsConnected && Json.Data.deviceConnectPar.WindSendConnect) { WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功"); } Thread.Sleep(50); }), "设备连接", true); - ActionManage.GetInstance.CancelRegister("SystemStart"); - ActionManage.GetInstance.Register(new Action(() => - { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.0", true); - }), "SystemStart", true); - ActionManage.GetInstance.CancelRegister("SystemStop"); - ActionManage.GetInstance.Register(new Action(() => - { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.0", false); - }), "SystemStop", true); - ActionManage.GetInstance.CancelRegister("SystemPause"); - ActionManage.GetInstance.Register(new Action(() => - { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.2", true); - }), "SystemPause", true); - ActionManage.GetInstance.CancelRegister("ManualSystemReset"); - ActionManage.GetInstance.Register(new Action(() => + RecipeQueue.Clear(); + //手动控制系统模式 + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.0", true); }), "SystemStart", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.0", false); }), "SystemStop", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.2", true); }), "SystemPause", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.2", false); }), "SystemReset", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.1", false); }), "SystemAutoMode", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.1", true); }), "SystemDebugMode", true); + //流程控制 + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.3", true); }), "ManualSystemReset", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB44.DBX0.4", true); }), "CLearRecipeInfo", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB4.DBX0.7", true); }), "AGVPutTrayFinish", true); + //手动控制电机轴 + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX4.6", true); }), "StartAxisLoadCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX4.6", false); }), "StopAxisLoadCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX4.7", true); }), "StartAxisMidCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX4.7", false); }), "StopAxisMidCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.0", true); }), "StartAxisUnLoadCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.0", false); }), "StopAxisUnLoadCommand", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.1", true); }), "StartAxis1Command", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.1", false); }), "StopAxis1Command", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.2", true); }), "StartAxis2Command", true); + ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write("DB5.DBX5.2", false); }), "StopAxis2Command", true); + //电机速度 + ActionManage.GetInstance.Register(new Action((o) => { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.2", false); - //DeviceInquire.GetInstance.GetDevice((int)8)?.Start((float)100.1); - }), "ManualSystemReset", true); - - ActionManage.GetInstance.CancelRegister("SystemAutoMode"); - ActionManage.GetInstance.Register(new Action(() => + if (o != null && o is short value) + { + HKDevice.HK_PLC_S7.Write("DB47.DBD8", value); + } + }), "AxisLoadSpeedSet", true); + ActionManage.GetInstance.Register(new Action((o) => { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.1", false); - }), "SystemAutoMode", true); - ActionManage.GetInstance.CancelRegister("SystemDebugMode"); - ActionManage.GetInstance.Register(new Action(() => + if (o != null && o is short value) + { + HKDevice.HK_PLC_S7.Write("DB47.DBD10", value); + } + }), "AxisMidSpeedSet", true); + ActionManage.GetInstance.Register(new Action((o) => { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.1", true); - }), "SystemDebugMode", true); - RecipeQueue.Clear(); - ActionManage.GetInstance.Register(new Action(() => + if (o != null && o is short value) + { + HKDevice.HK_PLC_S7.Write("DB47.DBD12", value); + } + }), "AxisUnLoadSpeedSet", true); + ActionManage.GetInstance.Register(new Action((o) => { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.3", true); - }), "SystemReset", true); - RecipeQueue.Clear(); - ActionManage.GetInstance.Register(new Action(() => + if (o != null && o is float value) + { + HKDevice.HK_PLC_S7.Write("DB47.DBD0", value); + } + }), "Axis1SpeedSet", true); + ActionManage.GetInstance.Register(new Action((o) => { - HKDevice.HK_PLC_S7.Write("DB44.DBX0.4", true); - }), "CLearRecipeInfo", true); + if (o != null && o is float value) + { + HKDevice.HK_PLC_S7.Write("DB47.DBD4", value); + } + }), "Axis2SpeedSet", true); RecipeQueue.Clear(); //Json.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 ThreadManage.GetInstance().StartLong(new Action(() => @@ -266,6 +292,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc); GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read("DB45.DBX0.0"); + //获取系统状态 + GVL_SmallStation.SystemStatus = HKDevice.HK_PLC_S7.Read("DB44.DBX0.0");//系统启停 + GVL_SmallStation.SystemMode = HKDevice.HK_PLC_S7.Read("DB44.DBX0.1");//系统模式 + GVL_SmallStation.SystemRunStatus = HKDevice.HK_PLC_S7.Read("DB44.DBX0.2");//系统暂停 } Thread.Sleep(200); }), "通信心跳", true); @@ -413,7 +443,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } else if (o.ToString().Contains("进料桶顶升气缸")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true); + HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);//默认顶升 } else if (o.ToString().Contains("出料桶顶升气缸1")) { @@ -429,19 +459,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } else if (o.ToString().Contains("托盘气缸1_1")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", true); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", false);//默认伸出 } else if (o.ToString().Contains("托盘气缸1_2")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", true); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", false); } else if (o.ToString().Contains("托盘气缸2_1")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", true); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", false); } else if (o.ToString().Contains("托盘气缸2_2")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", false); } } }), "ManualOpen", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 @@ -564,7 +594,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } else if (o.ToString().Contains("进料桶顶升气缸")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false); + HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true); } else if (o.ToString().Contains("出料桶顶升气缸1")) { @@ -580,19 +610,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } else if (o.ToString().Contains("托盘气缸1_1")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", false); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", true); } else if (o.ToString().Contains("托盘气缸1_2")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", false); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", true); } else if (o.ToString().Contains("托盘气缸2_1")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", false); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", true); } else if (o.ToString().Contains("托盘气缸2_2")) { - HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", false); + HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true); } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs index 75d62ad6..dade7066 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs @@ -160,6 +160,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model IPLists.Add($"{IPSegment}{i}"); } }*/ + //吉香居特定IP for (int i = 0; i < 15; i++) { IPLists.Add($"{IPSegment}{i + 69}"); @@ -247,14 +248,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model DS.modbusTcp.Disconnect = new Action(() => { if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip); - //var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip); var res = devices.FirstOrDefault(P => P.IpAddress == ip); - //if (res != null && DeviceListViewModel.devices.Contains(res)) if (res != null && devices.Contains(res)) { App.Current.Dispatcher.Invoke(new Action(() => { - //DeviceListViewModel.devices.Remove(res); devices.Remove(res); var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName); if (item != null) Global.DeviceRawMaterials.Remove(item); @@ -321,12 +319,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { ThreadManage.GetInstance().StartLong(new Action(() => { - //获取设备运行状态 - //var res = this.modbusTcp.Read(DeviceAddress.RunStatus); - //if (res != null && res is ushort[] ushortValue) - //{ - // if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; - //} deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态 deviceStatus.WeightFeedback = this.modbusTcp.ReadShort(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量 deviceStatus.NowWeightFeedback = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback);//获取下料重量 @@ -338,7 +330,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); - Thread.Sleep(10); }), $"{DeviceName} 开始监听", true); } @@ -365,31 +356,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { if (modbusTcp.Connected) { - /*//配料设备参数写入 - var res = Json.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); - if (res != null) - { - modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight); - modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight); - modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration); - modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration); - modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); - modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); - modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); - modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); - MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); - } - Thread.Sleep(100); - modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 - bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 - if (returnValue) - { - MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start); - } - else - { - MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start); - }*/ var res = Json.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); if (res != null) { @@ -421,24 +387,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo); if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7; - prop8: - modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed); + /*prop8: var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed); - if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8; + if (Value8 != null && Value8.ToString() != num.ToString()) goto prop8;*/ + uint num = (uint)res.StirringSpeed * 100; + modbusTcp.SetUint(DeviceAddress.StirringSpeed, num); MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); } - prop9: - modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 - var Value9 = this.modbusTcp.GetReal("LW65"); - MessageNotify.GetInstance.ShowRunLog($"{DeviceName},读取设置重量:{Value9}"); - if (Value9 != null && Value9.ToString() != Value.ToString()) goto prop9; - - /*prop10: - modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 - var Value10 = (short[])this.modbusTcp.Read(DeviceAddress.Start); - if (Value10 != null && Value10[0] != 1) goto prop10;*/ + modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量 modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 - MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},味魔方启动"); + MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},柔性味魔方开始配料"); } } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs index 40ea981e..3e686249 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs @@ -5,11 +5,14 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Toolkit.Mvvm.ComponentModel; using System.Collections.ObjectModel; +using BPASmartClient.JXJFoodSmallStation.Model.Par; namespace BPASmartClient.JXJFoodSmallStation.Model { - public class DevicePar + public class DevicePar:ObservableObject { public ObservableCollection deviceParModels { get; set; } = new ObservableCollection(); + public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } } + private ConnectParMode _mdeviceConnectPar = new ConnectParMode(); } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs index b474057b..b4f197b5 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs @@ -21,6 +21,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } private short _mRawMaterialBarrelNum; + public string RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } + private string _mRawMaterialType; + /// /// 需要原料重量 /// diff --git a/BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml b/BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml index ec40089b..be9d4c47 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml +++ b/BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml @@ -85,17 +85,37 @@ Text="总控制" /> - - + + - - - + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -132,7 +152,7 @@ Command="{Binding SystemResetCommand}" Grid.Column="3" Margin="5,30" - Content="复位" + Content="恢复" FontSize="40" Foreground="Aqua" Style="{StaticResource IcoButtonStyle}" /> @@ -188,8 +208,7 @@ Margin="10" Grid.Row="1" Grid.Column="0" - Command="{Binding StartCommand}" - CommandParameter="{Binding }" + Command="{Binding StartAxisLoadCommand}" Content="启动" FontSize="16" Foreground="Aqua" @@ -198,8 +217,7 @@ Grid.Row="1" Grid.Column="1" Margin="10" - Command="{Binding CloseCommand}" - CommandParameter="{Binding }" + Command="{Binding StopAxisLoadCommand}" Content="停止" FontSize="16" Foreground="Aqua" @@ -224,8 +242,7 @@ Margin="10" Grid.Row="1" Grid.Column="0" - Command="{Binding StartCommand}" - CommandParameter="{Binding }" + Command="{Binding StartAxisMidCommand}" Content="启动" FontSize="16" Foreground="Aqua" @@ -234,8 +251,7 @@ Grid.Row="1" Grid.Column="1" Margin="10" - Command="{Binding StopCommand}" - CommandParameter="{Binding }" + Command="{Binding StopAxisMidCommand}" Content="停止" FontSize="16" Foreground="Aqua" @@ -256,8 +272,7 @@ Margin="10" Grid.Row="1" Grid.Column="0" - Command="{Binding StartCommand}" - CommandParameter="{Binding }" + Command="{Binding StartAxisUnLoadCommand}" Content="启动" FontSize="16" Foreground="Aqua" @@ -266,8 +281,7 @@ Grid.Row="1" Grid.Column="1" Margin="10" - Command="{Binding CloseCommand}" - CommandParameter="{Binding }" + Command="{Binding StopAxisUnLoadCommand}" Content="停止" FontSize="16" Foreground="Aqua" @@ -290,8 +304,7 @@ Margin="10" Grid.Row="1" Grid.Column="0" - Command="{Binding StartCommand}" - CommandParameter="{Binding }" + Command="{Binding StartAxis1Command}" Content="启动" FontSize="16" Foreground="Aqua" @@ -300,8 +313,7 @@ Grid.Row="1" Grid.Column="1" Margin="10" - Command="{Binding CloseCommand}" - CommandParameter="{Binding }" + Command="{Binding StopAxis1Command}" Content="停止" FontSize="16" Foreground="Aqua" @@ -322,8 +334,7 @@ Margin="10" Grid.Row="1" Grid.Column="0" - Command="{Binding StartCommand}" - CommandParameter="{Binding }" + Command="{Binding StartAxis2Command}" Content="启动" FontSize="16" Foreground="Aqua" @@ -332,8 +343,7 @@ Grid.Row="1" Grid.Column="1" Margin="10" - Command="{Binding CloseCommand}" - CommandParameter="{Binding }" + Command="{Binding StopAxis2Command}" Content="停止" FontSize="16" Foreground="Aqua" diff --git a/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml b/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml index f1d842c4..e9dad8ae 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml +++ b/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml @@ -65,6 +65,15 @@ FontSize="20" Panel.ZIndex="0" Style="{StaticResource ImageButtonStyle}"> + diff --git a/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml b/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml index 458fc7ba..05c57b81 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml +++ b/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml @@ -7,8 +7,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel" Title="NewRemoteRecipeView" - Width="700" - Height="520" + Width="900" + Height="645" AllowsTransparency="True" Background="{x:Null}" Topmost="false" @@ -86,7 +86,7 @@ FontSize="16" Text="{Binding RecipeName}" /> - + - +