Explorar el Código

1. 修改字体大小。2. 恢复配方当前工位更新程序。

master
Nah hace 1 año
padre
commit
4d5262a352
Se han modificado 14 ficheros con 121 adiciones y 68 borrados
  1. +4
    -1
      BPA.SingleDevice/Business/Conveyer.cs
  2. +27
    -10
      BPA.SingleDevice/Business/ProcessControl.cs
  3. +10
    -10
      BPA.SingleDevice/View/AddRawMaterialDialogView.xaml
  4. +1
    -1
      BPA.SingleDevice/View/DebugLogView.xaml
  5. +11
    -11
      BPA.SingleDevice/View/NewRecipeView.xaml
  6. +5
    -5
      BPA.SingleDevice/View/RawMaterialManagementView.xaml
  7. +6
    -6
      BPA.SingleDevice/View/RecipeCompletView.xaml
  8. +6
    -3
      BPA.SingleDevice/View/RecipeManagementView.xaml
  9. +5
    -5
      BPA.SingleDevice/View/RecipeStatusView.xaml
  10. +13
    -4
      BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs
  11. +11
    -4
      BPA.SingleDevice/ViewModel/OrderMainViewModel.cs
  12. +11
    -5
      BPA.SingleDevice/ViewModel/RawMaterialManagementViewModel.cs
  13. +10
    -3
      BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs
  14. +1
    -0
      BPA.SingleDevice/ViewModel/VarMonitorViewModel.cs

+ 4
- 1
BPA.SingleDevice/Business/Conveyer.cs Ver fichero

@@ -153,7 +153,10 @@ namespace BPA.SingleDevice.Business
{
try
{
return modbus.Write<ushort>("VW0".ToModbusAdd(), 0).IsSuccess;
var result1= modbus.Write<bool>("M0.2".ToModbusAdd(), false).IsSuccess;
var result2= modbus.Write<ushort>("VW0".ToModbusAdd(), 0).IsSuccess;

return result1 && result2;
}
catch (Exception ex)
{


+ 27
- 10
BPA.SingleDevice/Business/ProcessControl.cs Ver fichero

@@ -68,9 +68,11 @@ namespace BPA.SingleDevice.Business

#endregion 实例初始化配料机

Conveyer.SetCommParam(1, "192.168.6.104", 508);
//Conveyer.SetCommParam(1, "192.168.6.104", 508);
//Conveyer.SetCommParam(1, "127.0.0.1",510);
await Conveyer.Initial();
//await Conveyer.Initial();

InitalConveyer(Json<ConnectConfig>.Data.ConveyerConfigs);

CurrentRecipes.Clear();
ActionRegister();
@@ -299,10 +301,8 @@ namespace BPA.SingleDevice.Business
break;

case MoveConveyerStep.MoveComplete:
if (UpdateRecipeCurrentSataion())
{
global.MoveConveyerStep = MoveConveyerStep.WaitMove;
}
UpdateRecipe();
global.MoveConveyerStep = MoveConveyerStep.WaitMove;
break;
}
//}
@@ -428,6 +428,10 @@ namespace BPA.SingleDevice.Business
/// <param name="configs"></param>
private async void InitalBatcher(IList<BatcherConfig> configs)
{
if (configs is null || configs.Count == 0)
{
throw new ArgumentNullException("配置数据为Null");
}
foreach (var item in configs)
{
if (item.IsConnect)
@@ -441,7 +445,21 @@ namespace BPA.SingleDevice.Business
await batcher.Initial();
}
}

private async void InitalConveyer(IList<ConveyerConfig> configs)
{
if (configs is null || configs.Count==0)
{
throw new ArgumentNullException("配置数据为Null");
}
foreach (var item in configs)
{
if (item.IsConnect)
{
Conveyer.SetCommParam(item.ID, item.IP, item.Port);
await Conveyer.Initial();
}
}
}
/// <summary>刷新配方的当前工站。</summary>
private void UpdateRecipe()
{
@@ -451,7 +469,7 @@ namespace BPA.SingleDevice.Business
{
while (!Conveyer.HaveVessel[item.CurrentStation])
{
logService.LogRunInfo($"未检测到配方【{item.Name}】在工位【{item.CurrentStation + 1}】的容器到位信号,请检查。");
logService.LogRunInfo($"更新工位时,未检测到配方【{item.Name}】在工位【{item.CurrentStation + 1}】的容器到位信号,请检查。");
Task.Delay(3000).Wait();
}
item.CurrentStation++;
@@ -472,8 +490,7 @@ namespace BPA.SingleDevice.Business
}
else
{
logService.LogRunInfo($"未检测到配方【{item.Name}】在工位【{item.CurrentStation + 1}】的容器到位信号,请检查。");
Task.Delay(3000).Wait();
logService.LogRunInfo($"更新配方当前工位时,未检测到配方【{item.Name}】在工位【{item.CurrentStation + 1}】的容器到位信号,请检查。");
result = false;
}
}


+ 10
- 10
BPA.SingleDevice/View/AddRawMaterialDialogView.xaml Ver fichero

@@ -17,7 +17,7 @@

<Grid Margin="10" bpa:PanelHelper.Spacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="160" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -32,13 +32,13 @@
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Right"
FontSize="16"
FontSize="22"
Foreground="#ddd"
Text="原料名称:" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="340"
Width="220" Height="50" FontSize="22"
Style="{StaticResource DarkTextBox}"
Text="{Binding RawMaterResultInfo.Name}" />

@@ -46,12 +46,12 @@
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
FontSize="16"
FontSize="22"
Foreground="#ddd"
Text="设备对应工位:" />
<ComboBox
Grid.Row="1"
Grid.Column="1"
Grid.Column="1" Height="50" FontSize="22"
ItemsSource="{Binding DeviceNums}"
SelectedIndex="0"
Text="{Binding RawMaterResultInfo.DeviceNum}" />
@@ -60,12 +60,12 @@
Grid.Row="2"
Grid.Column="0"
HorizontalAlignment="Right"
FontSize="16"
FontSize="22"
Foreground="#ddd"
Text="设备料仓编号:" />
<ComboBox
Grid.Row="2"
Grid.Column="1"
Grid.Column="1" Height="50" FontSize="22"
ItemsSource="{Binding ChNum}"
SelectedIndex="0"
Text="{Binding RawMaterResultInfo.ChNum}" />
@@ -73,18 +73,18 @@
<Grid
Grid.Row="3"
Grid.ColumnSpan="2"
Margin="0,5"
Margin="0,5" Height="50"
bpa:PanelHelper.Spacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Grid.Column="0" FontSize="22"
Command="{Binding SaveCommand}"
Content="确认" />
<Button
Grid.Column="1"
Grid.Column="1" FontSize="22"
Command="{Binding CancelCommand}"
Content="取消" />
</Grid>


+ 1
- 1
BPA.SingleDevice/View/DebugLogView.xaml Ver fichero

@@ -76,7 +76,7 @@
GridLinesVisibility="All"
IsReadOnly="True"
ItemsSource="{Binding Logs}"
RowHeight="50"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn


+ 11
- 11
BPA.SingleDevice/View/NewRecipeView.xaml Ver fichero

@@ -17,21 +17,21 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="60" />
<RowDefinition />
<RowDefinition Height="40" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>

<Grid Margin="10,0" bpa:GridHelper.Columns="2">
<TextBlock FontSize="16" Text="配方名称:" />
<TextBlock FontSize="22" Text="配方名称:" />
<TextBox
Grid.Column="1"
Margin="0,5"
Margin="0,5" Height="50" FontSize="22"
Style="{StaticResource DarkTextBox}"
Text="{Binding RecipeName}" />
</Grid>

<ScrollViewer Grid.Row="1">
<ScrollViewer Grid.Row="1" bpa:ScrollViewerHelper.ScrollBarSize="40" Width="780" Height="780">
<ListView ItemsSource="{Binding NewRecipeModels}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
@@ -41,19 +41,19 @@
<ListView.ItemTemplate>
<DataTemplate>
<UniformGrid
Width="250"
Margin="5,0,0,0"
Width="330"
Margin="5,0,0,0" Height="40"
HorizontalAlignment="Right"
bpa:GridHelper.ColumnDefinitions="Auto,Auto"
Columns="2">
<CheckBox
Margin="10,5"
Content="{Binding Name}"
FontSize="16"
FontSize="22"
IsChecked="{Binding IsChecked}" />
<TextBox
Grid.Column="1"
Width="100"
Width="140" FontSize="22"
IsEnabled="{Binding IsChecked}"
Text="{Binding Weight}" />
</UniformGrid>
@@ -68,11 +68,11 @@
bpa:GridHelper.ColumnDefinitions="*,*"
bpa:PanelHelper.Spacing="10">
<Button
Grid.Column="0"
Grid.Column="0" FontSize="22"
Command="{Binding SaveCommand}"
Content="确认" />
<Button
Grid.Column="1"
Grid.Column="1" FontSize="22"
Command="{Binding CancelCommand}"
Content="取消" />
</Grid>


+ 5
- 5
BPA.SingleDevice/View/RawMaterialManagementView.xaml Ver fichero

@@ -25,12 +25,12 @@
<!--#region 功能按钮-->
<StackPanel
Grid.Row="0"
Margin="10"
Margin="5"
HorizontalAlignment="Right"
bpa:PanelHelper.Spacing="15"
Orientation="Horizontal">
<Button
Width="100"
Width="120"
HorizontalAlignment="Right"
Command="{Binding AddCommand}"
Content="添加原料"
@@ -46,7 +46,7 @@
<!--#endregion-->

<!--#region 列表-->
<bpa:ControlDisplay Grid.Row="1">
<bpa:ControlDisplay Grid.Row="1" >
<DataGrid
Grid.Row="1"
AutoGenerateColumns="False"
@@ -75,7 +75,7 @@
Binding="{Binding Name}"
Header="原料名称" />
<DataGridTextColumn
Width="100"
Width="120"
Binding="{Binding DeviceNum}"
Header="设备编号" />
<DataGridTextColumn
@@ -107,7 +107,7 @@
<bpa:Icon Type="CopyleftFill" />
</Button>-->
<Button
Width="150"
Width="100"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=local:RawMaterialManagementView}}"
CommandParameter="{Binding Id}"
Style="{StaticResource TextErrorButton}">


+ 6
- 6
BPA.SingleDevice/View/RecipeCompletView.xaml Ver fichero

@@ -12,7 +12,7 @@
<bpa:DialogContainer>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="70" />
<RowDefinition />
</Grid.RowDefinitions>

@@ -27,7 +27,7 @@
<StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=IsShowHistory, Path=IsChecked, Converter={StaticResource BooleanToVisibleConverter}}">
<TextBlock Margin="5,0" Text="开始日期:" />
<DatePicker
Width="150"
Width="200"
bpa:ControlHelper.FocusBorderBrush="{DynamicResource Accent}"
bpa:ControlHelper.MouseOverBrush="{DynamicResource Accent}"
bpa:InputBoxHelper.IsClearable="True"
@@ -36,7 +36,7 @@
SelectedDateFormat="Short" />
<TextBlock Margin="5,0" Text="结束日期:" />
<DatePicker
Width="150"
Width="200"
bpa:ControlHelper.FocusBorderBrush="{DynamicResource Accent}"
bpa:ControlHelper.MouseOverBrush="{DynamicResource Accent}"
bpa:InputBoxHelper.IsClearable="True"
@@ -82,17 +82,17 @@
<DataGridTextColumn
Width="150"
Binding="{Binding Date}"
FontSize="16"
FontSize="22"
Header="日期" />
<DataGridTextColumn
Width="150"
Binding="{Binding Time}"
FontSize="16"
FontSize="22"
Header="时间" />
<DataGridTextColumn
Width="*"
Binding="{Binding RecipeName}"
FontSize="16"
FontSize="22"
Header="配方名称" />
</DataGrid.Columns>
</DataGrid>


+ 6
- 3
BPA.SingleDevice/View/RecipeManagementView.xaml Ver fichero

@@ -25,11 +25,12 @@
<!--#region 功能按钮-->
<StackPanel
Grid.Row="0"
Margin="10"
Margin="5"
HorizontalAlignment="Right"
bpa:PanelHelper.Spacing="15"
Orientation="Horizontal">
<Button
Width="120"
HorizontalAlignment="Right"
Command="{Binding AddCommand}"
Content="添加配方"
@@ -73,7 +74,8 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Width="150"
<Button
Width="150"
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=local:RecipeManagementView}}"
CommandParameter="{Binding Id}"
Foreground="#2196F3"
@@ -87,7 +89,8 @@
Style="{StaticResource TextButton}">
<bpa:Icon Type="CopyleftFill" />
</Button>-->
<Button Width="150"
<Button
Width="100"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=local:RecipeManagementView}}"
CommandParameter="{Binding Id}"
Style="{StaticResource TextErrorButton}">


+ 5
- 5
BPA.SingleDevice/View/RecipeStatusView.xaml Ver fichero

@@ -69,18 +69,18 @@
Binding="{Binding Name}"
Header="配方名称" />
<DataGridTextColumn
Width="240"
Binding="{Binding IssueTime}"
Width="260"
Binding="{Binding IssueTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
Header="下发时间" />
<DataGridTextColumn
Width="240"
Binding="{Binding StartTime}"
Width="260"
Binding="{Binding StartTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"
Header="开始时间" />
<DataGridTextColumn
Width="120"
Binding="{Binding CurrentStation}"
Header="当前工站" />
<DataGridTextColumn Width="180" Header="当前工站进度">
<DataGridTextColumn Width="240" Header="当前工站进度">
<DataGridTextColumn.Binding>
<MultiBinding Converter="{StaticResource DictionaryValueMultiConverter}">
<Binding Path="BatchStatus" />


+ 13
- 4
BPA.SingleDevice/ViewModel/NewRecipeViewModel.cs Ver fichero

@@ -1,14 +1,23 @@
namespace BPA.SingleDevice.ViewModel
using BPA.Model;

namespace BPA.SingleDevice.ViewModel
{
public class NewRecipeViewModel : NotifyBase, IDialogDataContext
{
public NewRecipeViewModel()
{
SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
Task.Run(() =>
{
s.ForEach(item =>
SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
{
NewRecipeModels.Add(new NewRecipeModel() { Name = item.Name, Id = item.Id });
App.Current.Dispatcher.Invoke(() =>
{
s.ForEach(item =>
{
NewRecipeModels.Add(new NewRecipeModel() { Name = item.Name, Id = item.Id });

});
});
});
});



+ 11
- 4
BPA.SingleDevice/ViewModel/OrderMainViewModel.cs Ver fichero

@@ -13,14 +13,21 @@ namespace BPA.SingleDevice.ViewModel
{
this.logService = logService;
this.global = global;
SqlHelper.GetInstance.GetListAsync<RecipeTB>().Result.OnSuccess(s =>
Task.Run(() =>
{
s.ForEach(item =>
SqlHelper.GetInstance.GetListAsync<RecipeTB>().Result.OnSuccess(s =>
{
if (item.IsEnable)
Goods.Add(new RecipeModel() { Id = item.Id, Name = item.Name, Count = 1 });
App.Current.Dispatcher.Invoke(() =>
{
s.ForEach(item =>
{
if (item.IsEnable)
Goods.Add(new RecipeModel() { Id = item.Id, Name = item.Name, Count = 1 });
});
});
});
});

RawMaters = SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.Content;



+ 11
- 5
BPA.SingleDevice/ViewModel/RawMaterialManagementViewModel.cs Ver fichero

@@ -9,15 +9,20 @@ namespace BPA.SingleDevice.ViewModel
public RawMaterialManagementViewModel(ILogService logService)
{
this.logService = logService;

SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
Task.Run(() =>
{
s.ForEach(item =>
SqlHelper.GetInstance.GetListAsync<RawMaterTB>().Result.OnSuccess(s =>
{
RawMaterInfos.Add(new RawMaterInfo(item.Id, item.Name, item.DeviceNum, item.WarehouseNum, item.LastModified));
App.Current.Dispatcher.Invoke(() =>
{
s.ForEach(item =>
{
RawMaterInfos.Add(new RawMaterInfo(item.Id, item.Name, item.DeviceNum, item.WarehouseNum, item.LastModified));
});
});
});
});

AddCommand = new BPARelayCommand(async () =>
{
var content = new AddRawMaterialDialogView();
@@ -107,6 +112,7 @@ namespace BPA.SingleDevice.ViewModel
});
}

public ObservableCollection<RawMaterInfo> RawMaterInfos { get; set; } = new ObservableCollection<RawMaterInfo>();

public BPARelayCommand AddCommand { get; set; }


+ 10
- 3
BPA.SingleDevice/ViewModel/RecipeManagementViewModel.cs Ver fichero

@@ -4,14 +4,21 @@
{
public RecipeManagementViewModel()
{
SqlHelper.GetInstance.GetListAsync<RecipeTB>().Result.OnSuccess(s =>
Task.Run(() =>
{
s.ForEach(item =>
SqlHelper.GetInstance.GetListAsync<RecipeTB>().Result.OnSuccess(s =>
{
RecipeInfos.Add(new RecipeInfo() { Id = item.Id, IsEnable = item.IsEnable, Name = item.Name, LastModified = item.LastModified });
App.Current.Dispatcher.Invoke(() =>
{
s.ForEach(item =>
{
RecipeInfos.Add(new RecipeInfo() { Id = item.Id, IsEnable = item.IsEnable, Name = item.Name, LastModified = item.LastModified });
});
});
});
});


AddCommand = new BPARelayCommand(async () =>
{
var content = new NewRecipeView();


+ 1
- 0
BPA.SingleDevice/ViewModel/VarMonitorViewModel.cs Ver fichero

@@ -16,6 +16,7 @@ namespace BPA.SingleDevice.ViewModel
TaskManage.GetInstance.StartLong(() =>
{
UpdateValue(global);
Task.Delay(100).Wait();
}, "UpdateValue", true);
}



Cargando…
Cancelar
Guardar