浏览代码

启动流程修改

master
pry 1年前
父节点
当前提交
cb8c1d5c55
共有 9 个文件被更改,包括 656 次插入319 次删除
  1. +4
    -4
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  2. +25
    -24
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  3. +68
    -39
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  4. +150
    -93
      BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml
  5. +306
    -84
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
  6. +66
    -54
      BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml
  7. +15
    -4
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs
  8. +8
    -8
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
  9. +14
    -9
      BPASmartClient.Modbus/ModbusTcp.cs

+ 4
- 4
BPASmartClient.JXJFoodSmallStation/App.xaml.cs 查看文件

@@ -37,7 +37,7 @@ namespace BPASmartClient.JXJFoodSmallStation
}
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
base.OnStartup(e);
MenuInit();
DataInit();
Init();
@@ -53,7 +53,7 @@ namespace BPASmartClient.JXJFoodSmallStation
mv.Close();
MainWindow = mv;
}
private async void Init()
private async void Init()
{
await Task.Run(new Action(() =>
{
@@ -153,7 +153,7 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.BomOfMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",
@@ -187,7 +187,7 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualFlowView"

});
});
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "机器人设备控制",


+ 25
- 24
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs 查看文件

@@ -90,7 +90,7 @@ 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<bool>("DB45.DBX0.0");
if (DeviceInquire.GetInstance.devices.Count < 15 && HKDevice.IsConnected && Json<RemoteRecipeDataColl>.Data.Recipes.Count > 0 && GVL_SmallStation.GetInstance.DisEnableStockBinAlarm == false && DateTime.Now.Subtract(StockBinAlarmTime).TotalSeconds >= 60 & !GVL_SmallStation.GetInstance.DisEnableStockAlarm)
if (DeviceInquire.GetInstance.devices.Count < 15 && HKDevice.IsConnected && Json<RemoteRecipeDataColl>.Data.Recipes.Count > 0 && GVL_SmallStation.GetInstance.DisEnableStockBinAlarm == false && DateTime.Now.Subtract(StockBinAlarmTime).TotalSeconds >= 60 & !GVL_SmallStation.GetInstance.DisEnableStockAlarm)
{
HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", true);
App.Current.Dispatcher.Invoke(() =>
@@ -268,7 +268,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
//GVL_SmallStation.GetInstance.Station2Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.4");
//GVL_SmallStation.GetInstance.RobotStatus = HKDevice.HK_PLC_S7.Read<ushort>("DB3.DBW100");
//GVL_SmallStation.GetInstance.RobotProgramNum = HKDevice.HK_PLC_S7.Read<byte>("DB3.DBB102");
if (Json<RemoteRecipeDataColl>.Data.Recipes.Count <= 3)
if (Json<RemoteRecipeDataColl>.Data.Recipes.Count <= 3)
{
GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = true;
}
@@ -312,11 +312,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.AGV_PutTray1Finish = false;
}
ushort AGV_Get = (ushort)SiemensDevice.XL_Status.AgvFinishGet;
if (AGV_Get.Get16bitValue(1))
if (AGV_Get.Get16bitValue(1))
{
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
}
else
else
{
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = false;
}
@@ -331,12 +331,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
string code = GVL_SmallStation.GetInstance.Order_CancelRecipeCode;
int index = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == code);
int[] cnt = new int[5] { -1,-1,-1,-1,-1};
int[] cnt = new int[5] { -1, -1, -1, -1, -1 };
int index1 = -1;
for (int i = 0; i < 5; i++)
{
cnt[i]= Array.FindIndex(RecipeQueueTray[i].ToArray(), p => p == code);
if (cnt[i] >= 0)
cnt[i] = Array.FindIndex(RecipeQueueTray[i].ToArray(), p => p == code);
if (cnt[i] >= 0)
{
index1 = i;
}
@@ -351,7 +351,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
if (index1>=0)
if (index1 >= 0)
{
GVL_SmallStation.GetInstance.OrderCancelStep = 1;
}
@@ -378,9 +378,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
break;
case 2:
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX42."+index1))
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX42." + index1))
{
if (GVL_SmallStation.GetInstance.Station1Cylinder == false)
if (GVL_SmallStation.GetInstance.Station1Cylinder == false)
{
GVL_SmallStation.GetInstance.OrderCancelStep = 3;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
@@ -541,7 +541,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
for (int i = 0; i < 5; i++)
{
if (GVL_SmallStation.GetInstance.NotUseSmallStation)
if (GVL_SmallStation.GetInstance.NotUseSmallStation)
{
if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
{
@@ -549,9 +549,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,不使用小料配料,配方{data.RecipeCode},加入配方{i}");
}
}
else if(GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i])
else if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i])
{
if (RecipeQueueTray[i].Count==0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode))
{
RecipeQueueTray[i].Enqueue(data.RecipeCode);
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,等待plc允许配料,配方{data.RecipeCode},加入配方{i}");
@@ -829,7 +829,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", true);
App.Current.Dispatcher.Invoke(() =>
{
MessageNotify.GetInstance.ShowDialog($"{i}号仓配料误差过大,设置出料重量{ RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).RawMaterialWeight * 1000}g,实际出料重量{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}g,相差{AlarmRange}g,允许误差为{Math.Abs(Json<DevicePar>.Data.deviceParModels.ElementAt(iIndex).ErrorRange)}g,请联系人工处理", DialogType.Warning);
MessageNotify.GetInstance.ShowDialog($"{i}号仓配料误差过大,设置出料重量{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).RawMaterialWeight * 1000}g,实际出料重量{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}g,相差{AlarmRange}g,允许误差为{Math.Abs(Json<DevicePar>.Data.deviceParModels.ElementAt(iIndex).ErrorRange)}g,请联系人工处理", DialogType.Warning);
HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", false);
});
}
@@ -983,7 +983,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
public void RegisterInit()
public void RegisterInit()
{
//手动控制气缸 DB5.DBX0.0~DB5.DBX4.5
ActionManage.GetInstance.Register(new Action<object>((o) =>
@@ -1203,7 +1203,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
}
}
App.Current.Dispatcher.Invoke(() => {
App.Current.Dispatcher.Invoke(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = recipe.RecipeName,
@@ -1226,7 +1227,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
Json<RemoteRecipeDataColl>.Data.Recipes.Add(recipe);
}
}), "LocalSimulationRecipeIssue", true);
//手动控制系统模式
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true); }), "SystemStart", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false); }), "SystemStop", true);
@@ -1261,14 +1262,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}), "BPASystemReset", true);

//往海科PLC写值
ActionManage.GetInstance.Register(new Action<Object>((o) =>
ActionManage.GetInstance.Register(new Action<Object>((o) =>
{
if (o != null && o is HKDeviceWrite data)
if (o != null && o is HKDeviceWrite data)
{
if (data.PlcVarType == PlcVarType.Bool)
if (data.PlcVarType == PlcVarType.Bool)
{
bool value = (bool)data.Value;
HKDevice.HK_PLC_S7.Write<bool>(data.Address , value);
HKDevice.HK_PLC_S7.Write<bool>(data.Address, value);
}
else if (data.PlcVarType == PlcVarType.Byte)
{
@@ -1352,9 +1353,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
HKDevice.HK_PLC_S7.Write("DB4.DBB1", (byte)Value);
}
}), "RobotSetProgramNum", true);
}
public void DeviceConnect()
public void DeviceConnect()
{
try
{


+ 68
- 39
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs 查看文件

@@ -12,6 +12,7 @@ using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using System.Configuration;
using System.Diagnostics;

namespace BPASmartClient.JXJFoodSmallStation.Model
{
@@ -21,9 +22,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire());
private DeviceInquire() { }

string IPSegment = "107.107.2.";
string IPSegment = "107.107.2.";

ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>();
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>();
List<string> InvalidIP = new List<string>();//无效 IP 集合
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列
@@ -57,14 +58,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
}
if (!ThreadManage.GetInstance().IsContainsKey($"{deviceName} 开始监听"))
if (!ThreadManage.GetInstance().IsContainsKey($"{deviceName} 开始监听"))
{
DeviceLists[DeviceLists.ElementAt(i).Key].Init(deviceName);
}
}
Thread.Sleep(200);
}), "设备状态监听",true);
}), "设备状态监听", true);
}
private void TestData()
{
@@ -169,7 +170,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
IPLists.Add($"{IPSegment}{i + 69}");
}

IPLists.ForEach((item) =>
{
@@ -361,7 +362,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
//允许配料即产线气缸抬起,发送给味魔方
if (deviceStatus.DeviceNum >= 1 && deviceStatus.DeviceNum <= 15)
{
if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[deviceStatus.DeviceNum-1])
if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[deviceStatus.DeviceNum - 1])
{
this.modbusTcp.Write("LW41", (ushort)1);
GVL_SmallStation.GetInstance.StockBinCylinderStatus.SetBitValue((byte)(deviceStatus.DeviceNum), true);
@@ -395,57 +396,85 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
}


public void Start(float Value)
{
//if (modbusTcp.Connected)
//{
// var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
// if (res != null)
// {
// prop1:
// modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
// var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
// if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
// prop2:
// modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
// var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
// if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
// prop3:
// modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
// var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
// if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
// prop4:
// modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
// var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
// if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
// prop5:
// modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
// var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
// if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
// prop6:
// modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
// var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
// 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);
// if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
// /*prop8:
// var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
// 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},参数下发完成");
// }
// int Count = 0;
//Start:
// Count++;
// modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量
// modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
// MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},下发次数{Count},柔性味魔方开始配料");
// Thread.Sleep(200);
// if (this.modbusTcp.ReadShort(DeviceAddress.DosingStatusFeedback) == (short)0 && Count <=10) goto Start;
//}



if (modbusTcp.Connected)
{
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
prop1:
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
prop2:
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
prop3:
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
prop4:
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
prop5:
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
prop6:
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
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);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
/*prop8:
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != num.ToString()) goto prop8;*/
uint num = (uint)res.StirringSpeed * 100;
modbusTcp.SetUint(DeviceAddress.StirringSpeed, num);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
int Count = 0;
Start:
Count++;
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},下发次数{Count},柔性味魔方开始配料");
Thread.Sleep(200);
if (this.modbusTcp.ReadShort(DeviceAddress.DosingStatusFeedback) == (short)0 && Count <=10) goto Start;
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},柔性味魔方开始配料");
}





}
}
}

+ 150
- 93
BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml 查看文件

@@ -55,10 +55,10 @@

<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Grid
Name="jiu"
@@ -85,73 +85,102 @@
Text="总控制" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid>
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="24" Foreground="Aqua" Text="当前系统模式:"/>
<TextBlock FontSize="24" Foreground="Aqua" Text="{Binding SystemMode}"/>
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
FontSize="24"
Foreground="Aqua"
Text="当前系统模式:" />
<TextBlock
FontSize="24"
Foreground="Aqua"
Text="{Binding SystemMode}" />
</WrapPanel>
</Grid>
<Grid Grid.Column="0" Grid.Row="1">
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="24" Foreground="Aqua" Text="当前系统状态:"/>
<TextBlock FontSize="24" Foreground="Aqua" Text="{Binding SystemStatus}"/>
<Grid Grid.Row="1" Grid.Column="0">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
FontSize="24"
Foreground="Aqua"
Text="当前系统状态:" />
<TextBlock
FontSize="24"
Foreground="Aqua"
Text="{Binding SystemStatus}" />
</WrapPanel>
</Grid>

<RadioButton Grid.Column="1" Grid.Row="0" Content="Auto模式" IsChecked="True" Margin="15" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="Aqua" Command="{Binding AutoMode}"></RadioButton>
<RadioButton Grid.Column="1" Grid.Row="1" Content="Debug模式" IsChecked="false" Margin="15" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="Aqua" Command="{Binding DebugMode}"></RadioButton>
<RadioButton
Grid.Row="0"
Grid.Column="1"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding AutoMode}"
Content="Auto模式"
FontSize="20"
Foreground="Aqua"
IsChecked="False" />
<RadioButton
Grid.Row="1"
Grid.Column="1"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding DebugMode}"
Content="Debug模式"
FontSize="20"
Foreground="Aqua"
IsChecked="false" />
</Grid>
<Grid
Grid.Column="3" >

<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<pry:IcoButton
Command="{Binding SystemStartCommand}"
<pry:IcoButton
Grid.Column="0"
Margin="5,30"
Command="{Binding SystemStartCommand}"
Content="启动"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemStopCommand}"
<pry:IcoButton
Grid.Column="1"
Margin="5,30"
Command="{Binding SystemStopCommand}"
Content="停止"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemPauseCommand}"
<pry:IcoButton
Grid.Column="2"
Margin="5,30"
Command="{Binding SystemPauseCommand}"
Content="暂停"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemResetCommand}"
<pry:IcoButton
Grid.Column="3"
Margin="5,30"
Command="{Binding SystemResetCommand}"
Content="恢复"
FontSize="40"
Foreground="Aqua"
@@ -182,38 +211,44 @@
FontSize="16"
Foreground="Aqua"
Text="线体控制" />
<Grid Grid.Row="1">
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="进桶侧调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="进桶侧调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -225,29 +260,34 @@
</Grid>


<Border
BorderThickness="1,0,1,0" />
<Border BorderThickness="1,0,1,0" />
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="过渡段调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="过渡段调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisMidCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -259,25 +299,31 @@
</Grid>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="出桶侧调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="出桶侧调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisUnLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -287,29 +333,34 @@
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
</Grid>
<Border
BorderThickness="1,0,1,0" />
<Border BorderThickness="1,0,1,0" />
<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="伺服1调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="伺服1调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxis1Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -321,25 +372,31 @@
</Grid>
<Grid Grid.Column="4">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="伺服2调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="伺服2调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxis2Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -454,7 +511,7 @@
<!--#endregion-->

<!--#region 阻挡气缸-->
<!--#endregion-->

<!--#region 托盘气缸-->


+ 306
- 84
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml 查看文件

@@ -1,12 +1,14 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualFlowView"
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:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualFlowView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:ManualFlowViewModel />

@@ -20,56 +22,59 @@
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<StackPanel
HorizontalAlignment="left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Name="test1"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test1Command}"
Content="AGV送托盘完成"
FontSize="20"
Panel.ZIndex="0"
Visibility="{Binding VisibilityBtn1}"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn1}" />
<Button
Name="test2"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test2Command}"
Content="粉料仓配料完成"
FontSize="20"
Panel.ZIndex="0"
Visibility="{Binding VisibilityBtn2}"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn2}" />
<Button
Name="test3"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test3Command}"
Content="AGV取托盘完成"
FontSize="20"
Panel.ZIndex="0"
Visibility="{Binding VisibilityBtn3}"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn3}" />
<TextBlock
Width="100"
Width="100"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#FF2AB2E7"
FontSize="25"
Margin="10"></TextBlock>
Foreground="#FF2AB2E7" />
<Button
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test5Command}"
Content="粉料仓提升到位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="40"
@@ -77,29 +82,32 @@
Command="{Binding BPAResetCommand}"
Content="上位机初始化"
FontSize="20"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<StackPanel
HorizontalAlignment="left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding SystemReset}"
Content="PLC系统复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding CLearRecipeInfo}"
Content="PLC配方清零"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>


@@ -113,90 +121,292 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<WrapPanel Grid.Column="1">
<TextBlock Text="海科plc心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="海科plc心跳:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Heartbeat}" />
</StackPanel>
</StackPanel>
<WrapPanel Grid.Row="0">
<TextBlock Text="西门子 连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding SiemensIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="海科plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding HKPlcIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="风送plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding WindSendIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="西门子 连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding SiemensIsConnect}" />
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="海科plc连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding HKPlcIsConnect}" />
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="风送plc连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding WindSendIsConnect}" />
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Text="当前下发配方状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding OrderStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="当前下发配方状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding OrderStatus}" />
</WrapPanel>
<WrapPanel Grid.Row="0" Grid.Column="2">
<TextBlock Text="柔性味魔方配料完成,延迟复位时间:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Text="{Binding time}" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBox>
<TextBlock Text="ms" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="柔性味魔方配料完成,延迟复位时间:" />
<TextBox
Width="150"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding time}" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="ms" />
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding TimeSet}"
Content="设置"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
<WrapPanel Grid.Column="0" Grid.Row="3" Grid.RowSpan="2">
<TextBlock Text="当前配料状态:" Width="200" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<WrapPanel
Grid.Row="3"
Grid.RowSpan="2"
Grid.Column="0">
<TextBlock
Width="200"
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="当前配料状态:" />
<WrapPanel>
<TextBlock Text="配方1:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe1DosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方1:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe1DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方2:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe2DosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方2:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe2DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方3:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe3DosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方3:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe3DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方4:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe4DosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方4:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe4DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方5:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe5DosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方5:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe5DosingStatus}" />
</WrapPanel>
</WrapPanel>
<WrapPanel Grid.Column="1" Grid.Row="3" Grid.RowSpan="2">
<TextBlock Text="配料情况:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<WrapPanel
Grid.Row="3"
Grid.RowSpan="2"
Grid.Column="1">
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配料情况:" />
<WrapPanel>
<TextBlock Text="配方1:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe1DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方1:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe1DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方2:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe2DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方2:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe2DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方3:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe3DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方3:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe3DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方4:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe4DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方4:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe4DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock Text="配方5:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Recipe5DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方5:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe5DosingComplete}" />
</WrapPanel>
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="2">
<WrapPanel Grid.Row="1" Grid.Column="2">
<!--<ComboBox
x:Name="cmbList"
Width="70"
@@ -210,27 +420,39 @@
MouseLeave="ComboBox_MouseLeave"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}"/>-->
<TextBlock Text="料仓号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Width="50" Text="{Binding StockbinDosingCompleNum}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBox>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="料仓号:" />
<TextBox
Width="50"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding StockbinDosingCompleNum}" />
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding StockbinDosingComple}"
Content="小料料仓配料完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
<Button
HorizontalAlignment="Right"
Width="400"
Height="40"
Margin="10"
HorizontalAlignment="Right"
Panel.ZIndex="0"
Command="{Binding StockbinDosingCompleClear}"
Content="清除所有小料料仓配料完成信号"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
</Grid>
</Grid>


+ 66
- 54
BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml 查看文件

@@ -69,10 +69,13 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<StackPanel
Grid.Column="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Width="100"
Margin="10,0,10,0"
@@ -86,7 +89,10 @@
FontSize="16"
Text="{Binding RecipeName}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Left">
<WrapPanel
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<TextBlock
Width="100"
Margin="2,0,10,0"
@@ -106,7 +112,7 @@
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" Grid.Column="0">
<WrapPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock
Width="100"
Margin="10,0,10,0"
@@ -120,7 +126,10 @@
FontSize="16"
Text="{Binding TrayNum}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Column="1">
<WrapPanel
Grid.Column="1"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Button
Width="80"
Height="40"
@@ -146,7 +155,7 @@
FontSize="16"
Style="{StaticResource ImageButtonStyle}" />
<Button
Name ="Close"
Name="Close"
Width="80"
Height="40"
Margin="2,0,2,0"
@@ -159,35 +168,55 @@

<!--#region 表格标题栏设置-->
<Grid
Grid.Row="2"
Margin="0,10,0,0"
Background="#ff0C255F">
Grid.Row="2"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="原料名称" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料名称" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="原料类型" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料类型" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="2" Text="原料位置" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
FontSize="16"
Text="原料位置" />
<Grid Grid.Column="3">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料桶号" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="4" Text="原料重量(kg)" HorizontalAlignment="Center" FontSize="16" />
<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
FontSize="16"
Text="原料重量(kg)" />
<Grid Grid.Column="5">
<TextBlock Text="功能操作" HorizontalAlignment="Center" FontSize="16" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="功能操作" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
@@ -206,49 +235,32 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBox
Text="{Binding RawMaterialName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialName}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBox
Text="{Binding RawMaterialType}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialType}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBox
Grid.Column="2"
Text="{Binding RawMaterialLocation }" />
<TextBox Grid.Column="2" Text="{Binding RawMaterialLocation}" />

<Grid Grid.Column="3">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialBarrelNum}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="4"
Text="{Binding RawMaterialWeight}" />
<TextBox Grid.Column="4" Text="{Binding RawMaterialWeight}" />

<Grid Grid.Column="5">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>


+ 15
- 4
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs 查看文件

@@ -23,6 +23,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动";
if (GVL_SmallStation.GetInstance.PlcSystemMode) ManualMode = true;
else AutoModeStatus = true;
if (GVL_SmallStation.GetInstance.PlcSystemIsAutoRun)
{
if (GVL_SmallStation.GetInstance.PlcSystemIsPause)
@@ -230,7 +232,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
StopAxisLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisLoadCommand");
});
});
StartAxisMidCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisMidCommand");
@@ -264,7 +266,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ActionManage.GetInstance.Send("StopAxis2Command");
});

SystemStartCommand = new RelayCommand(() =>
SystemStartCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStart");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统启动!");
@@ -309,7 +311,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
/// </summary>
public static ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
public static string SystemMode { get { return _mSystemMode; } set { _mSystemMode = value; OnStaticPropertyChanged(); } }
private static string _mSystemMode =String.Empty;
private static string _mSystemMode = String.Empty;


public static string SystemStatus { get { return _mSystemStatus; } set { _mSystemStatus = value; OnStaticPropertyChanged(); } }
@@ -339,13 +341,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand SystemStopCommand { get; set; }
public RelayCommand SystemPauseCommand { get; set; }


public RelayCommand SystemResetCommand { get; set; }

public RelayCommand AutoMode { get; set; }
public RelayCommand DebugMode { get; set; }


public bool AutoModeStatus { get { return _mAutoModeStatus; } set { _mAutoModeStatus = value; OnPropertyChanged(); } }
private bool _mAutoModeStatus;

public bool ManualMode { get { return _mManualMode; } set { _mManualMode = value; OnPropertyChanged(); } }
private bool _mManualMode;



}

public class CylinderModel : ObservableObject


+ 8
- 8
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs 查看文件

@@ -21,7 +21,7 @@ using System.Windows;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class ManualFlowViewModel:ObservableObject
public class ManualFlowViewModel : ObservableObject
{
public ManualFlowViewModel()
{
@@ -82,7 +82,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ActionManage.GetInstance.Send("AGVPutTrayFinish");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV放货架流程完成");
});
CLearRecipeInfo = new RelayCommand(() =>
CLearRecipeInfo = new RelayCommand(() =>
{
App.Current.Dispatcher.Invoke(() =>
{
@@ -132,7 +132,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
MessageNotify.GetInstance.ShowUserLog($"手动点击按钮,给plc料仓{loc}配料完成信号");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,手动设置料仓{loc}配料完成");
}
else
else
{
MessageNotify.GetInstance.ShowUserLog("料仓编号不正确");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,手动设置料仓{loc}配料,料仓编号不正确");
@@ -155,7 +155,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
Recipe4DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[3].ToBinString();
Recipe5DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[4].ToBinString();
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc;
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
{
case 0:
OrderStatus = IssueRecipeCondition.等待小料站PLC允许下配方.ToString();
@@ -253,7 +253,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
break;
}
Thread.Sleep(100);
}), "流程手动设备状态读取",true);
}), "流程手动设备状态读取", true);
TimeSet = new RelayCommand(() =>
{
GVL_SmallStation.GetInstance.Time = time;
@@ -273,7 +273,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand TimeSet { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;
public int time { get { return _mtime; } set { _mtime = value; OnStaticPropertyChanged(); } }
private int _mtime;
public static string OrderStatus { get { return _mOrderStatus; } set { _mOrderStatus = value; OnStaticPropertyChanged(); } }
@@ -298,8 +298,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand CLearRecipeInfo { get; set; }
public RelayCommand SystemReset { get; set; }
public RelayCommand BPAResetCommand { get; set; }
private bool _SiemensIsConnect { get; set; }
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } }
private bool _SiemensIsConnect { get; set; }
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } }
private bool _HKPlcIsConnect { get; set; }
public bool HKPlcIsConnect { get { return _HKPlcIsConnect; } set { _HKPlcIsConnect = value; OnPropertyChanged(); } }
private bool _WindSendIsConnect { get; set; }


+ 14
- 9
BPASmartClient.Modbus/ModbusTcp.cs 查看文件

@@ -56,7 +56,7 @@ namespace BPASmartClient.Modbus
IPAdress = ip;
Port = port;
modbusFactory = new ModbusFactory();
Connect();
Connect();
if (Connected)
{
master.Transport.ReadTimeout = 3000;//读取超时时间
@@ -150,7 +150,7 @@ namespace BPASmartClient.Modbus
{
if (ExitAddress >= 0 && ExitAddress <= 7)
{
return (firstAddress * 8) + ExitAddress;
return (firstAddress * 8) + ExitAddress;
}
}
}
@@ -163,12 +163,12 @@ namespace BPASmartClient.Modbus
return int.Parse(res);
}
}
else if(address.ToUpper().Contains("LB") && address.Length >= 3)
else if (address.ToUpper().Contains("LB") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && res.Length > 0)
{
if(int.TryParse(res, out int firstAddress))
if (int.TryParse(res, out int firstAddress))
{
return firstAddress;
}
@@ -272,7 +272,7 @@ namespace BPASmartClient.Modbus
CommandType commandType = CommandType.Coils;
try
{
if (address.ToUpper().Contains("M") || address.ToUpper().Contains("GM"))
if (address.ToUpper().Contains("M") || address.ToUpper().Contains("GM"))
{
commandType = CommandType.Coils;
return master.ReadCoils(slaveAddress, startAddress, len);
@@ -297,7 +297,7 @@ namespace BPASmartClient.Modbus
{
commandType = CommandType.HoldingRegisters;
var var1 = master.ReadHoldingRegisters(slaveAddress, startAddress, len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress+2), len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress + 2), len);
int dest = 0;
dest |= (var2[0] & 0x0000ffff);
dest = (dest << 16) | (var1[0] & 0x0000ffff);
@@ -377,6 +377,7 @@ namespace BPASmartClient.Modbus
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
@@ -385,14 +386,16 @@ namespace BPASmartClient.Modbus
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
else if(address.ToUpper().Contains("LB"))
else if (address.ToUpper().Contains("LB"))
{
commandType = CommandType.Coils;
if (value is bool boolValue)
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
else if (address.ToUpper().Contains("VD"))
{
@@ -405,6 +408,7 @@ namespace BPASmartClient.Modbus
master.WriteSingleRegister(slaveAddress, startAddress, val1);
master.WriteSingleRegister(slaveAddress, (ushort)(startAddress + 1), val2);
}
else return false;

}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D"))
@@ -439,6 +443,7 @@ namespace BPASmartClient.Modbus
master.WriteMultipleRegisters(slaveAddress, startAddress, ushortsValue);
}
}
else return false;
}
else if (address.ToUpper().Contains("I"))
{
@@ -497,10 +502,10 @@ namespace BPASmartClient.Modbus
/// </summary>
/// <param name="StartAddress"></param>
/// <param name="value"></param>
public void SetReal(string StartAddress, float value,int Retries = 1)
public bool SetReal(string StartAddress, float value, int Retries = 1)
{
var bytes = BitConverter.GetBytes(value);
Write(StartAddress, bytes.BytesToUshorts(), Retries);
return Write(StartAddress, bytes.BytesToUshorts(), Retries);
}

/// <summary>


正在加载...
取消
保存