|
|
using CommonFunc;
|
|
|
using CommonFunc.Tools;
|
|
|
using HandyControl.Tools.Extension;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Timers;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
using System.Windows.Data;
|
|
|
using System.Windows.Documents;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Shapes;
|
|
|
using Telerik.Windows.Controls;
|
|
|
using XGL.Data.DBService;
|
|
|
using XGL.Models;
|
|
|
|
|
|
namespace XGLFinishPro.Views
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// ReportForm.xaml 的交互逻辑
|
|
|
/// </summary>
|
|
|
public partial class ReportForm : Window
|
|
|
{
|
|
|
private bool IsEdit = false;
|
|
|
/// <summary>
|
|
|
/// 数据库交互
|
|
|
/// </summary>
|
|
|
FormingMachineService formingMachineService = new FormingMachineService();
|
|
|
private report editReport;
|
|
|
private List<XGL.Models.report> reports;
|
|
|
private readonly string OpenLineCheckBox = "OpenLineCheckBox";
|
|
|
private readonly string ReplaceLineCheckBox = "ReplaceLineCheckBox";
|
|
|
/// <summary>
|
|
|
/// 上一任务不良品是否处理并放置在不合格品区域
|
|
|
/// </summary>
|
|
|
private readonly string unqualified = "unqualified";
|
|
|
/// <summary>
|
|
|
/// 涉及内容物转换,上一任务内容物是否清理干净
|
|
|
/// </summary>
|
|
|
private readonly string clear = "clear";
|
|
|
/// <summary>
|
|
|
/// 上一任务剩余包材/内容物是否做好防护、标识并放在指定位置
|
|
|
/// </summary>
|
|
|
private readonly string residue = "residue";
|
|
|
/// <summary>
|
|
|
/// 流水线是否清理干净,无与当班次生产无关的东西存处
|
|
|
/// </summary>
|
|
|
private readonly string lineClear = "lineClear";
|
|
|
/// <summary>
|
|
|
/// 作业员是否清楚当班次操作
|
|
|
/// </summary>
|
|
|
private readonly string UserKnow = "UserKnow";
|
|
|
/// <summary>
|
|
|
/// 该班次内容物、包材是否符合
|
|
|
/// </summary>
|
|
|
private readonly string qualified = "qualified";
|
|
|
/// <summary>
|
|
|
/// 班次现场使用的设备是否可以正常工作
|
|
|
/// </summary>
|
|
|
private readonly string equipStatus = "equipStatus";
|
|
|
/// <summary>
|
|
|
/// 该班次生产批号是否正确
|
|
|
/// </summary>
|
|
|
private readonly string StampCorrect = "StampCorrect";
|
|
|
/// <summary>
|
|
|
/// 不良品是否处理干净并放置在不合格品区域
|
|
|
/// </summary>
|
|
|
private readonly string isClear = "isClear";
|
|
|
/// <summary>
|
|
|
/// 剩余包材/内容物是否做好防护并放在指定位置
|
|
|
/// </summary>
|
|
|
private readonly string positionCorrect = "positionCorrect";
|
|
|
/// <summary>
|
|
|
/// 流水线是否清理干净
|
|
|
/// </summary>
|
|
|
private readonly string isLineClear = "isLineClear";
|
|
|
/// <summary>
|
|
|
/// 班次
|
|
|
/// </summary>
|
|
|
private readonly string team = "team";
|
|
|
private bool Loading = true;
|
|
|
public ReportForm()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
foreach (var item in this.MainGrid.Children)
|
|
|
{
|
|
|
if (item is ComboBox comboBox)
|
|
|
{
|
|
|
comboBox.ItemsSource = new List<string> { string.Empty, "√", "×" };
|
|
|
}
|
|
|
}
|
|
|
Canvas.SetLeft(canvasGrid, -1000);
|
|
|
this.Workshop.Text = string.Empty;
|
|
|
this.line.Text = string.Empty;
|
|
|
this.date.Text = string.Empty;
|
|
|
//this.Workshop.Text = Utils.GetAppSetting("SiteCode");
|
|
|
this.Workshop.Text = "黑蚊香";
|
|
|
try
|
|
|
{
|
|
|
this.Workshop.Text=formingMachineService.GetBaseEquipment(Utils.GetAppSetting("SiteCode"));
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
this.line.Text = Utils.GetAppSetting("LineCode");
|
|
|
this.Name.Text = LoginUser.UserName;
|
|
|
for (int i = 1; i <= 6; i++)
|
|
|
{
|
|
|
if (FindName(team + i) is TextBlock text11)
|
|
|
{
|
|
|
text11.Text = string.Empty;
|
|
|
}
|
|
|
if (FindName(unqualified + i) is ComboBox text)
|
|
|
{
|
|
|
text.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(clear + i) is ComboBox text1)
|
|
|
{
|
|
|
text1.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(residue + i) is ComboBox text2)
|
|
|
{
|
|
|
text2.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(lineClear + i) is ComboBox text3)
|
|
|
{
|
|
|
text3.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(UserKnow + i) is ComboBox text4)
|
|
|
{
|
|
|
text4.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(qualified + i) is ComboBox text5)
|
|
|
{
|
|
|
text5.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(equipStatus + i) is ComboBox text6)
|
|
|
{
|
|
|
text6.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(StampCorrect + i) is ComboBox text7)
|
|
|
{
|
|
|
text7.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(isClear + i) is ComboBox text8)
|
|
|
{
|
|
|
text8.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(positionCorrect + i) is ComboBox text9)
|
|
|
{
|
|
|
text9.SelectedItem = string.Empty;
|
|
|
}
|
|
|
if (FindName(isLineClear + i) is ComboBox text10)
|
|
|
{
|
|
|
text10.SelectedItem = string.Empty;
|
|
|
}
|
|
|
}
|
|
|
IsEdit = false;
|
|
|
GetData();
|
|
|
IsEdit = false;
|
|
|
Loading = false;
|
|
|
}
|
|
|
|
|
|
private void ToggleButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
if (((ToggleButton)sender).TemplatedParent is ComboBox comboBox)
|
|
|
{
|
|
|
comboBox.IsDropDownOpen = !comboBox.IsDropDownOpen;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void GetData()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (IsEdit)
|
|
|
{
|
|
|
MessageBoxResult messageBoxResult = MessageBox.Show("有未保存的数据,是否继续?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
if (messageBoxResult == MessageBoxResult.Cancel)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
IsEdit = false;
|
|
|
reports = formingMachineService.GetReportData(LoginUser.UserName);
|
|
|
Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
this.date.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
{
|
|
|
if (FindName(unqualified + (i + 1)) is ComboBox text)
|
|
|
{
|
|
|
text.SelectedItem = reports[i].unqualified;
|
|
|
}
|
|
|
if (FindName(clear + (i + 1)) is ComboBox text1)
|
|
|
{
|
|
|
text1.SelectedItem = reports[i].clear;
|
|
|
}
|
|
|
if (FindName(residue + (i + 1)) is ComboBox text2)
|
|
|
{
|
|
|
text2.SelectedItem = reports[i].residue;
|
|
|
}
|
|
|
if (FindName(lineClear + (i + 1)) is ComboBox text3)
|
|
|
{
|
|
|
text3.SelectedItem = reports[i].lineClear;
|
|
|
}
|
|
|
if (FindName(UserKnow + (i + 1)) is ComboBox text4)
|
|
|
{
|
|
|
text4.SelectedItem = reports[i].UserKnow;
|
|
|
}
|
|
|
if (FindName(qualified + (i + 1)) is ComboBox text5)
|
|
|
{
|
|
|
text5.SelectedItem = reports[i].qualified;
|
|
|
}
|
|
|
if (FindName(equipStatus + (i + 1)) is ComboBox text6)
|
|
|
{
|
|
|
text6.SelectedItem = reports[i].equipStatus;
|
|
|
}
|
|
|
if (FindName(StampCorrect + (i + 1)) is ComboBox text7)
|
|
|
{
|
|
|
text7.SelectedItem = reports[i].StampCorrect;
|
|
|
}
|
|
|
if (FindName(isClear + (i + 1)) is ComboBox text8)
|
|
|
{
|
|
|
text8.SelectedItem = reports[i].isClear;
|
|
|
}
|
|
|
if (FindName(positionCorrect + (i + 1)) is ComboBox text9)
|
|
|
{
|
|
|
text9.SelectedItem = reports[i].positionCorrect;
|
|
|
}
|
|
|
if (FindName(isLineClear + (i + 1)) is ComboBox text10)
|
|
|
{
|
|
|
text10.SelectedItem = reports[i].isLineClear;
|
|
|
}
|
|
|
if (FindName(team + (i + 1)) is TextBlock text11)
|
|
|
{
|
|
|
text11.Text = reports[i].team == null ? string.Empty : reports[i].team == "2" ? "夜班" : "白班";
|
|
|
}
|
|
|
if (FindName(OpenLineCheckBox + (i + 1)) is CheckBox checkBox)
|
|
|
{
|
|
|
checkBox.IsChecked = (reports[i].OpenLineCheckBox == "√");
|
|
|
}
|
|
|
if (FindName(ReplaceLineCheckBox + (i + 1)) is CheckBox checkBox1)
|
|
|
{
|
|
|
checkBox1.IsChecked = (reports[i].ReplaceLineCheckBox == "√");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void AddGetData()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (IsEdit)
|
|
|
{
|
|
|
MessageBoxResult messageBoxResult = MessageBox.Show("有未保存的数据,是否继续?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
if (messageBoxResult == MessageBoxResult.Cancel)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
IsEdit = false;
|
|
|
reports = formingMachineService.GetReportData(LoginUser.UserName);
|
|
|
reports.Insert(0, new report());
|
|
|
reports.Remove(reports.Last());
|
|
|
Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
this.date.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
{
|
|
|
if (FindName(unqualified + (i + 1)) is ComboBox text)
|
|
|
{
|
|
|
text.SelectedItem = reports[i].unqualified;
|
|
|
}
|
|
|
if (FindName(clear + (i + 1)) is ComboBox text1)
|
|
|
{
|
|
|
text1.SelectedItem = reports[i].clear;
|
|
|
}
|
|
|
if (FindName(residue + (i + 1)) is ComboBox text2)
|
|
|
{
|
|
|
text2.SelectedItem = reports[i].residue;
|
|
|
}
|
|
|
if (FindName(lineClear + (i + 1)) is ComboBox text3)
|
|
|
{
|
|
|
text3.SelectedItem = reports[i].lineClear;
|
|
|
}
|
|
|
if (FindName(UserKnow + (i + 1)) is ComboBox text4)
|
|
|
{
|
|
|
text4.SelectedItem = reports[i].UserKnow;
|
|
|
}
|
|
|
if (FindName(qualified + (i + 1)) is ComboBox text5)
|
|
|
{
|
|
|
text5.SelectedItem = reports[i].qualified;
|
|
|
}
|
|
|
if (FindName(equipStatus + (i + 1)) is ComboBox text6)
|
|
|
{
|
|
|
text6.SelectedItem = reports[i].equipStatus;
|
|
|
}
|
|
|
if (FindName(StampCorrect + (i + 1)) is ComboBox text7)
|
|
|
{
|
|
|
text7.SelectedItem = reports[i].StampCorrect;
|
|
|
}
|
|
|
if (FindName(isClear + (i + 1)) is ComboBox text8)
|
|
|
{
|
|
|
text8.SelectedItem = reports[i].isClear;
|
|
|
}
|
|
|
if (FindName(positionCorrect + (i + 1)) is ComboBox text9)
|
|
|
{
|
|
|
text9.SelectedItem = reports[i].positionCorrect;
|
|
|
}
|
|
|
if (FindName(isLineClear + (i + 1)) is ComboBox text10)
|
|
|
{
|
|
|
text10.SelectedItem = reports[i].isLineClear;
|
|
|
}
|
|
|
if (FindName(team + (i + 1)) is TextBlock text11)
|
|
|
{
|
|
|
text11.Text = reports[i].team == null ? string.Empty : reports[i].team == "2" ? "夜班" : "白班";
|
|
|
}
|
|
|
if (FindName(OpenLineCheckBox + (i + 1)) is CheckBox checkBox)
|
|
|
{
|
|
|
checkBox.IsChecked = (reports[i].OpenLineCheckBox == "√");
|
|
|
}
|
|
|
if (FindName(ReplaceLineCheckBox + (i + 1)) is CheckBox checkBox1)
|
|
|
{
|
|
|
checkBox1.IsChecked = (reports[i].ReplaceLineCheckBox == "√");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void Add_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
AddGetData();
|
|
|
}
|
|
|
|
|
|
private void Submit_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
foreach (var report in reports)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(report.Id))
|
|
|
{
|
|
|
formingMachineService.EditReport(report);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(report.team))
|
|
|
{
|
|
|
report.Id = Guid.NewGuid().ToString();
|
|
|
formingMachineService.AddReport(report);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
MessageBox.Show("提交成功!");
|
|
|
IsEdit = false;
|
|
|
GetData();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
MessageBox.Show("提交失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void Close_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
this.Close();
|
|
|
}
|
|
|
|
|
|
private void Edit_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
new AddReportFrom("Edit", editReport).ShowDialog();
|
|
|
GetData();
|
|
|
}
|
|
|
|
|
|
private void ContextMenu_Opened(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
//获取鼠标位置
|
|
|
Point mousePosition = Mouse.GetPosition(this);
|
|
|
Point top = this.TopLine.TransformToVisual(this).Transform(new Point(0, this.TopLine.Y1));
|
|
|
Point bottom = this.BottomLine.TransformToVisual(this).Transform(new Point(0, this.BottomLine.Y1));
|
|
|
if (mousePosition.Y > top.Y && mousePosition.Y < bottom.Y)
|
|
|
{
|
|
|
Point firstPoint = this.FirstLine.TransformToVisual(this).Transform(new Point(this.FirstLine.X1, 0));
|
|
|
Point secondPoint = this.SecondLine.TransformToVisual(this).Transform(new Point(this.SecondLine.X1, 0));
|
|
|
Point thirdLine = this.ThirdLine.TransformToVisual(this).Transform(new Point(this.ThirdLine.X1, 0));
|
|
|
Point fourthLine = this.FourthLine.TransformToVisual(this).Transform(new Point(this.FourthLine.X1, 0));
|
|
|
Point fifthLine = this.FifthLine.TransformToVisual(this).Transform(new Point(this.FifthLine.X1, 0));
|
|
|
Point sixthLine = this.SixthLine.TransformToVisual(this).Transform(new Point(this.SixthLine.X1, 0));
|
|
|
Point SeventhLine = this.SixthLine.TransformToVisual(this).Transform(new Point(this.SeventhLine.X1, 0));
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
this.EditButton.Visibility = Visibility.Visible;
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < secondPoint.X)
|
|
|
{
|
|
|
editReport = reports[0];
|
|
|
}
|
|
|
else if (mousePosition.X > secondPoint.X && mousePosition.X < thirdLine.X)
|
|
|
{
|
|
|
editReport = reports[1];
|
|
|
}
|
|
|
else if (mousePosition.X > thirdLine.X && mousePosition.X < fourthLine.X)
|
|
|
{
|
|
|
editReport = reports[2];
|
|
|
}
|
|
|
else if (mousePosition.X > fourthLine.X && mousePosition.X < fifthLine.X)
|
|
|
{
|
|
|
editReport = reports[3];
|
|
|
}
|
|
|
else if (mousePosition.X > fifthLine.X && mousePosition.X < sixthLine.X)
|
|
|
{
|
|
|
editReport = reports[4];
|
|
|
}
|
|
|
else if (mousePosition.X > sixthLine.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
editReport = reports[5];
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
this.EditButton.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.EditButton.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.EditButton.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void Window_Closed(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
private void ReplaceLineCheckBox1_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Window_MouseDown(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
//获取鼠标位置
|
|
|
Point mousePosition = Mouse.GetPosition(this);
|
|
|
Point top = this.TopLine.TransformToVisual(this).Transform(new Point(0, this.TopLine.Y1));
|
|
|
Point bottom = this.BottomLine.TransformToVisual(this).Transform(new Point(0, this.BottomLine.Y1));
|
|
|
if (mousePosition.Y > top.Y && mousePosition.Y < bottom.Y)
|
|
|
{
|
|
|
Point firstPoint = this.FirstLine.TransformToVisual(this).Transform(new Point(this.FirstLine.X1, 0));
|
|
|
Point secondPoint = this.SecondLine.TransformToVisual(this).Transform(new Point(this.SecondLine.X1, 0));
|
|
|
Point thirdLine = this.ThirdLine.TransformToVisual(this).Transform(new Point(this.ThirdLine.X1, 0));
|
|
|
Point fourthLine = this.FourthLine.TransformToVisual(this).Transform(new Point(this.FourthLine.X1, 0));
|
|
|
Point fifthLine = this.FifthLine.TransformToVisual(this).Transform(new Point(this.FifthLine.X1, 0));
|
|
|
Point sixthLine = this.SixthLine.TransformToVisual(this).Transform(new Point(this.SixthLine.X1, 0));
|
|
|
Point SeventhLine = this.SeventhLine.TransformToVisual(this).Transform(new Point(this.SeventhLine.X1, 0));
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
Canvas.SetTop(canvasGrid, top.Y);
|
|
|
canvasGrid.Width = secondPoint.X - firstPoint.X;
|
|
|
canvasGrid.Height = bottom.Y - top.Y;
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < secondPoint.X)
|
|
|
{
|
|
|
editReport = reports[0];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
//将坐标在firstPoint.X到secondPoint.X,bottom.Y到top.Y范围内的背景色变为绿色
|
|
|
Canvas.SetLeft(canvasGrid, firstPoint.X);
|
|
|
}
|
|
|
}
|
|
|
else if (mousePosition.X > secondPoint.X && mousePosition.X < thirdLine.X)
|
|
|
{
|
|
|
editReport = reports[1];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, secondPoint.X);
|
|
|
}
|
|
|
}
|
|
|
else if (mousePosition.X > thirdLine.X && mousePosition.X < fourthLine.X)
|
|
|
{
|
|
|
editReport = reports[2];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, thirdLine.X);
|
|
|
}
|
|
|
}
|
|
|
else if (mousePosition.X > fourthLine.X && mousePosition.X < fifthLine.X)
|
|
|
{
|
|
|
editReport = reports[3];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, fourthLine.X);
|
|
|
}
|
|
|
}
|
|
|
else if (mousePosition.X > fifthLine.X && mousePosition.X < sixthLine.X)
|
|
|
{
|
|
|
editReport = reports[4];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, fifthLine.X);
|
|
|
}
|
|
|
}
|
|
|
else if (mousePosition.X > sixthLine.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
editReport = reports[5];
|
|
|
if (!string.IsNullOrEmpty(editReport.Id))
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, sixthLine.X);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, -1000);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, -1000);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Canvas.SetLeft(canvasGrid, -1000);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void ClickBox_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
IsEdit = true;
|
|
|
if (sender is CheckBox checkBox)
|
|
|
{
|
|
|
if (checkBox.IsChecked ?? false)
|
|
|
{
|
|
|
if (checkBox.Name.Contains(OpenLineCheckBox))
|
|
|
{
|
|
|
object v = this.FindName(ReplaceLineCheckBox + checkBox.Name.Replace(OpenLineCheckBox, ""));
|
|
|
if (v is CheckBox replaceLineCheckBox)
|
|
|
{
|
|
|
replaceLineCheckBox.IsChecked = false;
|
|
|
report report = GetReport();
|
|
|
report.OpenLineCheckBox = "√";
|
|
|
}
|
|
|
}
|
|
|
else if (checkBox.Name.Contains(ReplaceLineCheckBox))
|
|
|
{
|
|
|
if (this.FindName(OpenLineCheckBox + checkBox.Name.Replace(ReplaceLineCheckBox, "")) is CheckBox openLineCheckBox)
|
|
|
{
|
|
|
openLineCheckBox.IsChecked = false;
|
|
|
report report = GetReport();
|
|
|
report.ReplaceLineCheckBox = "√";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private report GetReport()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//获取鼠标位置
|
|
|
Point mousePosition = Mouse.GetPosition(this);
|
|
|
Point top = this.TopLine.TransformToVisual(this).Transform(new Point(0, this.TopLine.Y1));
|
|
|
Point bottom = this.BottomLine.TransformToVisual(this).Transform(new Point(0, this.BottomLine.Y1));
|
|
|
if (mousePosition.Y > top.Y && mousePosition.Y < bottom.Y)
|
|
|
{
|
|
|
Point firstPoint = this.FirstLine.TransformToVisual(this).Transform(new Point(this.FirstLine.X1, 0));
|
|
|
Point secondPoint = this.SecondLine.TransformToVisual(this).Transform(new Point(this.SecondLine.X1, 0));
|
|
|
Point thirdLine = this.ThirdLine.TransformToVisual(this).Transform(new Point(this.ThirdLine.X1, 0));
|
|
|
Point fourthLine = this.FourthLine.TransformToVisual(this).Transform(new Point(this.FourthLine.X1, 0));
|
|
|
Point fifthLine = this.FifthLine.TransformToVisual(this).Transform(new Point(this.FifthLine.X1, 0));
|
|
|
Point sixthLine = this.SixthLine.TransformToVisual(this).Transform(new Point(this.SixthLine.X1, 0));
|
|
|
Point SeventhLine = this.SeventhLine.TransformToVisual(this).Transform(new Point(this.SeventhLine.X1, 0));
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
Canvas.SetTop(canvasGrid, top.Y);
|
|
|
canvasGrid.Width = secondPoint.X - firstPoint.X;
|
|
|
canvasGrid.Height = bottom.Y - top.Y;
|
|
|
if (mousePosition.X > firstPoint.X && mousePosition.X < secondPoint.X)
|
|
|
{
|
|
|
return reports[0];
|
|
|
}
|
|
|
else if (mousePosition.X > secondPoint.X && mousePosition.X < thirdLine.X)
|
|
|
{
|
|
|
return reports[1];
|
|
|
}
|
|
|
else if (mousePosition.X > thirdLine.X && mousePosition.X < fourthLine.X)
|
|
|
{
|
|
|
return reports[2];
|
|
|
}
|
|
|
else if (mousePosition.X > fourthLine.X && mousePosition.X < fifthLine.X)
|
|
|
{
|
|
|
return reports[3];
|
|
|
}
|
|
|
else if (mousePosition.X > fifthLine.X && mousePosition.X < sixthLine.X)
|
|
|
{
|
|
|
return reports[4];
|
|
|
}
|
|
|
else if (mousePosition.X > sixthLine.X && mousePosition.X < SeventhLine.X)
|
|
|
{
|
|
|
return reports[5];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
private void Refresh_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
GetData();
|
|
|
}
|
|
|
|
|
|
private void SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
if (Loading)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
IsEdit = true;
|
|
|
report report = GetReport();
|
|
|
if (report != null)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(report.team))
|
|
|
{
|
|
|
report.team = LoginPage.team;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(report.NickName))
|
|
|
{
|
|
|
report.NickName = LoginUser.UserName;
|
|
|
}
|
|
|
if (sender is ComboBox comboBox)
|
|
|
{
|
|
|
if (comboBox.Name.Contains(unqualified))
|
|
|
{
|
|
|
report.unqualified = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(clear))
|
|
|
{
|
|
|
report.clear = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(residue))
|
|
|
{
|
|
|
report.residue = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(lineClear))
|
|
|
{
|
|
|
report.lineClear = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(UserKnow))
|
|
|
{
|
|
|
report.UserKnow = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(qualified))
|
|
|
{
|
|
|
report.qualified = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(equipStatus))
|
|
|
{
|
|
|
report.equipStatus = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(StampCorrect))
|
|
|
{
|
|
|
report.StampCorrect = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(isClear))
|
|
|
{
|
|
|
report.isClear = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(positionCorrect))
|
|
|
{
|
|
|
report.positionCorrect = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
else if (comboBox.Name.Contains(isLineClear))
|
|
|
{
|
|
|
report.isLineClear = comboBox.SelectedItem.ToString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|