You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.9 KiB
85 lines
2.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using PunchAndWeld.DataSouce;
|
|
|
|
namespace PunchAndWeld
|
|
{
|
|
public partial class FrmDoorSill_214_3_Grid : Form
|
|
{
|
|
public FrmDoorSill_214_3_Grid()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
string date1 = this.dateTimeFr.Value.ToString("yyyy-MM-dd 00:00:00");
|
|
if (string.IsNullOrWhiteSpace(this.dateTimeFr.Text))
|
|
{
|
|
date1 = "1900-01-01 00:00:00";
|
|
}
|
|
string date2 = this.dateTimeTo.Value.ToString("yyyy-MM-dd 23:59:59");
|
|
if (string.IsNullOrWhiteSpace(this.dateTimeTo.Text))
|
|
{
|
|
date2 = "9999-01-01 00:00:00";
|
|
}
|
|
|
|
DateTime timeFr = DateTime.Now;
|
|
DateTime timeTo = DateTime.Now;
|
|
DateTime.TryParse(date1, out timeFr);
|
|
DateTime.TryParse(date2, out timeTo);
|
|
|
|
DataTable dt = ProScreenFunc.GetScanRecord_Lasers(timeFr, timeTo, txtBarCode.Text?.Trim());
|
|
dgridScanRecords.DataSource = dt;
|
|
|
|
txtAllQty.Text = dt.Rows.Count.ToString();
|
|
|
|
var grp1 = dt.AsEnumerable().GroupBy(p => p.Field<string>("LeftOrRight"));
|
|
foreach (var item1 in grp1)
|
|
{
|
|
if (item1.Key == "左")
|
|
{
|
|
txtLeftQty.Text = item1.ToList().Count.ToString();
|
|
}
|
|
else
|
|
{
|
|
txtRightQty.Text = item1.ToList().Count.ToString();
|
|
}
|
|
}
|
|
|
|
var grp2 = dt.AsEnumerable().GroupBy(p => p.Field<string>("Cfg"));
|
|
foreach (var item2 in grp2)
|
|
{
|
|
if (item2.Key == "高")
|
|
{
|
|
txtHighQty.Text = item2.ToList().Count.ToString();
|
|
}
|
|
else
|
|
{
|
|
txtLowQty.Text = item2.ToList().Count.ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FrmDoorSill_214_3_Grid_Load(object sender, EventArgs e)
|
|
{
|
|
this.dateTimeFr.Value = DateTime.Parse(DateTime.Now.ToShortDateString() + " 00:00");
|
|
this.dateTimeTo.Value = DateTime.Now;
|
|
dgridScanRecords.RowsAdded += DgridScanRecords_RowsAdded;
|
|
}
|
|
private void DgridScanRecords_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
|
|
{
|
|
for (int i = 0; i < e.RowCount; i++)
|
|
{
|
|
((DataGridView)sender).Rows[e.RowIndex + i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
|
|
((DataGridView)sender).Rows[e.RowIndex + i].HeaderCell.Value = (e.RowIndex + i + 1).ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|