diff --git a/BPASmartClient.CustomResource/Image/弹窗.png b/BPASmartClient.CustomResource/Image/弹窗.png index 7d4f8fdd..ce73a3c8 100644 Binary files a/BPASmartClient.CustomResource/Image/弹窗.png and b/BPASmartClient.CustomResource/Image/弹窗.png differ diff --git a/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml b/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml index 635e3b0e..43527aa4 100644 --- a/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml +++ b/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml @@ -137,4 +137,83 @@ + + + + \ No newline at end of file diff --git a/BPASmartClient.S7Net/EntityClassResolution.cs b/BPASmartClient.S7Net/EntityClassResolution.cs index 5e720711..b9ddd591 100644 --- a/BPASmartClient.S7Net/EntityClassResolution.cs +++ b/BPASmartClient.S7Net/EntityClassResolution.cs @@ -55,9 +55,9 @@ namespace BPASmartClient.S7Net numBytes += len; break; default: - numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); if (type.IsClass) IncrementToEven(ref numBytes); else if (!type.IsPrimitive && !type.IsEnum && type.IsValueType) IncrementToEven(ref numBytes); + numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); break; } @@ -221,15 +221,13 @@ namespace BPASmartClient.S7Net break; default: { - object obj2 = Activator.CreateInstance(propertyType); - numBytes = FromBytes(obj2, bytes, numBytes); - numBytes = Math.Ceiling(numBytes); if (numBytes / 2.0 - Math.Floor(numBytes / 2.0) > 0.0) { numBytes += 1.0; } - + object obj2 = Activator.CreateInstance(propertyType); + numBytes = FromBytes(obj2, bytes, numBytes); obj = obj2; break; } diff --git a/BPASmartClient.S7Net/SiemensHelper.cs b/BPASmartClient.S7Net/SiemensHelper.cs index e79ad7fb..bf4b7dc9 100644 --- a/BPASmartClient.S7Net/SiemensHelper.cs +++ b/BPASmartClient.S7Net/SiemensHelper.cs @@ -2,7 +2,6 @@ using System.Net; using System.Text; using BPASmartClient.S7Net; -using System.Text; namespace BPASmartClient.S7Net { @@ -107,11 +106,11 @@ namespace BPASmartClient.S7Net } } - public void WriteString(int db,string txt, int startAddress = 0) + public void WriteString(int db, string txt, int startAddress = 0) { var temp = Encoding.ASCII.GetBytes(txt); var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length); - myPlc.WriteBytes(DataType.DataBlock,db, startAddress, bytes); + myPlc.WriteBytes(DataType.DataBlock, db, startAddress, bytes); } public TResult ReadClass(int db, int startByteAdr = 0) where TResult : class, new() diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs index 8d1787b0..93cd452e 100644 --- a/DosingSystem/Model/DeviceInquire.cs +++ b/DosingSystem/Model/DeviceInquire.cs @@ -197,12 +197,6 @@ namespace BPASmartClient.DosingSystem DeviceLists[ip].modbusTcp.IsReconnect = false; App.Current.Dispatcher.Invoke(new Action(() => { - //DeviceListViewModel.devices.Add(new Devices() - //{ - // DeviceName = DeviceName, - // IpAddress = ip - //});//加入连接的(有名称的)设备列表 - devices.Add(new Devices() { DeviceName = DeviceName, IpAddress = ip }); if (TopDeviceCurrentStatuses.Count <= 7) @@ -244,20 +238,16 @@ namespace BPASmartClient.DosingSystem DS.modbusTcp.ConnectFail = new Action(() => { if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); - //MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败"); }); 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); @@ -307,7 +297,6 @@ namespace BPASmartClient.DosingSystem modbusTcp.ShowEx = new Action((s) => { MessageNotify.GetInstance.ShowRunLog(s); }); this.DeviceName = DeviceName; AlarmHelper.Init(); - if (modbusTcp.Connected) { ThreadManage.GetInstance().StartLong(new Action(() => @@ -353,6 +342,7 @@ namespace BPASmartClient.DosingSystem { modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 + MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value}"); //配料设备参数写入 var res = Json.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); if (res != null) diff --git a/DosingSystem/View/CommParSetView.xaml b/DosingSystem/View/CommParSetView.xaml index e12528e4..7758d9d3 100644 --- a/DosingSystem/View/CommParSetView.xaml +++ b/DosingSystem/View/CommParSetView.xaml @@ -125,7 +125,10 @@ Text="{Binding CommBaseParModel.BlockCylinderCount, UpdateSourceTrigger=PropertyChanged}" /> - + @@ -146,7 +149,10 @@ Text="{Binding CommBaseParModel.PalletCylinderCount, UpdateSourceTrigger=PropertyChanged}" /> - + @@ -171,7 +177,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + Height="100" + Margin="0,0,0,15" + Background="Transparent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DosingSystem/View/RecipeControlView.xaml b/DosingSystem/View/RecipeControlView.xaml index 752864c0..865f7c9f 100644 --- a/DosingSystem/View/RecipeControlView.xaml +++ b/DosingSystem/View/RecipeControlView.xaml @@ -880,7 +880,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" - Foreground="{Binding RecipStatus,Converter={StaticResource RecipeStatusConvert}}" + Foreground="{Binding RecipStatus, Converter={StaticResource RecipeStatusConvert}}" Text="{Binding RecipStatus}" /> + + + + - - + - + Stretch="Fill" />--> @@ -939,7 +942,9 @@ @@ -1011,6 +1016,27 @@ +