This commit is contained in:
anerx 2025-03-29 14:25:16 +08:00
parent 449725e03c
commit 09c6609d7c
7 changed files with 181 additions and 35 deletions

View File

@ -17,22 +17,22 @@ public static class ServiceExtensions
services.AddSingleton<ISqlSugarClient>(s =>
{
//#if RELEASE
SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = connectionString,
IsAutoCloseConnection = true,
}
);
// SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
// {
// DbType = DbType.SqlServer,
// ConnectionString = connectionString,
// IsAutoCloseConnection = true,
// }
// );
//#elif DEBUG
//SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
// {
// DbType = DbType.Sqlite,
// ConnectionString = "Data Source=hyosung.db",
// IsAutoCloseConnection = true,
// InitKeyType = InitKeyType.Attribute
// }
//);
SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
{
DbType = DbType.Sqlite,
ConnectionString = "Data Source=hyosung.db",
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute
}
);
//#endif
return sqlSugar;
});
@ -50,13 +50,14 @@ public static class ServiceExtensions
public static void UseHyosungData(this IServiceProvider provider)
{
//var db = provider.GetRequiredService<ISqlSugarClient>();
//db.DbMaintenance.CreateDatabase();
//db.CodeFirst.InitTables(typeof(VarietyEntity),
// typeof(PalletEntity),
// typeof(ScannedYarnEntity),
// typeof(TrayEntity),
// typeof(AgvBinEntity),
// typeof(DictEntity));
var db = provider.GetRequiredService<ISqlSugarClient>();
db.DbMaintenance.CreateDatabase();
db.CodeFirst.InitTables(typeof(VarietyEntity),
typeof(PalletEntity),
typeof(ScannedYarnEntity),
typeof(TrayEntity),
typeof(AgvBinEntity),
typeof(DictEntity)
);
}
}

View File

@ -38,10 +38,10 @@ public class HyosungRuntime(
public async Task StartAsync(CancellationToken token)
{
reportExportService.ExportNoExportAsync();
//reportExportService.ExportNoExportAsync();
//启动扫码服务
await hyosungScannerService.StartAsync(token);
await printer.StartAsync(token);
// await hyosungScannerService.StartAsync(token);
// await printer.StartAsync(token);
//最后启动PLC服务
hyosungPlcService.OnPlcRequestScanProduct += OnPlcRequestScanProduct;
hyosungPlcService.OnPlcRequestScanFixture += OnPlcRequestScanFixture;
@ -52,7 +52,7 @@ public class HyosungRuntime(
hyosungPlcService.OnRequestPrintLabel += OnPlcRequestPrintLabel;
hyosungPlcService.OnRequestGetPrintLableOption += OnRequestGetPrintLabel;
hyosungPlcService.OnRequestScanEntry += OnPlcRequestScanEntry;
await hyosungPlcService.StartAsync(token);
// await hyosungPlcService.StartAsync(token);
}
private async Task OnPlcRequestScanEntry(int arg)

View File

@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HyosungTester", "HyosungTes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seyounth.Hyosung", "Seyounth.Hyosung\Seyounth.Hyosung.csproj", "{16C5CC9B-FEA9-4B1E-805F-C6DBF5865DC0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{7501BD09-1C80-49A5-AA06-C4254F666407}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

@ -41,15 +41,15 @@ public partial class HomeViewModel : ObservableObject
_yarnCarSide = new();
_yarnCarSide.Add("正面");
_yarnCarSide.Add("反面");
_varieties = new ObservableCollection<Variety>(varietyService.GetAll());
// _varieties = new ObservableCollection<Variety>(varietyService.GetAll());
DispatcherTimer timer = new DispatcherTimer();
timer = new DispatcherTimer();
// 设置定时器间隔,这里设置为 1 秒,可根据实际需求调整
timer.Interval = TimeSpan.FromSeconds(1);
// 为定时器的 Tick 事件添加处理方法
timer.Tick += Timer_Tick;
// 启动定时器
timer.Start();
// timer = new DispatcherTimer();
// // 设置定时器间隔,这里设置为 1 秒,可根据实际需求调整
// timer.Interval = TimeSpan.FromSeconds(1);
// // 为定时器的 Tick 事件添加处理方法
// timer.Tick += Timer_Tick;
// // 启动定时器
// timer.Start();
}
private void Timer_Tick(object? sender, EventArgs e)

View File

@ -32,6 +32,15 @@
<DockPanel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Menu Padding="0,0,30,0">
<MenuItem
Header="Admin">
<MenuItem
Header="Item 1" />
<MenuItem
Header="Item 2" />
</MenuItem>
</Menu>
<Button x:Name="One" Margin="-20,-20,10,-20"
Content="_"
Command="{Binding ViewModel.MinimizeCommand}" />
@ -106,6 +115,38 @@
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel
Width="auto"
Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Label" />
<TextBlock
HorizontalAlignment="Center"
Text="标签管理" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel
Width="auto"
Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Storage" />
<TextBlock
HorizontalAlignment="Center"
Text="入库管理" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel

View File

@ -0,0 +1,91 @@
<Page x:Class="Seyounth.Hyosung.Views.Pages.LabelManagementViewPage"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Seyounth.Hyosung.Views.Pages"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1500"
d:DataContext="{d:DesignInstance local:LabelManagementViewPage,
IsDesignTimeCreatable=True}">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ToolBarTray>
<ToolBar ClipToBounds="False"
Style="{StaticResource MaterialDesignToolBar}">
<ComboBox Margin="8"
FontSize="20"
VerticalAlignment="Center"
Width="400"
materialDesign:HintAssist.Hint="请选择查询条件"
materialDesign:TextFieldAssist.HasClearButton="False"
IsEditable="False"
ItemsSource="{Binding ViewModel.Varieties}"
DisplayMemberPath="Code"
Style="{StaticResource MaterialDesignOutlinedComboBox}">
</ComboBox>
<Button Content="{materialDesign:PackIcon Kind=Search}" />
<Separator />
<TextBox Margin="8"
Width="100"
FontSize="20"
HorizontalContentAlignment="Left"
materialDesign:HintAssist.Hint="LOT"
Style="{StaticResource MaterialDesignOutlinedTextBox}" />
<Button Content="{materialDesign:PackIcon Kind=Search}" />
<Separator />
<DatePickerTextBox>
</DatePickerTextBox>
<Button x:Name="TrayManagerButton"
Content="{materialDesign:PackIcon Kind=ShippingPallet}"
ToolTip="托盘/隔板管理" />
</ToolBar>
</ToolBarTray>
<DataGrid Margin="10" x:Name="LabelManagementDataGrid"
Grid.Row="1"
ItemsSource="{Binding ViewModel.Labels}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
CanUserSortColumns="False"
SelectionMode="Extended"
SelectionUnit="CellOrRowHeader"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
RowDetailsVisibilityMode="VisibleWhenSelected">
<DataGrid.Columns>
<DataGridTextColumn Header="LOT"
Binding="{Binding Code}"
Width="80" />
<DataGridTextColumn Header="品类"
Binding="{Binding Variety.Code}"
Width="120" />
<DataGridTextColumn Header="条码"
Binding="{Binding Variety.Code}"
Width="400" />
<DataGridTextColumn Header="数量"
Binding="{Binding Quantity}"
Width="*" />
<DataGridTextColumn Header="控制号"
Binding="{Binding Status}"
Width="*" />
<DataGridTextColumn Header="贴标时间"
Binding="{Binding Tray}"
Width="*" />
<DataGridCheckBoxColumn Header="已发布"
Binding="{Binding Pallet}"
Width="80" />
<DataGridTextColumn Header="操作"
Binding="{Binding Pallet}"
Width="140" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Page>

View File

@ -0,0 +1,11 @@
using System.Windows.Controls;
namespace Seyounth.Hyosung.Views.Pages;
public partial class LabelManagementViewPage : Page
{
public LabelManagementViewPage()
{
InitializeComponent();
}
}