|
|
|
|
@ -0,0 +1,684 @@
|
|
|
|
|
using CentralControl.App_Code;
|
|
|
|
|
using CommonFunc;
|
|
|
|
|
using CommonFunc.Tools;
|
|
|
|
|
using HandyControl.Tools.Extension;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using XGL.Data.DBService;
|
|
|
|
|
using XGL.Models;
|
|
|
|
|
|
|
|
|
|
namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
public partial class Lanju_Product_Process_Check_Report_List : Window
|
|
|
|
|
{
|
|
|
|
|
private string belong_to = string.Empty;
|
|
|
|
|
private List<MesTableSelfDetialModel> data;
|
|
|
|
|
private ProductProcessData _taskData;
|
|
|
|
|
FormingMachineService dbService = new FormingMachineService();
|
|
|
|
|
private static double LineWidth = 30;
|
|
|
|
|
private static double LineHeight = 30;
|
|
|
|
|
private static double MainLineHeight = 50;
|
|
|
|
|
string deviceCode = Utils.GetAppSetting("DeviceCode");//获取产线
|
|
|
|
|
string productName = string.Empty;
|
|
|
|
|
private string shiftCode = "";
|
|
|
|
|
private string shiftName = "";
|
|
|
|
|
private string product_code = string.Empty;
|
|
|
|
|
private bool isUpdate = false;
|
|
|
|
|
private string LineStr = "";
|
|
|
|
|
private readonly List<string> _DefectClassification = new List<string>() { "", "", "" };
|
|
|
|
|
|
|
|
|
|
public Lanju_Product_Process_Check_Report_List()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InitializeComponent(); //用于加载和初始化 XAML 文件, // 必须在构造函数中调用
|
|
|
|
|
this.date = LoginUser.WorkDate;
|
|
|
|
|
shiftCode = LoginUser.ShiftCode;//班次
|
|
|
|
|
/* 2 夜班 5 白班*/
|
|
|
|
|
shiftName = dbService.GetShiftById(shiftCode);
|
|
|
|
|
}
|
|
|
|
|
private List<ConveterData> list = new List<ConveterData>();
|
|
|
|
|
private string date;
|
|
|
|
|
private MesTableSelf mesTableSelf;
|
|
|
|
|
private List<MesTableSelfDetialModel> mesTableSelfDetialList;
|
|
|
|
|
|
|
|
|
|
public List<BaseDictData> DictDatas { get; private set; }
|
|
|
|
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//this.NickName.Text = LoginUser.UserName;
|
|
|
|
|
|
|
|
|
|
//包装线05
|
|
|
|
|
LineStr = dbService.GetBaseEquipment(Utils.GetAppSetting("DeviceCode"));
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
//加载数据
|
|
|
|
|
private void LoadData(bool addLine = false)
|
|
|
|
|
{
|
|
|
|
|
isUpdate = true;
|
|
|
|
|
list.Clear();
|
|
|
|
|
this.MainGrid.Children.Clear();
|
|
|
|
|
this.MainGrid.RowDefinitions.Clear();
|
|
|
|
|
this.MainGrid.ColumnDefinitions.Clear();
|
|
|
|
|
DictDatas = dbService.GetConversionReportType();
|
|
|
|
|
|
|
|
|
|
var baseDictDatas = dbService.GetProductProcessCheckInfo(deviceCode).ToList();
|
|
|
|
|
|
|
|
|
|
if (baseDictDatas == null || baseDictDatas.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("[Error] 未获取到产品过程检信息。");
|
|
|
|
|
LogHelper.instance.log.Error("[Error] 未获取到产品过程检信息。");
|
|
|
|
|
}
|
|
|
|
|
// 创建列表标题行
|
|
|
|
|
CreateGridHeader();
|
|
|
|
|
|
|
|
|
|
// 遍历数据并添加到Grid中
|
|
|
|
|
for (int i = 0; i < baseDictDatas.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var data = baseDictDatas[i];
|
|
|
|
|
|
|
|
|
|
AddDataRowToGrid(data, i + 1); // i+1是因为第0行是标题
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 创建表格标题行
|
|
|
|
|
private void CreateGridHeader()
|
|
|
|
|
{
|
|
|
|
|
// 创建列定义(共12列,根据查询字段)
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
|
{
|
|
|
|
|
this.MainGrid.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加标题行
|
|
|
|
|
this.MainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
|
|
|
|
|
|
|
|
|
// 创建标题单元格 - 根据查询字段定义表头
|
|
|
|
|
string[] headers = new string[]
|
|
|
|
|
{
|
|
|
|
|
"任务编号", "订单号", "工单号", "产品号", "产品名称", "CPK品类",
|
|
|
|
|
"数量", "抽样数量", "不合格数量", "单位", "车间名称", "检验时间", "检验节点", "检验状态"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (int col = 0; col < headers.Length; col++)
|
|
|
|
|
{
|
|
|
|
|
Border border = new Border
|
|
|
|
|
{
|
|
|
|
|
BorderBrush = Brushes.Black,
|
|
|
|
|
BorderThickness = new Thickness(1),
|
|
|
|
|
Background = Brushes.LightGray,
|
|
|
|
|
Padding = new Thickness(5)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TextBlock textBlock = new TextBlock
|
|
|
|
|
{
|
|
|
|
|
Text = headers[col],
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
TextAlignment = TextAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
border.Child = textBlock;
|
|
|
|
|
Grid.SetRow(border, 0);
|
|
|
|
|
Grid.SetColumn(border, col);
|
|
|
|
|
this.MainGrid.Children.Add(border);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加数据行到Grid
|
|
|
|
|
private void AddDataRowToGrid(ProductProcessData data, int rowIndex)
|
|
|
|
|
{
|
|
|
|
|
// 为数据行添加行定义
|
|
|
|
|
this.MainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
|
|
|
|
|
|
|
|
|
// 第1列:任务编号 (check_no) - 添加点击事件
|
|
|
|
|
AddClickableCell(data.check_no ?? "", rowIndex, 0, data);
|
|
|
|
|
|
|
|
|
|
// 第2列:订单号 (workorderCodeSap)
|
|
|
|
|
AddCell(data.workorderCodeSap ?? "", rowIndex, 1);
|
|
|
|
|
|
|
|
|
|
// 第3列:工单号 (order_no)
|
|
|
|
|
AddCell(data.order_no ?? "", rowIndex, 2);
|
|
|
|
|
|
|
|
|
|
// 第4列:产品号 (material_code)
|
|
|
|
|
AddCell(data.material_code ?? "", rowIndex, 3);
|
|
|
|
|
|
|
|
|
|
// 第5列:产品名称 (material_name)
|
|
|
|
|
AddCell(data.material_name ?? "", rowIndex, 4);
|
|
|
|
|
|
|
|
|
|
// 第6列:CPK品类 (cpk_type)
|
|
|
|
|
AddCell(data.cpk_type ?? "", rowIndex, 5);
|
|
|
|
|
|
|
|
|
|
// 第7列:数量 (quality)
|
|
|
|
|
AddCell(data.quality ?? "0", rowIndex, 6);
|
|
|
|
|
|
|
|
|
|
// 第8列:抽样数量 (sample_quality)
|
|
|
|
|
AddCell(data.sample_quality ?? "0", rowIndex, 7);
|
|
|
|
|
|
|
|
|
|
// 第9列:不合格数量 (noOk_quality)
|
|
|
|
|
AddCell(data.noOk_quality ?? "0", rowIndex, 8);
|
|
|
|
|
|
|
|
|
|
// 第10列:单位 (unit)
|
|
|
|
|
AddCell(data.unit ?? "", rowIndex, 9);
|
|
|
|
|
|
|
|
|
|
// 第11列:供应商 (supplier_name)
|
|
|
|
|
AddCell(data.supplier_name ?? "", rowIndex, 10);
|
|
|
|
|
|
|
|
|
|
// 第12列:检验时间 (income_time)
|
|
|
|
|
AddCell(data.income_time ?? "", rowIndex, 11);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 第13列:检验节点 (check_name)
|
|
|
|
|
AddCell(data.check_name ?? "", rowIndex, 12);
|
|
|
|
|
// 第14列:检验状态 (check_status)
|
|
|
|
|
string statusText = "";
|
|
|
|
|
switch (data.check_status)
|
|
|
|
|
{
|
|
|
|
|
case "0":
|
|
|
|
|
statusText = "待检验";
|
|
|
|
|
break;
|
|
|
|
|
case "1":
|
|
|
|
|
statusText = "已检验";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
statusText = data.check_status ?? "未知";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
AddCell(statusText, rowIndex, 13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加可点击的单元格(用于任务编号)
|
|
|
|
|
private void AddClickableCell(string content, int row, int column, ProductProcessData data)
|
|
|
|
|
{
|
|
|
|
|
Border border = new Border
|
|
|
|
|
{
|
|
|
|
|
BorderBrush = Brushes.Black,
|
|
|
|
|
BorderThickness = new Thickness(0.5),
|
|
|
|
|
Padding = new Thickness(5),
|
|
|
|
|
Cursor = Cursors.Hand
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
border.Background = Brushes.White;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TextBlock textBlock = new TextBlock
|
|
|
|
|
{
|
|
|
|
|
Text = content,
|
|
|
|
|
TextAlignment = TextAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
TextWrapping = TextWrapping.Wrap,
|
|
|
|
|
TextDecorations = TextDecorations.Underline,
|
|
|
|
|
Foreground = Brushes.Blue
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
border.Child = textBlock;
|
|
|
|
|
Grid.SetRow(border, row);
|
|
|
|
|
Grid.SetColumn(border, column);
|
|
|
|
|
|
|
|
|
|
// 添加点击事件
|
|
|
|
|
border.MouseLeftButtonDown += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
OnTaskNumberClicked(data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 添加鼠标悬停效果
|
|
|
|
|
border.MouseEnter += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
border.Background = Brushes.LightYellow;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
border.MouseLeave += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
border.Background = Brushes.White;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.MainGrid.Children.Add(border);
|
|
|
|
|
}
|
|
|
|
|
private void OnTaskNumberClicked(ProductProcessData data)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"打开任务详情窗口: {data.check_no}");
|
|
|
|
|
LogHelper.instance.log.Info($"打开任务详情窗口,任务编号: {data.check_no}");
|
|
|
|
|
|
|
|
|
|
// 创建并显示任务详情窗口
|
|
|
|
|
Lanju_Product_Process_Check_Task_Detail detailWindow = new Lanju_Product_Process_Check_Task_Detail(data);
|
|
|
|
|
|
|
|
|
|
// 设置为模态窗口
|
|
|
|
|
detailWindow.ShowDialog();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"[Error] 打开任务详情窗口时出错: {ex.Message}");
|
|
|
|
|
LogHelper.instance.log.Error($"[Error] 打开任务详情窗口时出错: {ex.Message}");
|
|
|
|
|
|
|
|
|
|
// 显示错误提示
|
|
|
|
|
MessageBox.Show($"打开任务详情窗口时出错:\n{ex.Message}", "错误",
|
|
|
|
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddCell(string content, int row, int column)
|
|
|
|
|
{
|
|
|
|
|
Border border = new Border
|
|
|
|
|
{
|
|
|
|
|
BorderBrush = Brushes.Black,
|
|
|
|
|
BorderThickness = new Thickness(0.5),
|
|
|
|
|
Padding = new Thickness(5)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TextBlock textBlock = new TextBlock
|
|
|
|
|
{
|
|
|
|
|
Text = content,
|
|
|
|
|
TextAlignment = TextAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
TextWrapping = TextWrapping.Wrap
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 根据行号设置背景色(奇偶行不同颜色)
|
|
|
|
|
|
|
|
|
|
border.Background = Brushes.White;
|
|
|
|
|
|
|
|
|
|
border.Child = textBlock;
|
|
|
|
|
Grid.SetRow(border, row);
|
|
|
|
|
Grid.SetColumn(border, column);
|
|
|
|
|
this.MainGrid.Children.Add(border);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MakeHeaderData()
|
|
|
|
|
{
|
|
|
|
|
#region 画线
|
|
|
|
|
for (int i = 0; i < 11; i++)
|
|
|
|
|
{
|
|
|
|
|
double width = 1.0;
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
width = 1.2;
|
|
|
|
|
}
|
|
|
|
|
if (i == 1)
|
|
|
|
|
{
|
|
|
|
|
width = 1.5;
|
|
|
|
|
}
|
|
|
|
|
if (i == 2)
|
|
|
|
|
{
|
|
|
|
|
width = 6.0;
|
|
|
|
|
}
|
|
|
|
|
if (i == 3)
|
|
|
|
|
{
|
|
|
|
|
width = 0.8;
|
|
|
|
|
}
|
|
|
|
|
if (i == 4)
|
|
|
|
|
{
|
|
|
|
|
width = 0.8;
|
|
|
|
|
}
|
|
|
|
|
this.MainGrid.ColumnDefinitions.Add(new ColumnDefinition()
|
|
|
|
|
{
|
|
|
|
|
Width = new GridLength(width, GridUnitType.Star)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 画表格竖线
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 11; i++)
|
|
|
|
|
{
|
|
|
|
|
// ✅ 跳过第3行(索引2)第6~11列(索引6~11)之间的竖线
|
|
|
|
|
if ((i < 4 || i % 2 == 1) && !(i >= 6 && i <= 11))
|
|
|
|
|
{
|
|
|
|
|
Line line = new Line()
|
|
|
|
|
{
|
|
|
|
|
Name = $"YLine{i}",
|
|
|
|
|
Stroke = Brushes.Black,
|
|
|
|
|
StrokeThickness = 1,
|
|
|
|
|
Y1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Left,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(line, i);
|
|
|
|
|
Grid.SetRow(line, 0);
|
|
|
|
|
|
|
|
|
|
if (i >= 4 && i % 2 == 0)
|
|
|
|
|
{
|
|
|
|
|
Grid.SetRowSpan(line, 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Grid.SetRowSpan(line, 99);
|
|
|
|
|
}
|
|
|
|
|
this.MainGrid.Children.Add(line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加最后一列右边的边界线
|
|
|
|
|
Line boundaryLine = new Line()
|
|
|
|
|
{
|
|
|
|
|
Name = "BoundaryLine",
|
|
|
|
|
Stroke = Brushes.Black,
|
|
|
|
|
StrokeThickness = 1,
|
|
|
|
|
Y1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Right, // 让它靠右对齐
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 设置它在第 11 列(超出当前最大列)
|
|
|
|
|
Grid.SetColumn(boundaryLine, 11);
|
|
|
|
|
Grid.SetRow(boundaryLine, 0);
|
|
|
|
|
Grid.SetRowSpan(boundaryLine, 99); // 让它跨 99 行,确保足够高
|
|
|
|
|
this.MainGrid.Children.Add(boundaryLine);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 画表格横线
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <= 2; i++)
|
|
|
|
|
{
|
|
|
|
|
this.MainGrid.RowDefinitions.Add(new RowDefinition()
|
|
|
|
|
{
|
|
|
|
|
Height = new GridLength(1, GridUnitType.Star)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 跳过第 1 行,不画线
|
|
|
|
|
if (i == 1)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Line line = new Line()
|
|
|
|
|
{
|
|
|
|
|
Name = $"XLine{i}",
|
|
|
|
|
Stroke = Brushes.Black,
|
|
|
|
|
StrokeThickness = 1,
|
|
|
|
|
X1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Top,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Grid.SetColumn(line, 0);
|
|
|
|
|
Grid.SetRow(line, i);
|
|
|
|
|
Grid.SetColumnSpan(line, 11);
|
|
|
|
|
this.MainGrid.Children.Add(line);
|
|
|
|
|
|
|
|
|
|
// 仅在最后一行(i == 2)添加底部边界线
|
|
|
|
|
if (i == 2)
|
|
|
|
|
{
|
|
|
|
|
Line line1 = new Line()
|
|
|
|
|
{
|
|
|
|
|
Stroke = Brushes.Black,
|
|
|
|
|
StrokeThickness = 1,
|
|
|
|
|
X1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Bottom,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(line1, 0);
|
|
|
|
|
Grid.SetRow(line1, i);
|
|
|
|
|
Grid.SetColumnSpan(line1, 15);
|
|
|
|
|
this.MainGrid.Children.Add(line1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 画表头
|
|
|
|
|
TextBlock textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "产线名称",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 0);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "序号",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 0);
|
|
|
|
|
Grid.SetRow(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "检查项目",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 1);
|
|
|
|
|
Grid.SetRow(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = LineStr,
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 1);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
StackPanel stackPanel = new StackPanel
|
|
|
|
|
{
|
|
|
|
|
Orientation = Orientation.Horizontal,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TextBlock textBlock2 = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "日期:",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
};
|
|
|
|
|
stackPanel.Children.Add(textBlock2);
|
|
|
|
|
|
|
|
|
|
var datePicker = new DatePicker()
|
|
|
|
|
{
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
SelectedDate = DateTime.Parse(date)
|
|
|
|
|
};
|
|
|
|
|
datePicker.SelectedDateChanged += (s, e) =>
|
|
|
|
|
{
|
|
|
|
|
date = ((DatePicker)s).SelectedDate.Value.ToString("yyyy-MM-dd");
|
|
|
|
|
LoadData();
|
|
|
|
|
};
|
|
|
|
|
stackPanel.Children.Add(datePicker);
|
|
|
|
|
// ✅ 让 StackPanel 跨两行
|
|
|
|
|
Grid.SetColumn(stackPanel, 2);
|
|
|
|
|
Grid.SetRow(stackPanel, 0);
|
|
|
|
|
Grid.SetRowSpan(stackPanel, 2); // ✅ 这里改成对 stackPanel 设置 RowSpan
|
|
|
|
|
this.MainGrid.Children.Add(stackPanel);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "班次",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 3);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
int index = 1;
|
|
|
|
|
|
|
|
|
|
// 假设这是返回的集合
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = shiftName,
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 5);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "点检人",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 7);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
// 在"点检人"左侧(列索引 7)添加竖线
|
|
|
|
|
Line lineLeft = new Line()
|
|
|
|
|
{
|
|
|
|
|
Stroke = Brushes.Black, // 你可以改成 Black
|
|
|
|
|
StrokeThickness = 1, // 线条加粗
|
|
|
|
|
Y1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Left,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(lineLeft, 7);
|
|
|
|
|
Grid.SetRow(lineLeft, 0);
|
|
|
|
|
Grid.SetRowSpan(lineLeft, 2);
|
|
|
|
|
this.MainGrid.Children.Add(lineLeft);
|
|
|
|
|
|
|
|
|
|
// 在"点检人"右侧(列索引 8)添加竖线
|
|
|
|
|
Line lineRight = new Line()
|
|
|
|
|
{
|
|
|
|
|
Stroke = Brushes.Black, // 你可以改成 Black
|
|
|
|
|
StrokeThickness = 1, // 线条加粗
|
|
|
|
|
Y1 = 1,
|
|
|
|
|
Stretch = Stretch.Fill,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Right,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(lineRight, 8);
|
|
|
|
|
Grid.SetRow(lineRight, 0);
|
|
|
|
|
Grid.SetRowSpan(lineRight, 2);
|
|
|
|
|
this.MainGrid.Children.Add(lineRight);
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = LoginUser.UserName,
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 9);
|
|
|
|
|
Grid.SetRow(textBlock, 0);
|
|
|
|
|
Grid.SetRowSpan(textBlock, 2);
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "检查标准",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, 2);
|
|
|
|
|
Grid.SetRow(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
for (int i = 3; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i % 2 == 1)
|
|
|
|
|
{
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "检查结果",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
Grid.SetColumn(textBlock, i);
|
|
|
|
|
Grid.SetRow(textBlock, 2);
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 2);
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
textBlock = new TextBlock()
|
|
|
|
|
{
|
|
|
|
|
Text = "存在问题",
|
|
|
|
|
FontSize = 18,
|
|
|
|
|
FontWeight = FontWeights.Bold,
|
|
|
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
|
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 设置到第3行(索引2)
|
|
|
|
|
Grid.SetRow(textBlock, 2);
|
|
|
|
|
|
|
|
|
|
// 从第6列(索引5)开始
|
|
|
|
|
Grid.SetColumn(textBlock, 5);
|
|
|
|
|
|
|
|
|
|
// **合并6到11列(索引5到10),共6列**
|
|
|
|
|
Grid.SetColumnSpan(textBlock, 6);
|
|
|
|
|
|
|
|
|
|
this.MainGrid.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ToggleButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (((ToggleButton)sender).TemplatedParent is ComboBox comboBox)
|
|
|
|
|
{
|
|
|
|
|
comboBox.IsDropDownOpen = !comboBox.IsDropDownOpen;
|
|
|
|
|
var data = comboBox.Tag as ProductProcessData;
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
|
|
|
|
var detailWindow = new Lanju_Product_Process_Check_Task_Detail(data);
|
|
|
|
|
|
|
|
|
|
detailWindow.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//刷新
|
|
|
|
|
private void Refresh_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
//关闭
|
|
|
|
|
private void Close_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|