查询细节
This commit is contained in:
commit
c70e3430f9
7 files changed
+223
-43
No files matched your search
+9
-37
@@ -8,7 +8,7 @@ namespace SunlightAggregationTerminal;
|
||||
public partial class InfoDetail : ContentPage
|
||||
{
|
||||
public static ObservableCollection<ProbuctItem> InfoProbuctItems { get; set; } = new();
|
||||
public static ObservableCollection<DyelotItem> InfoDyelotItems { get; set; } = new();
|
||||
public static ObservableCollection<DyelotDetailsItem> InfoDyelotDetailsItems { get; set; } = new();
|
||||
public InfoDetail(InfoItem item)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -20,75 +20,47 @@ public partial class InfoDetail : ContentPage
|
||||
InfoProbuctItems.Add(new ProbuctItem { ProductName = "afars", ProductCode = "cs", ProductState = "", ProductInf = "" });
|
||||
|
||||
|
||||
InfoDyelotItems.Add(new DyelotItem { Dyelot = "2134566", Machine = "g01", CreationTime = "", CallTime = "" ,
|
||||
InfoDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{ Dyelot = "2134566", Machine = "g01", CreationTime = "", CallTime = "" ,
|
||||
ReDye="0",
|
||||
Step = "0",
|
||||
FabricName = "21345122343566",
|
||||
ColorName = "g01",
|
||||
CustomerName = "",
|
||||
EndTime = "",
|
||||
StartTime = "",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
InfoDyelotItems.Add(new DyelotItem
|
||||
});
|
||||
InfoDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Step = "3",
|
||||
Dyelot = "231423134566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
CallTime = "",
|
||||
FabricName = "2134566",
|
||||
ColorName = "g01",
|
||||
CustomerName = "",
|
||||
EndTime = "",
|
||||
StartTime = "",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
|
||||
InfoDyelotItems.Add(new DyelotItem
|
||||
InfoDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Step = "3",
|
||||
Dyelot = "2131324354566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
CallTime = "",
|
||||
FabricName = "2134566",
|
||||
ColorName = "g01",
|
||||
CustomerName = "",
|
||||
EndTime = "",
|
||||
StartTime = "",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
InfoDyelotItems.Add(new DyelotItem
|
||||
InfoDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Dyelot = "2134123243566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
CallTime = "",
|
||||
FabricName = "2134566",
|
||||
ColorName = "g01",
|
||||
CustomerName = "",
|
||||
EndTime = "",
|
||||
StartTime = "",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
InfoDyelotItems.Add(new DyelotItem
|
||||
InfoDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Dyelot = "2134566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
CallTime = "",
|
||||
FabricName = "2134566",
|
||||
ColorName = "g01",
|
||||
CustomerName = "",
|
||||
EndTime = "",
|
||||
StartTime = "",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
|
||||
|
||||
CardCollectionView_machine.ItemsSource = InfoProbuctItems;
|
||||
CardCollectionView_history.ItemsSource = InfoDyelotItems;
|
||||
CardCollectionView_history.ItemsSource = InfoDyelotDetailsItems;
|
||||
}
|
||||
|
||||
private void Button_real(object sender, EventArgs e)
|
||||
|
||||
+16
-3
@@ -48,18 +48,31 @@ namespace SunlightAggregationTerminal.Models
|
||||
public string? ProductState { get; set; }
|
||||
public string? ProductInf { get; set; }
|
||||
}
|
||||
|
||||
public class DyelotItem
|
||||
{
|
||||
public string? Dyelot { get; set; }
|
||||
public string? ReDye { get; set; }
|
||||
public string? Step { get; set; }
|
||||
public string? Machine { get; set; }
|
||||
public string? CreationTime { get; set; }
|
||||
public string? CallTime { get; set; }
|
||||
public string? FabricName { get; set; }
|
||||
public string? ColorName { get; set; }
|
||||
public string? CustomerName { get; set; }
|
||||
public string? Information { get; set; }
|
||||
}
|
||||
public class DyelotDetailsItem
|
||||
{
|
||||
public string? Dyelot { get; set; }
|
||||
public string? ReDye { get; set; }
|
||||
public string? Step { get; set; }
|
||||
public string? ProductName { get; set; }
|
||||
public string? ProductCode { get; set; }
|
||||
public string? ProductType { get; set; }
|
||||
public string? ProductProgram { get; set; }
|
||||
public string? DispenserGram { get; set; }
|
||||
public string? Gram { get; set; }
|
||||
public string? Machine { get; set; }
|
||||
public string? CreationTime { get; set; }
|
||||
public string? CallTime { get; set; }
|
||||
public string? EndTime { get; set; }
|
||||
public string? StartTime { get; set; }
|
||||
public string? Information { get; set; }
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.QueryDetail"
|
||||
Title="细节">
|
||||
<Grid RowDefinitions="Auto, *" >
|
||||
<Grid BackgroundColor="#CCCCCC" Padding="10" Grid.Row="0" Grid.Column="0">
|
||||
<VerticalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="工单: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Dyelot}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
<Label Text="@" FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding ReDye}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="机台: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Machine}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="下单时间: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding CreationTime}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="工艺: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding FabricName}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="面料: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding FabricName}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="客户: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding CustomerName}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="颜色: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
|
||||
<Label FontSize="22" BackgroundColor="Black"/>
|
||||
<Label Text="{Binding ColorName}" FontAttributes="Bold" FontSize="22" TextColor="Gray"/>
|
||||
</HorizontalStackLayout>
|
||||
<BoxView HeightRequest="25" Color="#E0E0E0" Margin="0,0" />
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="_data" Grid.Row="1" Grid.Column="0" BackgroundColor="#F0F0F0">
|
||||
<CollectionView x:Name="CardCollectionView_data" RemainingItemsThreshold="5">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BackgroundColor="White" Stroke="#CCCCCC"
|
||||
StrokeThickness="2" Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<VerticalStackLayout VerticalOptions="Center">
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="步骤: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Step}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="呼叫: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Machine}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="时间: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding EndTime}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<BoxView HeightRequest="3" Color="#CCCCCC" />
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="{Binding ProductName}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,96 @@
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace SunlightAggregationTerminal;
|
||||
|
||||
public partial class QueryDetail : ContentPage
|
||||
{
|
||||
public static ObservableCollection<DyelotDetailsItem> QueryDetailDyelotDetailsItems { get; set; } = new();
|
||||
public static ObservableCollection<DyelotDetailsItem> QueryDetailDyelotDetailsItemst { get; set; } = new();
|
||||
public QueryDetail(DyelotItem item)
|
||||
{
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
QueryDetailDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Dyelot = "2134566",
|
||||
Machine = "g01",
|
||||
Step="3",
|
||||
CreationTime = "",
|
||||
DispenserGram="32434",
|
||||
Gram = "3212",
|
||||
ReDye = "0",
|
||||
ProductName="sdvsf1",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
QueryDetailDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Dyelot = "2134566",
|
||||
Machine = "g01",
|
||||
Step = "3",
|
||||
CreationTime = "",
|
||||
DispenserGram = "32423434",
|
||||
Gram = "3212434",
|
||||
ReDye = "0",
|
||||
ProductName = "sdvsf2",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
QueryDetailDyelotDetailsItems.Add(new DyelotDetailsItem
|
||||
{
|
||||
Dyelot = "2134566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
DispenserGram = "3212434",
|
||||
Gram= "3212434",
|
||||
Step = "4",
|
||||
ReDye = "0",
|
||||
ProductName = "sdvsf3",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
|
||||
Data_();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Data_()
|
||||
{
|
||||
|
||||
var processedList = QueryDetailDyelotDetailsItems
|
||||
.GroupBy(item => new
|
||||
{
|
||||
// 建议加上 ?.Trim() 防止空格和 null 导致的分组偏差
|
||||
Dyelot = item.Dyelot?.Trim(),
|
||||
Step = item.Step?.Trim()
|
||||
})
|
||||
.Select(g =>
|
||||
{
|
||||
var firstItem = g.First();
|
||||
// 提取该组内所有的 ProductName 并转为字符串
|
||||
// 提取该组内所有的 Gram,安全地转为字符串(防止 null 报错)
|
||||
// 将两者用 Zip 方法一一配对,拼接成 "ProductName(Gram)" 的格式
|
||||
// 如果只想简单的全部堆在一起,也可以直接用 string.Join(",", productNames.Concat(grams))
|
||||
var productNames = g.Select(x => x.ProductName);
|
||||
var grams = g.Select(x => x.Gram?.ToString());
|
||||
var dispenserGrams = g.Select(x => x.DispenserGram?.ToString());
|
||||
// 使用 Zip 将三者一一配对,拼接成 "名称(Gram/dispenserGram)" 的格式
|
||||
var combinedInfo = string.Join("\n",productNames.Zip(grams, (name, gram) => (name, gram)) // 先把前两个拼成元组
|
||||
.Zip(dispenserGrams, (pair, dispGram) => $"原料:{pair.name}\n目标用量:{pair.gram}g\n实际用量:{dispGram}g"));
|
||||
|
||||
// 赋值给最终展示的 ProductName
|
||||
firstItem.ProductName = combinedInfo;
|
||||
return firstItem;
|
||||
})
|
||||
.ToList(); // 强制立刻执行查询
|
||||
|
||||
// 更新 UI 绑定的 ObservableCollection
|
||||
QueryDetailDyelotDetailsItems.Clear();
|
||||
foreach (var item in processedList)
|
||||
{
|
||||
QueryDetailDyelotDetailsItems.Add(item);
|
||||
}
|
||||
CardCollectionView_data.ItemsSource = QueryDetailDyelotDetailsItems;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -34,8 +34,7 @@
|
||||
</StackLayout>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<CollectionView x:Name="CardCollectionView"
|
||||
ItemsSource="{Binding DyelotItems}"
|
||||
<CollectionView x:Name="CardCollectionView"
|
||||
RemainingItemsThreshold="5">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
|
||||
+11
-1
@@ -18,6 +18,16 @@ public partial class QueryPage : ContentPage
|
||||
{
|
||||
ResultEntry.Text = scannedValue;
|
||||
});
|
||||
|
||||
DyelotItems.Add(new DyelotItem
|
||||
{
|
||||
Dyelot = "2134566",
|
||||
Machine = "g01",
|
||||
CreationTime = "",
|
||||
ReDye = "0",
|
||||
Information = "yyjjy\nfxfxdsdg\n",
|
||||
});
|
||||
CardCollectionView.ItemsSource = DyelotItems;
|
||||
}
|
||||
private async void OnScanButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
@@ -33,7 +43,7 @@ public partial class QueryPage : ContentPage
|
||||
|
||||
if (context is DyelotItem item)
|
||||
{
|
||||
//await Navigation.PushAsync(new QueryDetail(item));
|
||||
await Navigation.PushAsync(new QueryDetail(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-android|AnyCPU'">
|
||||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
|
||||
@@ -122,6 +126,9 @@
|
||||
<MauiXaml Update="ProfilePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="QueryDetail.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="QueryPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
|
||||
Reference in new issue
Block a user