MoldOutboundExecutePage.xaml
14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="IndustrialControl.Pages.MoldOutboundExecutePage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:conv="clr-namespace:IndustrialControl.Converters"
Shell.NavBarIsVisible="True">
<ContentPage.Resources>
<ResourceDictionary>
<!-- 转换器 -->
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
<!-- 颜色 -->
<Color x:Key="ClrBlue">#3F88F7</Color>
<Color x:Key="ClrGreen">#4CAF50</Color>
<Color x:Key="ClrGray">#BFC6D4</Color>
<Color x:Key="ClrLine">#E0E6EF</Color>
<Color x:Key="ClrTextSub">#718096</Color>
<!-- 卡片样式 -->
<Style TargetType="Frame" x:Key="Card">
<Setter Property="HasShadow" Value="False" />
<Setter Property="BorderColor" Value="#E5EAF2" />
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0,10,0,0" />
</Style>
<Style TargetType="Label" x:Key="SectionTitle">
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="FontSize" Value="16" />
<Setter Property="TextColor" Value="#1F2D3D" />
<Setter Property="Margin" Value="0,0,0,8" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ScrollView>
<Grid Padding="14" RowDefinitions="Auto,Auto,Auto,*,Auto">
<!-- 工单基础信息(标题 + 顶部流程进度) -->
<Frame Grid.Row="0" Style="{StaticResource Card}">
<VerticalStackLayout Spacing="10">
<Label Text="工单基础信息" Style="{StaticResource SectionTitle}" />
<!-- 顶部流程进度:按 VM 的 IsActive/IsDone 高亮;Time 显示日期 -->
<CollectionView ItemsSource="{Binding WorkflowSteps}" SelectionMode="None">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="26"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<!-- 三列:左连线 | 圆点块 | 右连线;三行:圆点/标题/日期 -->
<Grid ColumnDefinitions="*,Auto,*" RowDefinitions="Auto,Auto,Auto" Padding="0,0,8,0" WidthRequest="120">
<!-- 左侧连接线(首节点隐藏;颜色随状态变) -->
<BoxView x:Name="leftLine" Grid.Column="0" Grid.Row="0"
HeightRequest="2" VerticalOptions="Center" Margin="0,13,8,0"
Color="#E0E6EF" IsVisible="{Binding IsFirst, Converter={StaticResource InverseBoolConverter}}">
<BoxView.Triggers>
<DataTrigger TargetType="BoxView" Binding="{Binding IsDone}" Value="True">
<Setter Property="Color" Value="#4CAF50"/>
</DataTrigger>
<DataTrigger TargetType="BoxView" Binding="{Binding IsActive}" Value="True">
<Setter Property="Color" Value="#3F88F7"/>
</DataTrigger>
</BoxView.Triggers>
</BoxView>
<!-- 圆点(中列) -->
<Grid Grid.Column="1" Grid.Row="0" WidthRequest="26" HeightRequest="26">
<Ellipse Fill="#BFC6D4" Stroke="#E0E6EF" StrokeThickness="2"/>
<Ellipse StrokeThickness="0">
<Ellipse.Triggers>
<DataTrigger TargetType="Ellipse" Binding="{Binding IsActive}" Value="True">
<Setter Property="Fill" Value="#3F88F7"/>
</DataTrigger>
<DataTrigger TargetType="Ellipse" Binding="{Binding IsDone}" Value="True">
<Setter Property="Fill" Value="#4CAF50"/>
</DataTrigger>
</Ellipse.Triggers>
</Ellipse>
<!-- 圆内文本:已完成=✔;其余显示序号 -->
<Label FontSize="14" HorizontalOptions="Center" VerticalOptions="Center" TextColor="White">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsDone}" Value="True">
<Setter Property="Text" Value="✔"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding IsDone}" Value="False">
<Setter Property="Text" Value="{Binding Index}"/>
</DataTrigger>
</Label.Triggers>
</Label>
</Grid>
<!-- 右侧连接线(末节点隐藏,保持灰色) -->
<BoxView Grid.Column="2" Grid.Row="0"
HeightRequest="2" VerticalOptions="Center" Margin="8,13,0,0"
Color="#E0E6EF" IsVisible="{Binding IsLast, Converter={StaticResource InverseBoolConverter}}"/>
<!-- 标题 -->
<Label Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="1"
Margin="0,6,0,0"
FontSize="12"
HorizontalTextAlignment="Center"
Text="{Binding Title}" />
<!-- 日期(确保用 StringFormat;Time 为 null 时自然不显示文字) -->
<Label Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2"
FontSize="11"
HorizontalTextAlignment="Center"
Text="{Binding Time}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</Frame>
<!-- 工单基础信息表格(来自搜索页 BaseInfos) -->
<!-- 工单基础信息表格(固定字段) -->
<Frame Grid.Row="1" Style="{StaticResource Card}">
<Grid ColumnDefinitions="80,100,80,80"
RowDefinitions="Auto,Auto,Auto,Auto,Auto"
RowSpacing="6" ColumnSpacing="8">
<!-- 第1行 -->
<Label Grid.Row="0" Grid.Column="0" Text="工单编号:" FontAttributes="Bold"/>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding OrderNo}" LineBreakMode="TailTruncation"/>
<Label Grid.Row="0" Grid.Column="2" Text="状态:" FontAttributes="Bold"/>
<Label Grid.Row="0" Grid.Column="3" Text="{Binding StatusText}" LineBreakMode="TailTruncation"/>
<!-- 第2行 -->
<Label Grid.Row="1" Grid.Column="0" Text="工单名称:" FontAttributes="Bold"/>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding OrderName}" LineBreakMode="TailTruncation"/>
<Label Grid.Row="1" Grid.Column="2" Text="优先级:" FontAttributes="Bold"/>
<Label Grid.Row="1" Grid.Column="3" Text="{Binding Urgent}" LineBreakMode="TailTruncation"/>
<!-- 第3行 -->
<Label Grid.Row="2" Grid.Column="0" Text="产品名称:" FontAttributes="Bold"/>
<Label Grid.Row="2" Grid.Column="1" Text="{Binding ProductName}" LineBreakMode="TailTruncation"/>
<Label Grid.Row="2" Grid.Column="2" Text="生产数量:" FontAttributes="Bold"/>
<Label Grid.Row="2" Grid.Column="3" Text="{Binding PlanQtyText}" />
<!-- 第4行 -->
<Label Grid.Row="3" Grid.Column="0" Text="计划开始日期:" FontAttributes="Bold"/>
<Label Grid.Row="3" Grid.Column="1" Text="{Binding PlanStartText}" />
<Label Grid.Row="3" Grid.Column="2" Text="创建日期:" FontAttributes="Bold"/>
<Label Grid.Row="3" Grid.Column="3" Text="{Binding CreateDateText}" />
<!-- 第5行 -->
<Label Grid.Row="4" Grid.Column="0" Text="BOM编号:" FontAttributes="Bold"/>
<Label Grid.Row="4" Grid.Column="1" Text="{Binding BomCode}" LineBreakMode="TailTruncation"/>
<Label Grid.Row="4" Grid.Column="2" Text="工艺路线名称:" FontAttributes="Bold"/>
<Label Grid.Row="4" Grid.Column="3" Text="{Binding RouteName}" LineBreakMode="TailTruncation"/>
</Grid>
</Frame>
<!-- 工序任务进度(竖向时间轴) -->
<Frame Grid.Row="3" Style="{StaticResource Card}">
<VerticalStackLayout Spacing="8">
<Label Text="工序任务进度" Style="{StaticResource SectionTitle}" />
<CollectionView ItemsSource="{Binding ProcessTasks}" SelectionMode="None">
<CollectionView.ItemTemplate>
<DataTemplate>
<!-- 左 40:圆点 + 竖线;右:名称 + 时间 + 状态 -->
<Grid ColumnDefinitions="40,*" Padding="0,8">
<!-- 左侧:圆点 + 竖线 -->
<Grid RowDefinitions="Auto,Auto" WidthRequest="40">
<Grid WidthRequest="26" HeightRequest="26" HorizontalOptions="Center">
<Ellipse Stroke="{StaticResource ClrLine}" StrokeThickness="2" />
<Ellipse StrokeThickness="0" x:Name="dotFill" Fill="{StaticResource ClrGray}"/>
<Label Text="{Binding Index}" FontSize="12" TextColor="White"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Grid>
<BoxView Grid.Row="1" WidthRequest="2" HorizontalOptions="Center"
Color="{StaticResource ClrLine}" HeightRequest="36"/>
</Grid>
<!-- 右侧内容 -->
<Grid Grid.Column="1" RowDefinitions="Auto,Auto">
<Label Grid.Row="0" Text="{Binding Name}" FontAttributes="Bold" FontSize="14"/>
<HorizontalStackLayout Grid.Row="1" Spacing="12">
<Label Text="{Binding Start, StringFormat='{}{0:yyyy-MM-dd}'}" FontSize="12" TextColor="{StaticResource ClrTextSub}"/>
<Label Text="→" FontSize="12" TextColor="{StaticResource ClrTextSub}"/>
<Label Text="{Binding End, StringFormat='{}{0:yyyy-MM-dd}'}" FontSize="12" TextColor="{StaticResource ClrTextSub}"/>
<Label x:Name="statusLabel" Text="{Binding StatusText}" FontSize="12" />
</HorizontalStackLayout>
</Grid>
<!-- 根据 StatusText 着色:完成=绿,进行中=蓝,其它=灰 -->
<Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding StatusText}" Value="完成">
<Setter TargetName="dotFill" Property="Ellipse.Fill" Value="{StaticResource ClrGreen}" />
<Setter TargetName="statusLabel" Property="Label.TextColor" Value="{StaticResource ClrGreen}" />
</DataTrigger>
<DataTrigger TargetType="Grid" Binding="{Binding StatusText}" Value="进行中">
<Setter TargetName="dotFill" Property="Ellipse.Fill" Value="{StaticResource ClrBlue}" />
<Setter TargetName="statusLabel" Property="Label.TextColor" Value="{StaticResource ClrBlue}" />
</DataTrigger>
<DataTrigger TargetType="Grid" Binding="{Binding StatusText}" Value="未开始">
<Setter TargetName="dotFill" Property="Ellipse.Fill" Value="{StaticResource ClrGray}" />
<Setter TargetName="statusLabel" Property="Label.TextColor" Value="{StaticResource ClrGray}" />
</DataTrigger>
</Grid.Triggers>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</Frame>
<!-- 底部按钮 -->
<Grid Grid.Row="4" ColumnDefinitions="*,*" ColumnSpacing="12" Margin="0,10,0,20">
<Button Text="取消" Command="{Binding CancelScanCommand}" />
<Button Grid.Column="1" Text="确认出库" Command="{Binding ConfirmCommand}" />
</Grid>
</Grid>
</ScrollView>
</ContentPage>