Quellcode durchsuchen

180项目更新

样式分支
taoye vor 2 Jahren
Ursprung
Commit
5e0df1b04d
12 geänderte Dateien mit 458 neuen und 236 gelöschten Zeilen
  1. +11
    -10
      FryPot_DosingSystem/App.xaml.cs
  2. +51
    -36
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  3. +20
    -20
      FryPot_DosingSystem/Model/RollerLineBarrelSerialModel.cs
  4. +53
    -50
      FryPot_DosingSystem/View/DeviceListVIew.xaml
  5. +10
    -13
      FryPot_DosingSystem/View/HardWareStatusView.xaml
  6. +42
    -40
      FryPot_DosingSystem/View/HardWareStatusView.xaml.cs
  7. +1
    -1
      FryPot_DosingSystem/View/MainWindow.xaml.cs
  8. +172
    -15
      FryPot_DosingSystem/View/NewRecipeView.xaml
  9. +90
    -47
      FryPot_DosingSystem/View/RecipeSendDownView.xaml
  10. +1
    -1
      FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs
  11. +6
    -2
      FryPot_DosingSystem/ViewModel/HardWareStatusViewModel.cs
  12. +1
    -1
      FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs

+ 11
- 10
FryPot_DosingSystem/App.xaml.cs Datei anzeigen

@@ -52,7 +52,7 @@ namespace FryPot_DosingSystem
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
SubMenuPermission = new Permission[] { Permission.管理员,Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.RecipeSetView"
});
@@ -60,7 +60,7 @@ namespace FryPot_DosingSystem
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员,Permission.管理员 },
SubMenuPermission = new Permission[] { Permission.操作员,Permission.管理员,Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.RecipeSendDownView"
});
@@ -70,7 +70,7 @@ namespace FryPot_DosingSystem
MainMenuIcon = "",
MainMenuName = "配方管理",
Alias = "Recipe Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员,Permission.技术员 },
subMenumodels = RecipeManage,
});
#endregion
@@ -115,18 +115,19 @@ namespace FryPot_DosingSystem
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
SubMenuName = "PLC通讯设置",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.DeviceListView"
ToggleWindowPath = "View.DeviceListVIew"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
SubMenuName = "滚筒线运行状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员,Permission.观察员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.HardWareStatusView"
});


@@ -135,7 +136,7 @@ namespace FryPot_DosingSystem
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员,Permission.观察员 },
subMenumodels = DeviceMonitor,
});
#endregion
@@ -153,7 +154,7 @@ namespace FryPot_DosingSystem
UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});


+ 51
- 36
FryPot_DosingSystem/Control/DosingLogicControl.cs Datei anzeigen

@@ -16,6 +16,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows;

namespace FryPot_DosingSystem.Control
{
@@ -73,7 +74,7 @@ namespace FryPot_DosingSystem.Control
ReadPlcData();
IniteTask();
}
/// <summary>
/// AGV上下料上报数据解析
/// </summary>
@@ -88,15 +89,15 @@ namespace FryPot_DosingSystem.Control
{
if (upDownReportData.body != null && upDownReportData.body is UpstreamrequestBody body)
{
if (body.robotJobId== robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段
if (body.robotJobId == robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段
{
agvArriveUpLoad = true;//AGV到达上料位置
}
if ( body.robotJobId== robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段
if (body.robotJobId == robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段
{
agvArriveUnLoad = true;//AGV到达下料位置
}
}
}
}
@@ -116,7 +117,7 @@ namespace FryPot_DosingSystem.Control
{
if (agvUpReportData.body != null && agvUpReportData.body is AGVToUpSystemBody body)
{
if (body.state == "ROLLER_LOAD_FINISH"&&body.jobData.startPointCode=="")//上料完成以及到达指定上料点位
if (body.state == "ROLLER_LOAD_FINISH" && body.jobData.startPointCode == "")//上料完成以及到达指定上料点位
{
agvFryPotEmptyRollerArrive = true;
}
@@ -260,12 +261,14 @@ namespace FryPot_DosingSystem.Control

globalVar.CleadBarrelExitSingle = data[0];
}));
globalVar.rollerLineOne.OutMaterialingSingle = 1;
globalVar.rollerLineOne.StationOne = 401;
//globalVar.rollerLineOne.OutMaterialingSingle = 0;
//globalVar.rollerLineOne.StationOne = 401;
//globalVar.rollerLineOne.StationTwo = 402;
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
RollerLineStatusDisplay();
Thread.Sleep(10);
}), "MainViewReadPlcData");
}
/// <summary>
/// 滚筒线运行状态显示
@@ -275,26 +278,30 @@ namespace FryPot_DosingSystem.Control
hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
hardWareStatusModel.RollerOneModel.LocFourRollerSerial=globalVar.rollerLineOne.StationFour;
hardWareStatusModel.RollerOneModel.LocFiveRollerSerial=globalVar.rollerLineOne.StationFive;
hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)
{
// ActionManage.GetInstance.Send("RedToGray", 1);//无故障

hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
}
else
{
// ActionManage.GetInstance.Send("ToRed",1);//有故障

hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
}
if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
{
// ActionManage.GetInstance.Send("ToGreen",1);

hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
}
else
{
// ActionManage.GetInstance.Send("GreenToGray",1); //未运行

hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
}
hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
@@ -306,22 +313,22 @@ namespace FryPot_DosingSystem.Control
hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)
{
//ActionManage.GetInstance.Send("RedToGray", 2);//无故障
hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
}
else
{

//ActionManage.GetInstance.Send("ToRed", 2);//有故障
hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
}
if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
{

// ActionManage.GetInstance.Send("ToGreen",2);
hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中

}
else
{
// ActionManage.GetInstance.Send("GreenToGray", 2);//未运行
hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
}
hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
@@ -333,20 +340,22 @@ namespace FryPot_DosingSystem.Control
hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)
{
// ActionManage.GetInstance.Send("RedToGray", 3);//无故障
hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
}
else
{
// ActionManage.GetInstance.Send("ToRed", 3);//有故障
hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
}
if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
{
// ActionManage.GetInstance.Send("ToGreen", 3);
hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
}
else
{
//ActionManage.GetInstance.Send("GreenToGray",3);//未运行
hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
}
//滚筒线4

}
/// <summary>
/// 返回指定地址指定长度的数据
@@ -385,12 +394,18 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void RecipeDataParse(object obj)
{
if (obj != null && obj is NewRecipeModel recipe)
Task.Run(new Action(() =>
{
RecipeQuene.Enqueue(recipe);
ReicpeNum++;
MessageLog.GetInstance.ShowRunLog($"接收到{ReicpeNum}个配方");
}
if (obj != null && obj is NewRecipeModel recipe)
{
RecipeQuene.Enqueue(recipe);
ReicpeNum++;
MessageLog.GetInstance.ShowRunLog($"接收到第{ReicpeNum}个配方");
}

}));



}
/// <summary>
@@ -652,7 +667,7 @@ namespace FryPot_DosingSystem.Control
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
erp: string id = Guid.NewGuid().ToString();//上游唯一ID
erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
if (id == robotJobId)
{
goto erp;
@@ -661,7 +676,7 @@ namespace FryPot_DosingSystem.Control
robotJobId = id;
FryCarryTaskErrorCodeAnalysis(info, 1); break;
case 2:
erp1: string id1 = Guid.NewGuid().ToString();//上游唯一ID
erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
if (id1 == robotJobId)
{
goto erp1;
@@ -670,7 +685,7 @@ namespace FryPot_DosingSystem.Control
robotJobId = id1;
FryCarryTaskErrorCodeAnalysis(info1, 2); break;
case 3:
erp2: string id2 = Guid.NewGuid().ToString();//上游唯一ID
erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
if (id2 == robotJobId)
{
goto erp2;
@@ -679,7 +694,7 @@ namespace FryPot_DosingSystem.Control
robotJobId = id2;
FryCarryTaskErrorCodeAnalysis(info2, 3); break;
case 4:
erp3: string id3 = Guid.NewGuid().ToString();//上游唯一ID
erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
if (id3 == robotJobId)
{
goto erp3;
@@ -688,7 +703,7 @@ namespace FryPot_DosingSystem.Control
robotJobId = id3;
FryCarryTaskErrorCodeAnalysis(info3, 4); break;
case 5:
erp4: string id4 = Guid.NewGuid().ToString();//上游唯一ID
erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
if (id4 == robotJobId)
{
goto erp4;
@@ -878,7 +893,7 @@ namespace FryPot_DosingSystem.Control
if (globalVar.ExitMainTask)
return;
}
e: string id = Guid.NewGuid().ToString();
e: string id = Guid.NewGuid().ToString("N");
if (id == robotJobId)
goto e;
string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
@@ -910,7 +925,7 @@ namespace FryPot_DosingSystem.Control
if (id == robotJobId)
goto p;
string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
robotJobId= id;
robotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 2);
}
@@ -935,8 +950,8 @@ namespace FryPot_DosingSystem.Control
if (globalVar.ExitMainTask)
return;
}
g: string id = Guid.NewGuid().ToString();
if(id==robotJobId)
g: string id = Guid.NewGuid().ToString();
if (id == robotJobId)
goto g;
string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
robotJobId = id;


+ 20
- 20
FryPot_DosingSystem/Model/RollerLineBarrelSerialModel.cs Datei anzeigen

@@ -10,35 +10,35 @@ namespace FryPot_DosingSystem.Model
{
internal class RollerLineBarrelSerialModel:ObservableObject
{
private int _locOneRollerSerial;
public int LocOneRollerSerial { get { return _locOneRollerSerial; } set { _locOneRollerSerial = value;OnPropertyChanged(); } }
private ushort _locOneRollerSerial;
public ushort LocOneRollerSerial { get { return _locOneRollerSerial; } set { _locOneRollerSerial = value;OnPropertyChanged(); } }

private int _locTwoRollerSerial;
public int LocTwoRollerSerial { get { return _locTwoRollerSerial; } set { _locTwoRollerSerial = value; OnPropertyChanged(); } }
private ushort _locTwoRollerSerial;
public ushort LocTwoRollerSerial { get { return _locTwoRollerSerial; } set { _locTwoRollerSerial = value; OnPropertyChanged(); } }

private int _locThreeRollerSerial;
public int LocThreeRollerSerial { get { return _locThreeRollerSerial; } set { _locThreeRollerSerial = value; OnPropertyChanged(); } }
private ushort _locThreeRollerSerial;
public ushort LocThreeRollerSerial { get { return _locThreeRollerSerial; } set { _locThreeRollerSerial = value; OnPropertyChanged(); } }

private int _locFourRollerSerial;
public int LocFourRollerSerial { get { return _locFourRollerSerial; } set { _locFourRollerSerial = value; OnPropertyChanged(); } }
private ushort _locFourRollerSerial;
public ushort LocFourRollerSerial { get { return _locFourRollerSerial; } set { _locFourRollerSerial = value; OnPropertyChanged(); } }

private int _locFiveRollerSerial;
public int LocFiveRollerSerial { get { return _locFiveRollerSerial; } set { _locFiveRollerSerial = value; OnPropertyChanged(); } }
private ushort _locFiveRollerSerial;
public ushort LocFiveRollerSerial { get { return _locFiveRollerSerial; } set { _locFiveRollerSerial = value; OnPropertyChanged(); } }

private int _locSixRollerSerial;
public int LocSixRollerSerial { get { return _locSixRollerSerial; } set { _locSixRollerSerial = value; OnPropertyChanged(); } }
private ushort _locSixRollerSerial;
public ushort LocSixRollerSerial { get { return _locSixRollerSerial; } set { _locSixRollerSerial = value; OnPropertyChanged(); } }

private int _locSevenRollerSerial;
public int LocSevenRollerSerial { get { return _locSevenRollerSerial; } set { _locSevenRollerSerial = value; OnPropertyChanged(); } }
private ushort _locSevenRollerSerial;
public ushort LocSevenRollerSerial { get { return _locSevenRollerSerial; } set { _locSevenRollerSerial = value; OnPropertyChanged(); } }

private int _locEightRollerSerial;
public int LocEightRollerSerial { get { return _locEightRollerSerial; } set { _locEightRollerSerial = value; OnPropertyChanged(); } }
private ushort _locEightRollerSerial;
public ushort LocEightRollerSerial { get { return _locEightRollerSerial; } set { _locEightRollerSerial = value; OnPropertyChanged(); } }

//private Brush? _rollerRunState;
//public Brush RollerRunState { get { return _rollerRunState; } set { _rollerRunState = value; OnPropertyChanged(); } }
private Color _rollerRunState;
public Color RollerRunState { get { return _rollerRunState; } set { _rollerRunState = value; OnPropertyChanged(); } }


//private Color _rollerAlarmState;
//public Color RollerAlarmState { get { return _rollerAlarmState; } set { _rollerAlarmState = value; OnPropertyChanged(); } }
private Color _rollerAlarmState;
public Color RollerAlarmState { get { return _rollerAlarmState; } set { _rollerAlarmState = value; OnPropertyChanged(); } }
}
}

+ 53
- 50
FryPot_DosingSystem/View/DeviceListVIew.xaml Datei anzeigen

@@ -18,55 +18,58 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="20"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,0,20,0" Command="{Binding SaveDeviceConfig}"></Button>
</StackPanel>
<Line Grid.Row="1" X1="0" Y1="10" X2="1300" Y2="10" Stroke="Aqua" StrokeThickness="1"></Line>
<ItemsControl Grid.Row="2" ItemsSource="{Binding devices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton>
<RadioButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="设备名称:" Margin="10,10,10,10" FontSize="16" ></TextBlock>
<ComboBox ItemsSource="{Binding DataContext.DeviceName, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding DeviceName}" Width="150" FontSize="16"></ComboBox>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="ModBus IP:" Margin="10,10,10,10" FontSize="16" VerticalAlignment="Center"></TextBlock>
<TextBox Width="150" FontSize="16" Text="{Binding Ip}" ></TextBox>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="Port:" FontSize="16" Margin="10,10,10,10"></TextBlock>
<TextBox Width="150" FontSize="16" Text="{Binding Port}"></TextBox>
</StackPanel>
<Button Grid.Column="3" Content="删除" Width="150" Height="30" FontSize="16" Command="{Binding DataContext.DeleteDevice,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding DeviceNum}"></Button>
</Grid>
</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="20"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,0,20,0" Command="{Binding SaveDeviceConfig}"></Button>
</StackPanel>
<Line Grid.Row="1" X1="0" Y1="10" X2="1300" Y2="10" Stroke="Aqua" StrokeThickness="1"></Line>
<Viewbox Grid.Row="2" VerticalAlignment="Top" >
<ItemsControl ItemsSource="{Binding devices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton>
<RadioButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="设备名称:" Margin="10,10,10,10" FontSize="16" ></TextBlock>
<ComboBox ItemsSource="{Binding DataContext.DeviceName, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding DeviceName}" Width="150" FontSize="16"></ComboBox>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="ModBus IP:" Margin="10,10,10,10" FontSize="16" VerticalAlignment="Center"></TextBlock>
<TextBox Width="150" FontSize="16" Text="{Binding Ip}" ></TextBox>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="Port:" FontSize="16" Margin="10,10,10,10"></TextBlock>
<TextBox Width="150" FontSize="16" Text="{Binding Port}" Margin="0,0,10,0"></TextBox>
</StackPanel>
<Button Grid.Column="3" Content="删除" Width="150" Height="30" FontSize="16" Margin="0,0,10,0" Command="{Binding DataContext.DeleteDevice,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding DeviceNum}"></Button>
</Grid>
</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Viewbox>
</Grid>
</UserControl>

+ 10
- 13
FryPot_DosingSystem/View/HardWareStatusView.xaml Datei anzeigen

@@ -7,9 +7,6 @@
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:HardWareStatusViewModel></vm:HardWareStatusViewModel>
</UserControl.DataContext>
<Viewbox>
<Grid>
<Grid.RowDefinitions>
@@ -35,10 +32,10 @@
<Line X1="0" Y1="0" X2="78" Y2="0" Stroke="DarkOrange" StrokeThickness="2" StrokeDashArray="2"></Line>
</StackPanel>
<StackPanel Margin="0,43,0,0" Grid.RowSpan="2" >
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0" >
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0" >
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsGreen1"/>
<GradientStop Color="{Binding RollerOneModel.RollerRunState}" Offset="0.5" x:Name="gsGreen1"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -46,7 +43,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsRed1"/>
<GradientStop Color="{Binding RollerOneModel.RollerAlarmState}" Offset="0.5" x:Name="gsRed1"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -79,7 +76,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Border Width="60" Height="60" CornerRadius="30" BorderThickness="2" VerticalAlignment="Bottom" BorderBrush="HotPink">
<TextBlock Text="{Binding RollerOneModel.LocOneRollerSerial}" FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="DarkOrange"></TextBlock>
<TextBlock Text="{Binding RollerOneModel.LocOneRollerSerial}" FontSize="30" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="DarkOrange"></TextBlock>
</Border>
<TextBlock Grid.Row="1" Text="工位1" HorizontalAlignment="Center" Foreground="DeepSkyBlue"></TextBlock>
</Grid>
@@ -194,7 +191,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsGreen2"/>
<GradientStop Color="{Binding RollerTwoModel.RollerRunState}" Offset="0.5" x:Name="gsGreen2"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -202,7 +199,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsRed2"/>
<GradientStop Color="{Binding RollerTwoModel.RollerAlarmState}" Offset="0.5" x:Name="gsRed2"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -350,7 +347,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsGreen3"/>
<GradientStop Color="{Binding RollerThreeModel.RollerRunState}" Offset="0.5" x:Name="gsGreen3"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -358,7 +355,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsRed3"/>
<GradientStop Color="{Binding RollerThreeModel.RollerAlarmState}" Offset="0.5" x:Name="gsRed3"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -506,7 +503,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsGreen4"/>
<GradientStop Color="{Binding RollerFourModel.RollerRunState}" Offset="0.5" x:Name="gsGreen4"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
@@ -514,7 +511,7 @@
<Border Width="15" Height="15" CornerRadius="15" HorizontalAlignment="Left" Margin="12,10,0,0">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="DimGray" Offset="0.5" x:Name="gsRed4"/>
<GradientStop Color="{Binding RollerFourModel.RollerAlarmState}" Offset="0.5" x:Name="gsRed4"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>


+ 42
- 40
FryPot_DosingSystem/View/HardWareStatusView.xaml.cs Datei anzeigen

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -24,50 +25,51 @@ namespace FryPot_DosingSystem.View
public HardWareStatusView()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action<object>((a) =>
{
switch (a)
{
case 1: gsGreen1.Color = Color.FromRgb(130, 232, 139);break;
case 2: gsGreen2.Color = Color.FromRgb(130, 232, 139); break;
case 3: gsGreen3.Color = Color.FromRgb(130, 232, 139); break;
case 4: gsGreen4.Color = Color.FromRgb(130, 232, 139); break;
}
this.DataContext = HardWareStatusViewModel.GetInstance;
//ActionManage.GetInstance.Register(new Action<object>((a) =>
//{
// switch (a)
// {
// case 1: gsGreen1.Color = Color.FromRgb(130, 232, 139);break;
// case 2: gsGreen2.Color = Color.FromRgb(130, 232, 139); break;
// case 3: gsGreen3.Color = Color.FromRgb(130, 232, 139); break;
// case 4: gsGreen4.Color = Color.FromRgb(130, 232, 139); break;
// }
}), "ToGreen");
ActionManage.GetInstance.Register(new Action<object>((a) =>
{
switch (a)
{
case 1: gsRed1.Color = Color.FromRgb(243, 165, 230); break;
case 2: gsRed2.Color = Color.FromRgb(243, 165, 230); break;
case 3: gsRed3.Color = Color.FromRgb(243, 165, 230); break;
case 4: gsRed4.Color = Color.FromRgb(243, 165, 230); break;
}
//}), "ToGreen");
//ActionManage.GetInstance.Register(new Action<object>((a) =>
//{
// switch (a)
// {
// case 1: gsRed1.Color = Color.FromRgb(243, 165, 230); break;
// case 2: gsRed2.Color = Color.FromRgb(243, 165, 230); break;
// case 3: gsRed3.Color = Color.FromRgb(243, 165, 230); break;
// case 4: gsRed4.Color = Color.FromRgb(243, 165, 230); break;
// }

}), "ToRed");
ActionManage.GetInstance.Register(new Action<object>((a) =>
{
switch (a)
{
case 1: gsGreen1.Color = Color.FromRgb(84,84,84); break;
case 2: gsGreen2.Color = Color.FromRgb(84,84,84); break;
case 3: gsGreen3.Color = Color.FromRgb(84,84,84); break;
case 4: gsGreen4.Color = Color.FromRgb(84,84,84); break;
}
//}), "ToRed");
//ActionManage.GetInstance.Register(new Action<object>((a) =>
//{
// switch (a)
// {
// case 1: gsGreen1.Color = Color.FromRgb(84,84,84); break;
// case 2: gsGreen2.Color = Color.FromRgb(84,84,84); break;
// case 3: gsGreen3.Color = Color.FromRgb(84,84,84); break;
// case 4: gsGreen4.Color = Color.FromRgb(84,84,84); break;
// }

}), "GreenToGray");
ActionManage.GetInstance.Register(new Action<object>((a) =>
{
switch (a)
{
case 1: gsRed1.Color = Color.FromRgb(84,84,84); break;
case 2: gsRed2.Color = Color.FromRgb(84,84,84); break;
case 3: gsRed3.Color = Color.FromRgb(84,84,84); break;
case 4: gsRed4.Color = Color.FromRgb(84,84,84); break;
}
//}), "GreenToGray");
//ActionManage.GetInstance.Register(new Action<object>((a) =>
//{
// switch (a)
// {
// case 1: gsRed1.Color = Color.FromRgb(84,84,84); break;
// case 2: gsRed2.Color = Color.FromRgb(84,84,84); break;
// case 3: gsRed3.Color = Color.FromRgb(84,84,84); break;
// case 4: gsRed4.Color = Color.FromRgb(84,84,84); break;
// }

}), "RedToGray");
//}), "RedToGray");

}
}


+ 1
- 1
FryPot_DosingSystem/View/MainWindow.xaml.cs Datei anzeigen

@@ -37,7 +37,7 @@ namespace FryPot_DosingSystem.View

HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
{
var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
var res = JsonConvert.DeserializeObject<UpStreamrequest>(o.ToString());
});

HubHelper.GetInstance.Connect("192.168.1.56", 8089);


+ 172
- 15
FryPot_DosingSystem/View/NewRecipeView.xaml Datei anzeigen

@@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
mc:Ignorable="d"
Title="NewRecipeView" Height="550" Width="800"
WindowStyle="None" WindowStartupLocation="CenterScreen" AllowsTransparency="True">
@@ -15,7 +15,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>

<ResourceDictionary>
<!--#region ListBox样式-->
@@ -40,11 +40,152 @@
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
<Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
</MultiTrigger>
</Style.Triggers>
</Style>
<SolidColorBrush x:Key="foreground" Color="#a2c2e8"/>
<SolidColorBrush x:Key="borderBrush" Color="Aqua"/>
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
<Setter Property="Foreground" Value="{DynamicResource foreground}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource borderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Height" Value="24"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="IsTextSearchCaseSensitive" Value="true"/>
<Setter Property="IsEditable" Value="true"/>
<Setter Property="StaysOpenOnEdit" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<Grid>
<Themes1:ClassicBorderDecorator x:Name="Border" BorderStyle="None" BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" BorderThickness="2">
<Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="False" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
<Themes1:SystemDropShadowChrome x:Name="Shdw" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=Border}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
<Border.Background>
<SolidColorBrush Color="#264c73"></SolidColorBrush>
</Border.Background>
<ScrollViewer x:Name="DropDownScrollViewer">
<Grid RenderOptions.ClearTypeHint="Enabled">
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
<Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
</Canvas>
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
</ScrollViewer>
</Border>
</Themes1:SystemDropShadowChrome>
</Popup>
</Themes1:ClassicBorderDecorator>
<DockPanel Margin="2">
<FrameworkElement DockPanel.Dock="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
<Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}">
<ContentPresenter ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,1,1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</DockPanel>
<ToggleButton ClickMode="Press" Focusable="false" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="2" MinWidth="0" MinHeight="0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Width="Auto"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsDropDownOpen" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
</MultiTrigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
</Trigger>
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEditable" Value="true">
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</Window.Resources>
<Border Name="br">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png"></ImageBrush>
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png"></ImageBrush>-->
<SolidColorBrush Color="#264c73">

</SolidColorBrush>
</Border.Background>
<Grid >
<Grid.RowDefinitions>
@@ -52,19 +193,22 @@
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="25" Margin="0,10"></TextBlock>
<UniformGrid Grid.Row="1" Columns="2">
<StackPanel Orientation="Horizontal">
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
VerticalContentAlignment="Center"
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="添加原料" Width="150" Margin="10" Height="30" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
<Button Content="确认" Height="30" Width="100" Margin="5,10" Command="{Binding Comfirm}"></Button>
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Width="100" Margin="8,10" Cursor="Hand"></Button>
<Button Content="添加原料" Width="150" Margin="10" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
<Button Content="确认" Height="30" Width="100" Margin="5,10" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button>
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="100" Margin="8,10" Cursor="Hand"></Button>
</StackPanel>
</UniformGrid>
<ScrollViewer Grid.Row="2">
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding materials}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -84,20 +228,33 @@
<ColumnDefinition Width="225"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190"></ComboBox>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" Style="{StaticResource ComboBoxStyle1}">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="#e69519"/>


</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
<StackPanel Grid.Column="1" Orientation="Horizontal" >
<TextBox Text="{Binding MaterialLoc}" Width="170" Margin="35,0,0,10" ></TextBox>
<TextBox Text="{Binding MaterialLoc}" Background="Transparent" FontSize="14"
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>

</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2">
<TextBox Text="{Binding MaterialWeight}" Width="170" Margin="35,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="g" ></TextBlock>
<TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14"
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" Margin="4,0,0,10" Text="g" Foreground="#e69519" ></TextBlock>
</StackPanel>
<Button Grid.Column="3"
Content="删除"
Width="94"
Margin="0,0,0,10"
HorizontalAlignment="Right"
FontSize="14"
Margin="0,0,10,10"
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding MaterialCode}"></Button>
</Grid>


+ 90
- 47
FryPot_DosingSystem/View/RecipeSendDownView.xaml Datei anzeigen

@@ -17,6 +17,7 @@
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
@@ -26,57 +27,99 @@
</Grid.RowDefinitions>
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Content="配方一键下发" Width="110" Height="30" Margin="0,0,10,0" Cursor="Hand" Command="{Binding AllRecipeSetDownCommand}"></Button>
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Aqua" BorderThickness="2" CornerRadius="14" Height="120" Margin="5,5">
<RadioButton>
<RadioButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="0.01*"></ColumnDefinition>
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Aqua" BorderThickness="2" CornerRadius="14" Height="120" Margin="5,5">
<RadioButton>
<RadioButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="0.01*"></ColumnDefinition>

<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="1.2*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="{Binding RecipeName}" FontSize="35" HorizontalAlignment="Center"></TextBlock>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="1.2*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="{Binding RecipeName}" FontSize="35" HorizontalAlignment="Center"></TextBlock>
<Button Grid.Row="1" Width="100" Content="配方下发" Command="{Binding DataContext.RecipeSetDownCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}" Cursor="Hand"></Button>
</Grid>
<Line StrokeThickness="3" Grid.Column="1" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<Grid Grid.Column="2">
<!--后续添加内容-->
</Grid>
<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Line StrokeThickness="3" Grid.Column="0" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
</Grid>
<Line StrokeThickness="3" Grid.Column="1" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<Grid Grid.Column="2">
<!--后续添加内容-->
<ScrollViewer VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding materialCollection}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
HorizontalAlignment="Center" >
<RadioButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Width="15" Height="15" CornerRadius="15">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="#99e6ff" Offset="0.5"/>
<GradientStop Color="white"/>
</RadialGradientBrush>
</Border.Background>
</Border>
<TextBlock Grid.Column="1" Text="{Binding MaterialName }" Margin="30,5" FontSize="20"></TextBlock>
<TextBlock Grid.Column="2" Text="{Binding MaterialLoc}" Margin="30,5" FontSize="20"></TextBlock>
<StackPanel Orientation="Horizontal" Grid.Column="3">
<TextBlock Text="{Binding MaterialWeight}" Margin="30,5,2,5" FontSize="20"></TextBlock>
<TextBlock Foreground="LightSeaGreen" Text="g" FontSize="20" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Line StrokeThickness="3" Grid.Column="0" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<TextBlock Grid.Column="1" FontSize="16" Text="{Binding RecipeSetInfo}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<!--后续添加内容-->
</Grid>
</Grid>
</Grid>
</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</UserControl>

+ 1
- 1
FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs Datei anzeigen

@@ -20,7 +20,7 @@ namespace FryPot_DosingSystem.ViewModel
public RelayCommand<string> DeleteDevice { get; set; }
public DeviceListViewModel()
{
Json<DeviceManage>.Read();
//Json<DeviceManage>.Read();
devices = Json<DeviceManage>.Data.Devices;
DeviceName.Add("滚筒输送线");
DeviceName.Add("炒锅1");


+ 6
- 2
FryPot_DosingSystem/ViewModel/HardWareStatusViewModel.cs Datei anzeigen

@@ -13,14 +13,18 @@ namespace FryPot_DosingSystem.ViewModel
internal class HardWareStatusViewModel:ObservableObject
{
private static HardWareStatusViewModel _instance;
public static HardWareStatusViewModel GetInstance=>_instance??=new HardWareStatusViewModel();
public static HardWareStatusViewModel GetInstance => _instance ??= new HardWareStatusViewModel();
public HardWareStatusViewModel()
{
RollerOneModel = new RollerLineBarrelSerialModel();
RollerTwoModel = new RollerLineBarrelSerialModel();
RollerThreeModel = new RollerLineBarrelSerialModel();
}

private int _lineOneOne;
public int LineOneOne { get { return _lineOneOne; }set { _lineOneOne = value;OnPropertyChanged(); } }

/// <summary>
/// 线体1 工位->桶号
/// </summary>


+ 1
- 1
FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs Datei anzeigen

@@ -58,7 +58,7 @@ namespace FryPot_DosingSystem.ViewModel
public void RecipeSetDown(NewRecipeModel recipeModel)
{
ActionManage.GetInstance.Send("RecipeSetDown",recipeModel);
recipeModel.RecipeSetInfo = "下发成功";
}
}


Laden…
Abbrechen
Speichern