正在显示
41 个修改的文件
包含
753 行增加
和
55 行删除
| @@ -18,6 +18,8 @@ public partial class AppShell : Shell | @@ -18,6 +18,8 @@ public partial class AppShell : Shell | ||
| 18 | Routing.RegisterRoute(nameof(Pages.OutboundMaterialPage), typeof(Pages.OutboundMaterialPage)); | 18 | Routing.RegisterRoute(nameof(Pages.OutboundMaterialPage), typeof(Pages.OutboundMaterialPage)); |
| 19 | Routing.RegisterRoute(nameof(Pages.OutboundFinishedPage), typeof(Pages.OutboundFinishedPage)); | 19 | Routing.RegisterRoute(nameof(Pages.OutboundFinishedPage), typeof(Pages.OutboundFinishedPage)); |
| 20 | Routing.RegisterRoute(nameof(Pages.OutboundFinishedSearchPage), typeof(Pages.OutboundFinishedSearchPage)); | 20 | Routing.RegisterRoute(nameof(Pages.OutboundFinishedSearchPage), typeof(Pages.OutboundFinishedSearchPage)); |
| 21 | + Routing.RegisterRoute(nameof(Pages.WorkOrderSearchPage), typeof(Pages.WorkOrderSearchPage)); | ||
| 22 | + Routing.RegisterRoute(nameof(Pages.MoldOutboundExecutePage), typeof(Pages.MoldOutboundExecutePage)); | ||
| 21 | BuildTabs(authed); | 23 | BuildTabs(authed); |
| 22 | } | 24 | } |
| 23 | 25 |
| @@ -79,22 +79,24 @@ | @@ -79,22 +79,24 @@ | ||
| 79 | <CopyToOutputDirectory>Always</CopyToOutputDirectory> | 79 | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| 80 | </MauiAsset> | 80 | </MauiAsset> |
| 81 | </ItemGroup> | 81 | </ItemGroup> |
| 82 | - | ||
| 83 | <ItemGroup> | 82 | <ItemGroup> |
| 83 | + <PackageReference Include="CommunityToolkit.Maui" Version="8.0.1" /> | ||
| 84 | <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> | 84 | <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> |
| 85 | - <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0" /> | ||
| 86 | - <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.0" /> | 85 | + </ItemGroup> |
| 86 | + | ||
| 87 | + | ||
| 88 | + <ItemGroup> | ||
| 87 | <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" /> | 89 | <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" /> |
| 88 | </ItemGroup> | 90 | </ItemGroup> |
| 89 | 91 | ||
| 90 | <ItemGroup> | 92 | <ItemGroup> |
| 91 | - <Compile Update="Pages\OutboundMaterialSearchPage.xaml.cs"> | 93 | + <Compile Update="Pages\WarehouseOperations\OutboundMaterialSearchPage.xaml.cs"> |
| 92 | <DependentUpon>OutboundMaterialSearchPage.xaml</DependentUpon> | 94 | <DependentUpon>OutboundMaterialSearchPage.xaml</DependentUpon> |
| 93 | </Compile> | 95 | </Compile> |
| 94 | - <Compile Update="Pages\OutboundFinishedSearchPage.xaml.cs"> | 96 | + <Compile Update="Pages\WarehouseOperations\OutboundFinishedSearchPage.xaml.cs"> |
| 95 | <DependentUpon>OutboundFinishedSearchPage.xaml</DependentUpon> | 97 | <DependentUpon>OutboundFinishedSearchPage.xaml</DependentUpon> |
| 96 | </Compile> | 98 | </Compile> |
| 97 | - <Compile Update="Pages\InboundProductionSearchPage.xaml.cs"> | 99 | + <Compile Update="Pages\WarehouseOperations\InboundProductionSearchPage.xaml.cs"> |
| 98 | <DependentUpon>InboundProductionSearchPage.xaml</DependentUpon> | 100 | <DependentUpon>InboundProductionSearchPage.xaml</DependentUpon> |
| 99 | </Compile> | 101 | </Compile> |
| 100 | </ItemGroup> | 102 | </ItemGroup> |
| @@ -106,31 +108,37 @@ | @@ -106,31 +108,37 @@ | ||
| 106 | <MauiXaml Update="Pages\AdminPage.xaml"> | 108 | <MauiXaml Update="Pages\AdminPage.xaml"> |
| 107 | <Generator>MSBuild:Compile</Generator> | 109 | <Generator>MSBuild:Compile</Generator> |
| 108 | </MauiXaml> | 110 | </MauiXaml> |
| 109 | - <MauiXaml Update="Pages\BinListPage.xaml"> | 111 | + <MauiXaml Update="Pages\ProductionOperations\MoldOutboundExecutePage.xaml"> |
| 112 | + <Generator>MSBuild:Compile</Generator> | ||
| 113 | + </MauiXaml> | ||
| 114 | + <MauiXaml Update="Pages\ProductionOperations\WorkOrderSearchPage.xaml"> | ||
| 115 | + <Generator>MSBuild:Compile</Generator> | ||
| 116 | + </MauiXaml> | ||
| 117 | + <MauiXaml Update="Pages\WarehouseOperations\BinListPage.xaml"> | ||
| 110 | <Generator>MSBuild:Compile</Generator> | 118 | <Generator>MSBuild:Compile</Generator> |
| 111 | </MauiXaml> | 119 | </MauiXaml> |
| 112 | - <MauiXaml Update="Pages\BinPickerPage.xaml"> | 120 | + <MauiXaml Update="Pages\WarehouseOperations\BinPickerPage.xaml"> |
| 113 | <Generator>MSBuild:Compile</Generator> | 121 | <Generator>MSBuild:Compile</Generator> |
| 114 | </MauiXaml> | 122 | </MauiXaml> |
| 115 | <MauiXaml Update="Pages\HomePage.xaml"> | 123 | <MauiXaml Update="Pages\HomePage.xaml"> |
| 116 | <Generator>MSBuild:Compile</Generator> | 124 | <Generator>MSBuild:Compile</Generator> |
| 117 | </MauiXaml> | 125 | </MauiXaml> |
| 118 | - <MauiXaml Update="Pages\InboundMaterialPage.xaml"> | 126 | + <MauiXaml Update="Pages\WarehouseOperations\InboundMaterialPage.xaml"> |
| 119 | <Generator>MSBuild:Compile</Generator> | 127 | <Generator>MSBuild:Compile</Generator> |
| 120 | </MauiXaml> | 128 | </MauiXaml> |
| 121 | - <MauiXaml Update="Pages\OutboundMaterialSearchPage.xaml"> | 129 | + <MauiXaml Update="Pages\WarehouseOperations\OutboundMaterialSearchPage.xaml"> |
| 122 | <Generator>MSBuild:Compile</Generator> | 130 | <Generator>MSBuild:Compile</Generator> |
| 123 | </MauiXaml> | 131 | </MauiXaml> |
| 124 | - <MauiXaml Update="Pages\OutboundFinishedSearchPage.xaml"> | 132 | + <MauiXaml Update="Pages\WarehouseOperations\OutboundFinishedSearchPage.xaml"> |
| 125 | <Generator>MSBuild:Compile</Generator> | 133 | <Generator>MSBuild:Compile</Generator> |
| 126 | </MauiXaml> | 134 | </MauiXaml> |
| 127 | - <MauiXaml Update="Pages\InboundProductionSearchPage.xaml"> | 135 | + <MauiXaml Update="Pages\WarehouseOperations\InboundProductionSearchPage.xaml"> |
| 128 | <Generator>MSBuild:Compile</Generator> | 136 | <Generator>MSBuild:Compile</Generator> |
| 129 | </MauiXaml> | 137 | </MauiXaml> |
| 130 | - <MauiXaml Update="Pages\InboundMaterialSearchPage.xaml"> | 138 | + <MauiXaml Update="Pages\WarehouseOperations\InboundMaterialSearchPage.xaml"> |
| 131 | <Generator>MSBuild:Compile</Generator> | 139 | <Generator>MSBuild:Compile</Generator> |
| 132 | </MauiXaml> | 140 | </MauiXaml> |
| 133 | - <MauiXaml Update="Pages\InboundProductionPage.xaml"> | 141 | + <MauiXaml Update="Pages\WarehouseOperations\InboundProductionPage.xaml"> |
| 134 | <Generator>MSBuild:Compile</Generator> | 142 | <Generator>MSBuild:Compile</Generator> |
| 135 | </MauiXaml> | 143 | </MauiXaml> |
| 136 | <MauiXaml Update="Pages\LoginPage.xaml"> | 144 | <MauiXaml Update="Pages\LoginPage.xaml"> |
| @@ -139,10 +147,10 @@ | @@ -139,10 +147,10 @@ | ||
| 139 | <MauiXaml Update="Pages\LogsPage.xaml"> | 147 | <MauiXaml Update="Pages\LogsPage.xaml"> |
| 140 | <Generator>MSBuild:Compile</Generator> | 148 | <Generator>MSBuild:Compile</Generator> |
| 141 | </MauiXaml> | 149 | </MauiXaml> |
| 142 | - <MauiXaml Update="Pages\OutboundFinishedPage.xaml"> | 150 | + <MauiXaml Update="Pages\WarehouseOperations\OutboundFinishedPage.xaml"> |
| 143 | <Generator>MSBuild:Compile</Generator> | 151 | <Generator>MSBuild:Compile</Generator> |
| 144 | </MauiXaml> | 152 | </MauiXaml> |
| 145 | - <MauiXaml Update="Pages\OutboundMaterialPage.xaml"> | 153 | + <MauiXaml Update="Pages\WarehouseOperations\OutboundMaterialPage.xaml"> |
| 146 | <Generator>MSBuild:Compile</Generator> | 154 | <Generator>MSBuild:Compile</Generator> |
| 147 | </MauiXaml> | 155 | </MauiXaml> |
| 148 | </ItemGroup> | 156 | </ItemGroup> |
| 1 | using Microsoft.Extensions.Logging; | 1 | using Microsoft.Extensions.Logging; |
| 2 | using Microsoft.Extensions.DependencyInjection; | 2 | using Microsoft.Extensions.DependencyInjection; |
| 3 | using IndustrialControl.Services; | 3 | using IndustrialControl.Services; |
| 4 | +using CommunityToolkit.Maui; | ||
| 4 | 5 | ||
| 5 | namespace IndustrialControl | 6 | namespace IndustrialControl |
| 6 | { | 7 | { |
| @@ -10,7 +11,8 @@ namespace IndustrialControl | @@ -10,7 +11,8 @@ namespace IndustrialControl | ||
| 10 | { | 11 | { |
| 11 | var builder = MauiApp.CreateBuilder(); | 12 | var builder = MauiApp.CreateBuilder(); |
| 12 | builder | 13 | builder |
| 13 | - .UseMauiApp<App>() | 14 | + .UseMauiApp<App>() |
| 15 | + .UseMauiCommunityToolkit() | ||
| 14 | .ConfigureFonts(fonts => | 16 | .ConfigureFonts(fonts => |
| 15 | { | 17 | { |
| 16 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | 18 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); |
| @@ -44,6 +46,8 @@ namespace IndustrialControl | @@ -44,6 +46,8 @@ namespace IndustrialControl | ||
| 44 | builder.Services.AddTransient<ViewModels.OutboundMaterialSearchViewModel>(); | 46 | builder.Services.AddTransient<ViewModels.OutboundMaterialSearchViewModel>(); |
| 45 | builder.Services.AddTransient<ViewModels.OutboundFinishedViewModel>(); | 47 | builder.Services.AddTransient<ViewModels.OutboundFinishedViewModel>(); |
| 46 | builder.Services.AddTransient<ViewModels.OutboundFinishedSearchViewModel>(); | 48 | builder.Services.AddTransient<ViewModels.OutboundFinishedSearchViewModel>(); |
| 49 | + builder.Services.AddTransient<ViewModels.WorkOrderSearchViewModel>(); | ||
| 50 | + builder.Services.AddTransient<ViewModels.MoldOutboundExecuteViewModel>(); | ||
| 47 | 51 | ||
| 48 | // ===== 注册 Pages(DI 创建)===== | 52 | // ===== 注册 Pages(DI 创建)===== |
| 49 | builder.Services.AddTransient<Pages.LoginPage>(); | 53 | builder.Services.AddTransient<Pages.LoginPage>(); |
| @@ -60,6 +64,10 @@ namespace IndustrialControl | @@ -60,6 +64,10 @@ namespace IndustrialControl | ||
| 60 | builder.Services.AddTransient<Pages.OutboundMaterialSearchPage>(); | 64 | builder.Services.AddTransient<Pages.OutboundMaterialSearchPage>(); |
| 61 | builder.Services.AddTransient<Pages.OutboundFinishedPage>(); | 65 | builder.Services.AddTransient<Pages.OutboundFinishedPage>(); |
| 62 | builder.Services.AddTransient<Pages.OutboundFinishedSearchPage>(); | 66 | builder.Services.AddTransient<Pages.OutboundFinishedSearchPage>(); |
| 67 | + builder.Services.AddTransient<Pages.WorkOrderSearchPage>(); | ||
| 68 | + builder.Services.AddTransient<Pages.MoldOutboundExecutePage>(); | ||
| 69 | + | ||
| 70 | + | ||
| 63 | var app = builder.Build(); | 71 | var app = builder.Build(); |
| 64 | App.Services = app.Services; | 72 | App.Services = app.Services; |
| 65 | return app; | 73 | return app; |
Models/WorkOrderDto.cs
0 → 100644
| 1 | +namespace IndustrialControl.ViewModels; | ||
| 2 | + | ||
| 3 | +public class WorkOrderDto | ||
| 4 | +{ | ||
| 5 | + public string OrderNo { get; set; } = ""; | ||
| 6 | + public string OrderName { get; set; } = ""; | ||
| 7 | + public string Status { get; set; } = ""; | ||
| 8 | + public string ProductName { get; set; } = ""; | ||
| 9 | + public int Quantity { get; set; } | ||
| 10 | + public DateTime CreateDate { get; set; } | ||
| 11 | +} | ||
| 12 | +public class WorkOrderSummary | ||
| 13 | +{ | ||
| 14 | + public string OrderNo { get; set; } = ""; | ||
| 15 | + public string OrderName { get; set; } = ""; | ||
| 16 | + public string Status { get; set; } = ""; | ||
| 17 | + public string ProductName { get; set; } = ""; | ||
| 18 | + public int Quantity { get; set; } | ||
| 19 | + public DateTime CreateDate { get; set; } | ||
| 20 | +} | ||
| 21 | + |
| 1 | <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | 1 | <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | 2 | xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
| 3 | + xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
| 3 | x:Class="IndustrialControl.Pages.HomePage" | 4 | x:Class="IndustrialControl.Pages.HomePage" |
| 4 | - Title="仓储作业"> | 5 | + Title="作业"> |
| 5 | <ContentPage.ToolbarItems> | 6 | <ContentPage.ToolbarItems> |
| 6 | <ToolbarItem Text="退出" Clicked="OnLogoutClicked" /> | 7 | <ToolbarItem Text="退出" Clicked="OnLogoutClicked" /> |
| 7 | </ContentPage.ToolbarItems> | 8 | </ContentPage.ToolbarItems> |
| 8 | 9 | ||
| 9 | - <VerticalStackLayout Padding="24" Spacing="16"> | ||
| 10 | - <Frame Style="{StaticResource BlueCardStyle}"> | ||
| 11 | - <Label Text="物料入库" FontSize="18" TextColor="White" VerticalTextAlignment="Center"/> | ||
| 12 | - <Frame.GestureRecognizers> | ||
| 13 | - <TapGestureRecognizer Tapped="OnInMat" NumberOfTapsRequired="1" /> | ||
| 14 | - </Frame.GestureRecognizers> | ||
| 15 | - </Frame> | ||
| 16 | - | ||
| 17 | - <Frame Style="{StaticResource BlueCardStyle}"> | ||
| 18 | - <Label Text="生产入库" FontSize="18" TextColor="White" VerticalTextAlignment="Center"/> | ||
| 19 | - <Frame.GestureRecognizers> | ||
| 20 | - <TapGestureRecognizer Tapped="OnInProd" NumberOfTapsRequired="1" /> | ||
| 21 | - </Frame.GestureRecognizers> | ||
| 22 | - </Frame> | ||
| 23 | - | ||
| 24 | - <Frame Style="{StaticResource BlueCardStyle}"> | ||
| 25 | - <Label Text="物料出库" FontSize="18" TextColor="White" VerticalTextAlignment="Center"/> | ||
| 26 | - <Frame.GestureRecognizers> | ||
| 27 | - <TapGestureRecognizer Tapped="OnOutMat" NumberOfTapsRequired="1" /> | ||
| 28 | - </Frame.GestureRecognizers> | ||
| 29 | - </Frame> | ||
| 30 | - | ||
| 31 | - <Frame Style="{StaticResource BlueCardStyle}"> | ||
| 32 | - <Label Text="成品出库/装货" FontSize="18" TextColor="White" VerticalTextAlignment="Center"/> | ||
| 33 | - <Frame.GestureRecognizers> | ||
| 34 | - <TapGestureRecognizer Tapped="OnOutFinished" NumberOfTapsRequired="1" /> | ||
| 35 | - </Frame.GestureRecognizers> | ||
| 36 | - </Frame> | ||
| 37 | - | ||
| 38 | - </VerticalStackLayout> | ||
| 39 | -</ContentPage> | 10 | + <ContentPage.Resources> |
| 11 | + <!-- 子项一行样式 --> | ||
| 12 | + <Style TargetType="Grid" x:Key="ItemRow"> | ||
| 13 | + <Setter Property="Padding" Value="0,4"/> | ||
| 14 | + <Setter Property="ColumnDefinitions" Value="Auto,*"/> | ||
| 15 | + </Style> | ||
| 16 | + </ContentPage.Resources> | ||
| 17 | + | ||
| 18 | + <ScrollView> | ||
| 19 | + <VerticalStackLayout Padding="20" Spacing="12"> | ||
| 20 | + | ||
| 21 | + <!-- 一级:仓储作业 --> | ||
| 22 | + <toolkit:Expander> | ||
| 23 | + <toolkit:Expander.Header> | ||
| 24 | + <Grid Padding="12,10" BackgroundColor="#F5F7FA"> | ||
| 25 | + <Label Text="📦 仓储作业" FontSize="18" FontAttributes="Bold"/> | ||
| 26 | + </Grid> | ||
| 27 | + </toolkit:Expander.Header> | ||
| 28 | + | ||
| 29 | + <VerticalStackLayout Spacing="6" Padding="16,6,0,12"> | ||
| 30 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 31 | + <CheckBox x:Name="cbInMat" CheckedChanged="OnInMat"/> | ||
| 32 | + <Label Grid.Column="1" Text="物料入库"> | ||
| 33 | + <Label.GestureRecognizers> | ||
| 34 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbInMat}" /> | ||
| 35 | + </Label.GestureRecognizers> | ||
| 36 | + </Label> | ||
| 37 | + </Grid> | ||
| 38 | + | ||
| 39 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 40 | + <CheckBox x:Name="cbInProd" CheckedChanged="OnInProd"/> | ||
| 41 | + <Label Grid.Column="1" Text="生产入库"> | ||
| 42 | + <Label.GestureRecognizers> | ||
| 43 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbInProd}" /> | ||
| 44 | + </Label.GestureRecognizers> | ||
| 45 | + </Label> | ||
| 46 | + </Grid> | ||
| 47 | + | ||
| 48 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 49 | + <CheckBox x:Name="cbOutMat" CheckedChanged="OnOutMat"/> | ||
| 50 | + <Label Grid.Column="1" Text="物料出库"> | ||
| 51 | + <Label.GestureRecognizers> | ||
| 52 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbOutMat}" /> | ||
| 53 | + </Label.GestureRecognizers> | ||
| 54 | + </Label> | ||
| 55 | + </Grid> | ||
| 56 | + | ||
| 57 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 58 | + <CheckBox x:Name="cbOutFinished" CheckedChanged="OnOutFinished"/> | ||
| 59 | + <Label Grid.Column="1" Text="产成品出库接货"> | ||
| 60 | + <Label.GestureRecognizers> | ||
| 61 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbOutFinished}" /> | ||
| 62 | + </Label.GestureRecognizers> | ||
| 63 | + </Label> | ||
| 64 | + </Grid> | ||
| 65 | + | ||
| 66 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 67 | + <CheckBox x:Name="cbMoldOut"/> | ||
| 68 | + <Label Grid.Column="1" Text="模具出库管理"> | ||
| 69 | + <Label.GestureRecognizers> | ||
| 70 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbMoldOut}" /> | ||
| 71 | + </Label.GestureRecognizers> | ||
| 72 | + </Label> | ||
| 73 | + </Grid> | ||
| 74 | + | ||
| 75 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 76 | + <CheckBox x:Name="cbMoldIn"/> | ||
| 77 | + <Label Grid.Column="1" Text="模具入库管理"> | ||
| 78 | + <Label.GestureRecognizers> | ||
| 79 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbMoldIn}" /> | ||
| 80 | + </Label.GestureRecognizers> | ||
| 81 | + </Label> | ||
| 82 | + </Grid> | ||
| 83 | + </VerticalStackLayout> | ||
| 84 | + </toolkit:Expander> | ||
| 85 | + | ||
| 86 | + <!-- 一级:生产作业 --> | ||
| 87 | + <toolkit:Expander> | ||
| 88 | + <toolkit:Expander.Header> | ||
| 89 | + <Grid Padding="12,10" BackgroundColor="#F5F7FA"> | ||
| 90 | + <Label Text="🏭 生产作业" FontSize="18" FontAttributes="Bold"/> | ||
| 91 | + </Grid> | ||
| 92 | + </toolkit:Expander.Header> | ||
| 93 | + | ||
| 94 | + <VerticalStackLayout Spacing="6" Padding="16,6,0,12"> | ||
| 95 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 96 | + <CheckBox x:Name="cbOrderQry" CheckedChanged="OnOrderQry" /> | ||
| 97 | + <Label Grid.Column="1" Text="工单查询"> | ||
| 98 | + <Label.GestureRecognizers> | ||
| 99 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbOrderQry}" /> | ||
| 100 | + </Label.GestureRecognizers> | ||
| 101 | + </Label> | ||
| 102 | + </Grid> | ||
| 103 | + | ||
| 104 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 105 | + <CheckBox x:Name="cbOpExec"/> | ||
| 106 | + <Label Grid.Column="1" Text="工序任务执行"> | ||
| 107 | + <Label.GestureRecognizers> | ||
| 108 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbOpExec}" /> | ||
| 109 | + </Label.GestureRecognizers> | ||
| 110 | + </Label> | ||
| 111 | + </Grid> | ||
| 112 | + | ||
| 113 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 114 | + <CheckBox x:Name="cbParamLog"/> | ||
| 115 | + <Label Grid.Column="1" Text="参数登记"> | ||
| 116 | + <Label.GestureRecognizers> | ||
| 117 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbParamLog}" /> | ||
| 118 | + </Label.GestureRecognizers> | ||
| 119 | + </Label> | ||
| 120 | + </Grid> | ||
| 121 | + | ||
| 122 | + <Grid Style="{StaticResource ItemRow}"> | ||
| 123 | + <CheckBox x:Name="cbBindDevice"/> | ||
| 124 | + <Label Grid.Column="1" Text="设备扫描绑定"> | ||
| 125 | + <Label.GestureRecognizers> | ||
| 126 | + <TapGestureRecognizer Tapped="OnTapToggle" CommandParameter="{x:Reference cbBindDevice}" /> | ||
| 127 | + </Label.GestureRecognizers> | ||
| 128 | + </Label> | ||
| 129 | + </Grid> | ||
| 130 | + </VerticalStackLayout> | ||
| 131 | + </toolkit:Expander> | ||
| 132 | + | ||
| 133 | + </VerticalStackLayout> | ||
| 134 | + </ScrollView> | ||
| 135 | + </ContentPage> |
| @@ -7,26 +7,48 @@ | @@ -7,26 +7,48 @@ | ||
| 7 | InitializeComponent(); | 7 | InitializeComponent(); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | - private async void OnInMat(object sender, EventArgs e) | 10 | + // 点“文字”也能切换复选框 |
| 11 | + void OnTapToggle(object? sender, TappedEventArgs e) | ||
| 11 | { | 12 | { |
| 13 | + if (e.Parameter is CheckBox cb) | ||
| 14 | + cb.IsChecked = !cb.IsChecked; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + // 勾选即跳转,返回后复位(保持你原有页面名) | ||
| 18 | + private async void OnInMat(object sender, CheckedChangedEventArgs e) | ||
| 19 | + { | ||
| 20 | + if (!e.Value) return; | ||
| 12 | await Shell.Current.GoToAsync(nameof(InboundMaterialSearchPage)); | 21 | await Shell.Current.GoToAsync(nameof(InboundMaterialSearchPage)); |
| 22 | + ((CheckBox)sender).IsChecked = false; | ||
| 13 | } | 23 | } |
| 14 | 24 | ||
| 15 | - private async void OnInProd(object sender, EventArgs e) | 25 | + private async void OnInProd(object sender, CheckedChangedEventArgs e) |
| 16 | { | 26 | { |
| 27 | + if (!e.Value) return; | ||
| 17 | await Shell.Current.GoToAsync(nameof(InboundProductionSearchPage)); | 28 | await Shell.Current.GoToAsync(nameof(InboundProductionSearchPage)); |
| 29 | + ((CheckBox)sender).IsChecked = false; | ||
| 18 | } | 30 | } |
| 19 | 31 | ||
| 20 | - private async void OnOutMat(object sender, EventArgs e) | 32 | + private async void OnOutMat(object sender, CheckedChangedEventArgs e) |
| 21 | { | 33 | { |
| 34 | + if (!e.Value) return; | ||
| 22 | await Shell.Current.GoToAsync(nameof(OutboundMaterialSearchPage)); | 35 | await Shell.Current.GoToAsync(nameof(OutboundMaterialSearchPage)); |
| 36 | + ((CheckBox)sender).IsChecked = false; | ||
| 23 | } | 37 | } |
| 24 | 38 | ||
| 25 | - private async void OnOutFinished(object sender, EventArgs e) | 39 | + private async void OnOutFinished(object sender, CheckedChangedEventArgs e) |
| 26 | { | 40 | { |
| 41 | + if (!e.Value) return; | ||
| 27 | await Shell.Current.GoToAsync(nameof(OutboundFinishedSearchPage)); | 42 | await Shell.Current.GoToAsync(nameof(OutboundFinishedSearchPage)); |
| 43 | + ((CheckBox)sender).IsChecked = false; | ||
| 28 | } | 44 | } |
| 29 | - | 45 | + private async void OnOrderQry(object sender, CheckedChangedEventArgs e) |
| 46 | + { | ||
| 47 | + if (!e.Value) return; | ||
| 48 | + await Shell.Current.GoToAsync(nameof(WorkOrderSearchPage)); | ||
| 49 | + ((CheckBox)sender).IsChecked = false; | ||
| 50 | + } | ||
| 51 | + | ||
| 30 | // 新增:退出登录 | 52 | // 新增:退出登录 |
| 31 | private async void OnLogoutClicked(object? sender, EventArgs e) | 53 | private async void OnLogoutClicked(object? sender, EventArgs e) |
| 32 | { | 54 | { |
| 1 | +<?xml version="1.0" encoding="utf-8" ?> | ||
| 2 | +<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| 4 | + x:Class="IndustrialControl.Pages.MoldOutboundExecutePage" | ||
| 5 | + Title="出库执行"> | ||
| 6 | + | ||
| 7 | + <ContentPage.Resources> | ||
| 8 | + <!-- 表头与行样式 --> | ||
| 9 | + <Style TargetType="Grid" x:Key="TableHeader"> | ||
| 10 | + <Setter Property="BackgroundColor" Value="#F5F7FA"/> | ||
| 11 | + <Setter Property="Padding" Value="8,6"/> | ||
| 12 | + <Setter Property="ColumnSpacing" Value="8"/> | ||
| 13 | + </Style> | ||
| 14 | + <Style TargetType="Grid" x:Key="TableRow"> | ||
| 15 | + <Setter Property="Padding" Value="8,6"/> | ||
| 16 | + <Setter Property="ColumnSpacing" Value="8"/> | ||
| 17 | + </Style> | ||
| 18 | + </ContentPage.Resources> | ||
| 19 | + | ||
| 20 | + <Grid RowDefinitions="Auto,*,Auto"> | ||
| 21 | + | ||
| 22 | + <!-- 顶部蓝条 --> | ||
| 23 | + <Grid Grid.Row="0" BackgroundColor="#007BFF" HeightRequest="56" Padding="16,0"> | ||
| 24 | + <Label Text="仓储管理系统" | ||
| 25 | + VerticalOptions="Center" | ||
| 26 | + TextColor="White" FontSize="18" FontAttributes="Bold"/> | ||
| 27 | + </Grid> | ||
| 28 | + | ||
| 29 | + <!-- 主体 --> | ||
| 30 | + <ScrollView Grid.Row="1"> | ||
| 31 | + <VerticalStackLayout Padding="12" Spacing="12"> | ||
| 32 | + | ||
| 33 | + <!-- 模具编码 --> | ||
| 34 | + <Grid ColumnDefinitions="Auto,*" ColumnSpacing="12"> | ||
| 35 | + <Label Text="模具编码" VerticalTextAlignment="Center" /> | ||
| 36 | + <Entry x:Name="MoldEntry" | ||
| 37 | + Grid.Column="1" | ||
| 38 | + Placeholder="请扫描模具或输入具编码" | ||
| 39 | + Completed="OnMoldCompleted" /> | ||
| 40 | + | ||
| 41 | + </Grid> | ||
| 42 | + | ||
| 43 | + <!-- 需求基础信息 --> | ||
| 44 | + <Label Text="需求基础信息" FontAttributes="Bold" /> | ||
| 45 | + <Frame Padding="0" HasShadow="False" BorderColor="#E0E6EF"> | ||
| 46 | + <VerticalStackLayout Spacing="0"> | ||
| 47 | + <!-- 顶部两列 --> | ||
| 48 | + <Grid ColumnDefinitions="*,*" Style="{StaticResource TableHeader}"> | ||
| 49 | + <Grid ColumnDefinitions="Auto,*"> | ||
| 50 | + <Label Text="工单号:" /> | ||
| 51 | + <Label Grid.Column="1" Text="{Binding OrderNo}" /> | ||
| 52 | + </Grid> | ||
| 53 | + <Grid Grid.Column="1" ColumnDefinitions="Auto,*"> | ||
| 54 | + <Label Text="产品名称:" /> | ||
| 55 | + <Label Grid.Column="1" Text="XXXXX" /> | ||
| 56 | + <!-- 需要时可绑定到 VM 的 ProductName --> | ||
| 57 | + </Grid> | ||
| 58 | + </Grid> | ||
| 59 | + | ||
| 60 | + <!-- 模具型号表(示例样式;后续可替换为绑定集合) --> | ||
| 61 | + <Grid Padding="8,6" ColumnDefinitions="Auto,*" BackgroundColor="#FFFFFF"> | ||
| 62 | + <Label Text="序号" FontAttributes="Bold"/> | ||
| 63 | + <Label Grid.Column="1" Text="模具型号" FontAttributes="Bold"/> | ||
| 64 | + </Grid> | ||
| 65 | + <Grid Padding="8,6" ColumnDefinitions="Auto,*"> | ||
| 66 | + <Label Text="1"/> | ||
| 67 | + <Label Grid.Column="1" Text="MU_DHJD_01"/> | ||
| 68 | + </Grid> | ||
| 69 | + <Grid Padding="8,6" ColumnDefinitions="Auto,*"> | ||
| 70 | + <Label Text="2"/> | ||
| 71 | + <Label Grid.Column="1" Text="MU_DHJD_02"/> | ||
| 72 | + </Grid> | ||
| 73 | + </VerticalStackLayout> | ||
| 74 | + </Frame> | ||
| 75 | + | ||
| 76 | + <!-- 扫描明细 --> | ||
| 77 | + <Label Text="扫描明细" TextColor="#17A673" FontAttributes="Bold" /> | ||
| 78 | + | ||
| 79 | + <!-- 表头 --> | ||
| 80 | + <Grid ColumnDefinitions="40,Auto,*,*,Auto,*" | ||
| 81 | + Style="{StaticResource TableHeader}"> | ||
| 82 | + <Label Text="#" /> | ||
| 83 | + <Label Grid.Column="1" Text="选择" /> | ||
| 84 | + <Label Grid.Column="2" Text="模具编码" /> | ||
| 85 | + <Label Grid.Column="3" Text="模具型号" /> | ||
| 86 | + <Label Grid.Column="4" Text="出库数量" /> | ||
| 87 | + <Label Grid.Column="5" Text="出库库位" /> | ||
| 88 | + </Grid> | ||
| 89 | + | ||
| 90 | + <!-- 明细列表 --> | ||
| 91 | + <CollectionView ItemsSource="{Binding ScanDetails}"> | ||
| 92 | + <CollectionView.ItemTemplate> | ||
| 93 | + <DataTemplate> | ||
| 94 | + <Grid ColumnDefinitions="40,Auto,*,*,Auto,*" | ||
| 95 | + Style="{StaticResource TableRow}"> | ||
| 96 | + <!-- 背景根据 Selected 高亮为绿色 --> | ||
| 97 | + <Grid.Triggers> | ||
| 98 | + <DataTrigger TargetType="Grid" Binding="{Binding Selected}" Value="True"> | ||
| 99 | + <Setter Property="BackgroundColor" Value="#6EF593"/> | ||
| 100 | + </DataTrigger> | ||
| 101 | + </Grid.Triggers> | ||
| 102 | + | ||
| 103 | + <Label Text="{Binding Index}" /> | ||
| 104 | + <CheckBox Grid.Column="1" IsChecked="{Binding Selected, Mode=TwoWay}" /> | ||
| 105 | + <Label Grid.Column="2" Text="{Binding MoldCode}" /> | ||
| 106 | + <Label Grid.Column="3" Text="{Binding MoldModel}" /> | ||
| 107 | + <Label Grid.Column="4" Text="{Binding Qty}" HorizontalTextAlignment="Center" /> | ||
| 108 | + <Label Grid.Column="5" Text="{Binding Bin}" /> | ||
| 109 | + </Grid> | ||
| 110 | + </DataTemplate> | ||
| 111 | + </CollectionView.ItemTemplate> | ||
| 112 | + </CollectionView> | ||
| 113 | + | ||
| 114 | + </VerticalStackLayout> | ||
| 115 | + </ScrollView> | ||
| 116 | + | ||
| 117 | + <!-- 底部操作条 --> | ||
| 118 | + <Grid Grid.Row="2" BackgroundColor="White" Padding="16,8" ColumnDefinitions="*,Auto,*"> | ||
| 119 | + <!-- 取消扫描 --> | ||
| 120 | + <Button Grid.Column="0" | ||
| 121 | + Text="取消扫描" | ||
| 122 | + TextColor="#C62828" | ||
| 123 | + BorderColor="#C62828" | ||
| 124 | + BorderWidth="1" | ||
| 125 | + CornerRadius="8" | ||
| 126 | + Command="{Binding CancelScanCommand}" /> | ||
| 127 | + | ||
| 128 | + <!-- 占位间距 --> | ||
| 129 | + <BoxView Grid.Column="1" WidthRequest="16" /> | ||
| 130 | + | ||
| 131 | + <!-- 确认出库 --> | ||
| 132 | + <Button Grid.Column="2" | ||
| 133 | + Text="确认出库" | ||
| 134 | + BackgroundColor="#0EA5E9" | ||
| 135 | + TextColor="White" | ||
| 136 | + CornerRadius="8" | ||
| 137 | + Command="{Binding ConfirmCommand}" /> | ||
| 138 | + </Grid> | ||
| 139 | + | ||
| 140 | + </Grid> | ||
| 141 | +</ContentPage> |
| 1 | +using IndustrialControl.ViewModels; | ||
| 2 | +using IndustrialControl.Services; // ✅ 引入扫描服务 | ||
| 3 | + | ||
| 4 | +namespace IndustrialControl.Pages; | ||
| 5 | + | ||
| 6 | +[QueryProperty(nameof(OrderNo), "orderNo")] | ||
| 7 | +public partial class MoldOutboundExecutePage : ContentPage | ||
| 8 | +{ | ||
| 9 | + public string? OrderNo { get; set; } // Shell QueryProperty 接收 | ||
| 10 | + | ||
| 11 | + private readonly MoldOutboundExecuteViewModel _vm; | ||
| 12 | + private readonly ScanService _scanSvc; // ✅ 扫描服务 | ||
| 13 | + | ||
| 14 | + public MoldOutboundExecutePage(MoldOutboundExecuteViewModel vm, ScanService scanSvc) | ||
| 15 | + { | ||
| 16 | + InitializeComponent(); | ||
| 17 | + BindingContext = _vm = vm; | ||
| 18 | + _scanSvc = scanSvc; | ||
| 19 | + | ||
| 20 | + // 与项目里其它页保持一致的扫码配置 | ||
| 21 | + _scanSvc.Prefix = null; | ||
| 22 | + _scanSvc.Suffix = null; | ||
| 23 | + _scanSvc.DebounceMs = 0; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + protected override async void OnNavigatedTo(NavigatedToEventArgs args) | ||
| 27 | + { | ||
| 28 | + base.OnNavigatedTo(args); | ||
| 29 | + if (!string.IsNullOrWhiteSpace(OrderNo)) | ||
| 30 | + { | ||
| 31 | + await _vm.LoadAsync(OrderNo); // 维持你现有逻辑 | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + protected override void OnAppearing() | ||
| 36 | + { | ||
| 37 | + base.OnAppearing(); | ||
| 38 | + // ✅ 注册扫描回调并开始监听 | ||
| 39 | + _scanSvc.Scanned += OnScanned; | ||
| 40 | + _scanSvc.StartListening(); | ||
| 41 | + | ||
| 42 | + // ✅ 让“模具编码”输入框也能接收键盘/扫描枪字符 | ||
| 43 | + _scanSvc.Attach(MoldEntry); | ||
| 44 | + MoldEntry.Focus(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + protected override void OnDisappearing() | ||
| 48 | + { | ||
| 49 | + // ✅ 页面离开时及时注销,避免多个页面抢占扫码 | ||
| 50 | + _scanSvc.Scanned -= OnScanned; | ||
| 51 | + _scanSvc.StopListening(); | ||
| 52 | + base.OnDisappearing(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + // ✅ 硬件/广播 扫到码 | ||
| 56 | + private void OnScanned(string data, string type) | ||
| 57 | + { | ||
| 58 | + MainThread.BeginInvokeOnMainThread(async () => | ||
| 59 | + { | ||
| 60 | + // 1) 回填到输入框(UI 可见) | ||
| 61 | + MoldEntry.Text = data; | ||
| 62 | + | ||
| 63 | + // 2) 如需联动业务:在此调用 VM 方法(按需实现) | ||
| 64 | + // 例如:await _vm.HandleMoldScannedAsync(data, type); | ||
| 65 | + | ||
| 66 | + // 3) 如果只是想用扫描即“勾选相应行”,可在这里根据编码查找并置 Selected=true | ||
| 67 | + // ⚠ 你的行模型 MoldOutboundDetailRow 目前不是可通知对象,直接赋值 UI 不一定刷新; | ||
| 68 | + // 建议后续把它改成 ObservableObject 再做切换高亮。 | ||
| 69 | + }); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + // ✅ 手动输入并按回车,也走同一套逻辑 | ||
| 73 | + private async void OnMoldCompleted(object? sender, EventArgs e) | ||
| 74 | + { | ||
| 75 | + var code = MoldEntry.Text?.Trim(); | ||
| 76 | + if (string.IsNullOrEmpty(code)) return; | ||
| 77 | + | ||
| 78 | + // 可选:与 OnScanned 同步的处理 | ||
| 79 | + // await _vm.HandleMoldScannedAsync(code, "manual"); | ||
| 80 | + | ||
| 81 | + // 光标回到输入框,便于连续扫描 | ||
| 82 | + MoldEntry.CursorPosition = MoldEntry.Text?.Length ?? 0; | ||
| 83 | + MoldEntry.Focus(); | ||
| 84 | + } | ||
| 85 | +} |
| 1 | +<?xml version="1.0" encoding="utf-8" ?> | ||
| 2 | +<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| 4 | + x:Class="IndustrialControl.Pages.WorkOrderSearchPage" | ||
| 5 | + Title="工单查询"> | ||
| 6 | + | ||
| 7 | + <!-- 根布局:顶部(蓝条) / 条件区 / 列表 --> | ||
| 8 | + <Grid RowDefinitions="Auto,Auto,*"> | ||
| 9 | + | ||
| 10 | + <!-- 顶部蓝条 --> | ||
| 11 | + <Grid Grid.Row="0" BackgroundColor="#007BFF" HeightRequest="56" Padding="16,0"> | ||
| 12 | + <Label Text="仓储管理系统" | ||
| 13 | + VerticalOptions="Center" | ||
| 14 | + TextColor="White" | ||
| 15 | + FontSize="18" | ||
| 16 | + FontAttributes="Bold" /> | ||
| 17 | + </Grid> | ||
| 18 | + | ||
| 19 | + <!-- 条件区 --> | ||
| 20 | + <VerticalStackLayout Grid.Row="1" Padding="12" Spacing="10"> | ||
| 21 | + <!-- 第一行:工单号 + 查询 + 扫码图标按钮 --> | ||
| 22 | + <Grid ColumnDefinitions="*,Auto,44"> | ||
| 23 | + <Entry x:Name="OrderEntry" | ||
| 24 | + Placeholder="请输入/扫描工单号" | ||
| 25 | + Text="{Binding Keyword}" | ||
| 26 | + HeightRequest="40" /> | ||
| 27 | + | ||
| 28 | + <Button Grid.Column="1" | ||
| 29 | + Text="查询" | ||
| 30 | + HeightRequest="40" | ||
| 31 | + Command="{Binding SearchCommand}" /> | ||
| 32 | + | ||
| 33 | + <!-- 图标按钮:避免 Button 内嵌 <Image> 的限制 --> | ||
| 34 | + <ImageButton Grid.Column="2" | ||
| 35 | + HeightRequest="40" | ||
| 36 | + WidthRequest="44" | ||
| 37 | + BackgroundColor="Transparent" | ||
| 38 | + Source="scan.png" | ||
| 39 | + Clicked="OnScanHintClicked" /> | ||
| 40 | + </Grid> | ||
| 41 | + | ||
| 42 | + <!-- 第二行:时间 + 状态 --> | ||
| 43 | + <Grid ColumnDefinitions="*,*,Auto" ColumnSpacing="8"> | ||
| 44 | + <DatePicker Date="{Binding StartDate}" /> | ||
| 45 | + <DatePicker Grid.Column="1" Date="{Binding EndDate}" /> | ||
| 46 | + <Picker Grid.Column="2" | ||
| 47 | + Title="状态" | ||
| 48 | + WidthRequest="120" | ||
| 49 | + ItemsSource="{Binding StatusList}" | ||
| 50 | + SelectedItem="{Binding SelectedStatus}" /> | ||
| 51 | + </Grid> | ||
| 52 | + </VerticalStackLayout> | ||
| 53 | + | ||
| 54 | + <!-- 列表(自身可滚动,外面不要再套 ScrollView) --> | ||
| 55 | + <CollectionView Grid.Row="2" | ||
| 56 | + x:Name="OrderList" | ||
| 57 | + ItemsSource="{Binding Orders}" | ||
| 58 | + SelectionMode="None"> | ||
| 59 | + <CollectionView.ItemTemplate> | ||
| 60 | + <DataTemplate> | ||
| 61 | + <Frame Margin="0,6,0,0" | ||
| 62 | + Padding="10" | ||
| 63 | + HasShadow="False" | ||
| 64 | + BorderColor="#E0E6EF"> | ||
| 65 | + <!-- 点整卡片就跳转 --> | ||
| 66 | + <Frame.GestureRecognizers> | ||
| 67 | + <TapGestureRecognizer Tapped="OnOrderTapped" | ||
| 68 | + CommandParameter="{Binding .}" /> | ||
| 69 | + </Frame.GestureRecognizers> | ||
| 70 | + | ||
| 71 | + <!-- 列表项内容 --> | ||
| 72 | + <Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto"> | ||
| 73 | + <Grid Grid.Row="0" ColumnDefinitions="Auto,*"> | ||
| 74 | + <Label Text="工单编号:" FontAttributes="Bold" /> | ||
| 75 | + <Label Grid.Column="1" Text="{Binding OrderNo}" /> | ||
| 76 | + </Grid> | ||
| 77 | + <Grid Grid.Row="1" ColumnDefinitions="Auto,*"> | ||
| 78 | + <Label Text="工单名称:" FontAttributes="Bold" /> | ||
| 79 | + <Label Grid.Column="1" Text="{Binding OrderName}" /> | ||
| 80 | + </Grid> | ||
| 81 | + <Grid Grid.Row="2" ColumnDefinitions="Auto,*"> | ||
| 82 | + <Label Text="状态:" FontAttributes="Bold" /> | ||
| 83 | + <Label Grid.Column="1" Text="{Binding Status}" /> | ||
| 84 | + </Grid> | ||
| 85 | + <Grid Grid.Row="3" ColumnDefinitions="Auto,*"> | ||
| 86 | + <Label Text="产品名称:" FontAttributes="Bold" /> | ||
| 87 | + <Label Grid.Column="1" Text="{Binding ProductName}" /> | ||
| 88 | + </Grid> | ||
| 89 | + <Grid Grid.Row="4" ColumnDefinitions="Auto,*"> | ||
| 90 | + <Label Text="生产量:" FontAttributes="Bold" /> | ||
| 91 | + <Label Grid.Column="1" Text="{Binding Quantity}" /> | ||
| 92 | + </Grid> | ||
| 93 | + <Grid Grid.Row="5" ColumnDefinitions="Auto,*"> | ||
| 94 | + <Label Text="创建时间:" FontAttributes="Bold" /> | ||
| 95 | + <Label Grid.Column="1" | ||
| 96 | + Text="{Binding CreateDate, StringFormat='{0:yyyy-M-d}'}" /> | ||
| 97 | + </Grid> | ||
| 98 | + </Grid> | ||
| 99 | + </Frame> | ||
| 100 | + </DataTemplate> | ||
| 101 | + </CollectionView.ItemTemplate> | ||
| 102 | + </CollectionView> | ||
| 103 | + | ||
| 104 | + </Grid> | ||
| 105 | +</ContentPage> |
| 1 | +using IndustrialControl.Services; | ||
| 2 | +using IndustrialControl.ViewModels; | ||
| 3 | + | ||
| 4 | +namespace IndustrialControl.Pages; | ||
| 5 | + | ||
| 6 | +public partial class WorkOrderSearchPage : ContentPage | ||
| 7 | +{ | ||
| 8 | + private readonly ScanService _scanSvc; | ||
| 9 | + private readonly WorkOrderSearchViewModel _vm; | ||
| 10 | + | ||
| 11 | + public WorkOrderSearchPage(WorkOrderSearchViewModel vm, ScanService scanSvc) | ||
| 12 | + { | ||
| 13 | + InitializeComponent(); | ||
| 14 | + BindingContext = vm; | ||
| 15 | + _vm = vm; | ||
| 16 | + _scanSvc = scanSvc; | ||
| 17 | + | ||
| 18 | + // 与现有页面一致的扫码策略 | ||
| 19 | + _scanSvc.Prefix = null; | ||
| 20 | + _scanSvc.Suffix = null; | ||
| 21 | + _scanSvc.DebounceMs = 0; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + protected override void OnAppearing() | ||
| 25 | + { | ||
| 26 | + base.OnAppearing(); | ||
| 27 | + _scanSvc.Scanned += OnScanned; | ||
| 28 | + _scanSvc.StartListening(); | ||
| 29 | + _scanSvc.Attach(OrderEntry); // 支持键盘/手持枪统一输入 | ||
| 30 | + OrderEntry.Focus(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + protected override void OnDisappearing() | ||
| 34 | + { | ||
| 35 | + _scanSvc.Scanned -= OnScanned; | ||
| 36 | + _scanSvc.StopListening(); | ||
| 37 | + base.OnDisappearing(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + private void OnScanned(string data, string type) | ||
| 41 | + { | ||
| 42 | + MainThread.BeginInvokeOnMainThread(async () => | ||
| 43 | + { | ||
| 44 | + _vm.Keyword = data; // 回填查询条件 | ||
| 45 | + await _vm.SearchAsync(); // 触发查询 | ||
| 46 | + }); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + // 点整张卡片跳转(推荐) | ||
| 50 | + private async void OnOrderTapped(object sender, TappedEventArgs e) | ||
| 51 | + { | ||
| 52 | + try | ||
| 53 | + { | ||
| 54 | + // 如果你的 ItemsSource 元素类型是 WorkOrderDto,请把 WorkOrderSummary 换成 WorkOrderDto | ||
| 55 | + if (e.Parameter is not WorkOrderDto item) return; | ||
| 56 | + | ||
| 57 | + // 跳到目标页并传参(示例为 MoldOutboundExecutePage;按需改成你的页名) | ||
| 58 | + await Shell.Current.GoToAsync( | ||
| 59 | + $"{nameof(MoldOutboundExecutePage)}?orderNo={Uri.EscapeDataString(item.OrderNo)}"); | ||
| 60 | + } | ||
| 61 | + catch (Exception ex) | ||
| 62 | + { | ||
| 63 | + await DisplayAlert("导航失败", ex.Message, "确定"); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + private async void OnScanHintClicked(object sender, EventArgs e) | ||
| 68 | + => await DisplayAlert("提示", "此按钮预留摄像头扫码;硬件扫描直接扣扳机。", "确定"); | ||
| 69 | +} |
| @@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
| 2 | <ContentPage x:Name="Page" | 2 | <ContentPage x:Name="Page" |
| 3 | xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | 3 | xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
| 4 | xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | 4 | xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
| 5 | - xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI" | ||
| 6 | x:Class="IndustrialControl.Pages.InboundMaterialSearchPage" | 5 | x:Class="IndustrialControl.Pages.InboundMaterialSearchPage" |
| 7 | xmlns:conv="clr-namespace:IndustrialControl.Converters" | 6 | xmlns:conv="clr-namespace:IndustrialControl.Converters" |
| 8 | Title="仓储管理系统"> | 7 | Title="仓储管理系统"> |
| 1 | +using CommunityToolkit.Mvvm.ComponentModel; | ||
| 2 | +using CommunityToolkit.Mvvm.Input; | ||
| 3 | +using System.Collections.ObjectModel; | ||
| 4 | + | ||
| 5 | +namespace IndustrialControl.ViewModels; | ||
| 6 | + | ||
| 7 | +public partial class MoldOutboundExecuteViewModel : ObservableObject | ||
| 8 | +{ | ||
| 9 | + [ObservableProperty] private string? orderNo; | ||
| 10 | + | ||
| 11 | + public ObservableCollection<MoldOutboundDetailRow> ScanDetails { get; } = new(); | ||
| 12 | + | ||
| 13 | + [RelayCommand] | ||
| 14 | + public async Task LoadAsync(string orderNo) | ||
| 15 | + { | ||
| 16 | + OrderNo = orderNo; | ||
| 17 | + | ||
| 18 | + // TODO: 调接口获取:需求基础信息 + 扫描明细 | ||
| 19 | + await Task.Delay(80); | ||
| 20 | + | ||
| 21 | + // mock 数据 | ||
| 22 | + ScanDetails.Clear(); | ||
| 23 | + ScanDetails.Add(new MoldOutboundDetailRow { Index = 1, MoldCode = "XXX", MoldModel = "MU_DHJD_01", Qty = 1, Bin = "A202", Selected = true }); | ||
| 24 | + ScanDetails.Add(new MoldOutboundDetailRow { Index = 2, MoldCode = "XXX", MoldModel = "MU_DHJD_01", Qty = 1, Bin = "A202" }); | ||
| 25 | + ScanDetails.Add(new MoldOutboundDetailRow { Index = 3, MoldCode = "XXX", MoldModel = "MU_DHJD_02", Qty = 1, Bin = "A202" }); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + [RelayCommand] public Task ConfirmAsync() => Task.CompletedTask; // TODO | ||
| 29 | + [RelayCommand] public Task CancelScanAsync() => Task.CompletedTask; // TODO | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +public class MoldOutboundDetailRow | ||
| 33 | +{ | ||
| 34 | + public int Index { get; set; } | ||
| 35 | + public bool Selected { get; set; } | ||
| 36 | + public string MoldCode { get; set; } = ""; | ||
| 37 | + public string MoldModel { get; set; } = ""; | ||
| 38 | + public int Qty { get; set; } | ||
| 39 | + public string Bin { get; set; } = ""; | ||
| 40 | +} |
| 1 | +using CommunityToolkit.Mvvm.ComponentModel; | ||
| 2 | +using CommunityToolkit.Mvvm.Input; | ||
| 3 | +using System.Collections.ObjectModel; | ||
| 4 | +using System.Windows.Input; | ||
| 5 | + | ||
| 6 | +namespace IndustrialControl.ViewModels; | ||
| 7 | + | ||
| 8 | +public class WorkOrderSearchViewModel : ObservableObject | ||
| 9 | +{ | ||
| 10 | + public ObservableCollection<WorkOrderDto> Orders { get; } = new(); | ||
| 11 | + | ||
| 12 | + private string? _keyword; | ||
| 13 | + public string? Keyword | ||
| 14 | + { | ||
| 15 | + get => _keyword; | ||
| 16 | + set => SetProperty(ref _keyword, value); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public DateTime StartDate { get; set; } = DateTime.Today.AddDays(-7); | ||
| 20 | + public DateTime EndDate { get; set; } = DateTime.Today; | ||
| 21 | + | ||
| 22 | + public List<string> StatusList { get; } = new() { "待执行", "执行中", "已完成", "已取消" }; | ||
| 23 | + private string? _selectedStatus = "待执行"; | ||
| 24 | + public string? SelectedStatus | ||
| 25 | + { | ||
| 26 | + get => _selectedStatus; | ||
| 27 | + set => SetProperty(ref _selectedStatus, value); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + private WorkOrderDto? _selectedOrder; | ||
| 31 | + public WorkOrderDto? SelectedOrder | ||
| 32 | + { | ||
| 33 | + get => _selectedOrder; | ||
| 34 | + set => SetProperty(ref _selectedOrder, value); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public ICommand SearchCommand { get; } | ||
| 38 | + public ICommand ClearCommand { get; } | ||
| 39 | + | ||
| 40 | + public WorkOrderSearchViewModel() | ||
| 41 | + { | ||
| 42 | + SearchCommand = new AsyncRelayCommand(SearchAsync); | ||
| 43 | + ClearCommand = new RelayCommand(Clear); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public async Task SearchAsync() | ||
| 47 | + { | ||
| 48 | + // TODO: 调后端 API;这里先用 Mock | ||
| 49 | + await Task.Delay(120); | ||
| 50 | + Orders.Clear(); | ||
| 51 | + | ||
| 52 | + // 伪数据(根据条件简单过滤) | ||
| 53 | + var all = MockOrders(); | ||
| 54 | + var filtered = all.Where(o => | ||
| 55 | + (string.IsNullOrWhiteSpace(Keyword) || o.OrderNo.Contains(Keyword!, StringComparison.OrdinalIgnoreCase)) && | ||
| 56 | + o.CreateDate.Date >= StartDate.Date && o.CreateDate.Date <= EndDate.Date && | ||
| 57 | + (string.IsNullOrWhiteSpace(SelectedStatus) || o.Status == SelectedStatus) | ||
| 58 | + ); | ||
| 59 | + | ||
| 60 | + foreach (var m in filtered) Orders.Add(m); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void Clear() | ||
| 64 | + { | ||
| 65 | + Keyword = string.Empty; | ||
| 66 | + StartDate = DateTime.Today.AddDays(-7); | ||
| 67 | + EndDate = DateTime.Today; | ||
| 68 | + SelectedStatus = "待执行"; | ||
| 69 | + Orders.Clear(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + private IEnumerable<WorkOrderDto> MockOrders() | ||
| 73 | + { | ||
| 74 | + yield return new WorkOrderDto | ||
| 75 | + { | ||
| 76 | + OrderNo = "SCGD20250601002", | ||
| 77 | + OrderName = "XXXXXXXXXX", | ||
| 78 | + Status = "待执行", | ||
| 79 | + ProductName = "梅林午餐肉罐头198g", | ||
| 80 | + Quantity = 10000, | ||
| 81 | + CreateDate = DateTime.Today.AddDays(-3) | ||
| 82 | + }; | ||
| 83 | + yield return new WorkOrderDto | ||
| 84 | + { | ||
| 85 | + OrderNo = "SCGD20250601003", | ||
| 86 | + OrderName = "XXXXXXXXXX", | ||
| 87 | + Status = "待执行", | ||
| 88 | + ProductName = "梅林午餐肉罐头198g", | ||
| 89 | + Quantity = 5000, | ||
| 90 | + CreateDate = DateTime.Today.AddDays(-2) | ||
| 91 | + }; | ||
| 92 | + yield return new WorkOrderDto | ||
| 93 | + { | ||
| 94 | + OrderNo = "SCGD20250601004", | ||
| 95 | + OrderName = "XXXXXXXXXX", | ||
| 96 | + Status = "执行中", | ||
| 97 | + ProductName = "梅林午餐肉罐头198g", | ||
| 98 | + Quantity = 8000, | ||
| 99 | + CreateDate = DateTime.Today.AddDays(-1) | ||
| 100 | + }; | ||
| 101 | + } | ||
| 102 | +} |
-
请 注册 或 登录 后发表评论