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.
97 lines
2.8 KiB
97 lines
2.8 KiB
using PunchAndWeld.DataSouce;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PunchAndWeld
|
|
{
|
|
public partial class FrmProScreen2 : Form
|
|
{
|
|
public FrmProScreen2()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public event Action<string> OkClick;
|
|
|
|
private void FrmProScreen2_Load(object sender, EventArgs e)
|
|
{
|
|
#region 日期默认当天
|
|
|
|
dateTimePicker1.Text = DateTime.Now.ToShortDateString();
|
|
dateTimePicker2.Text = DateTime.Now.ToShortDateString();
|
|
|
|
#endregion
|
|
|
|
#region 查询
|
|
|
|
Query(dateTimePicker1.Value.ToString("yyyy-MM-dd").Trim(), dateTimePicker2.Value.ToString("yyyy-MM-dd").Trim());
|
|
|
|
#endregion
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
#region 查询
|
|
|
|
Query(dateTimePicker1.Value.ToString("yyyy-MM-dd").Trim(), dateTimePicker2.Value.ToString("yyyy-MM-dd").Trim());
|
|
|
|
#endregion
|
|
}
|
|
|
|
public void Query(string starttime, string endtime)
|
|
{
|
|
string stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
DataTable dtt = (DataTable)dataGridView1.DataSource;
|
|
if(dtt != null)
|
|
dtt.Rows.Clear();
|
|
|
|
DataTable dt = ProScreenFunc.QueryPlanDetail(starttime, endtime, stationNo);
|
|
dataGridView1.DataSource = dt;
|
|
//dataGridView1.AutoGenerateColumns = false;
|
|
ChangBackColor();
|
|
}
|
|
|
|
private void ChangBackColor() {
|
|
if (dataGridView1.Rows.Count > 0)
|
|
{
|
|
foreach (DataGridViewRow row in dataGridView1.Rows)
|
|
{
|
|
if (row.Cells["IsFinish"].Value.ToString() == "3")
|
|
{
|
|
row.DefaultCellStyle.ForeColor = Color.Green;
|
|
}
|
|
else
|
|
{
|
|
row.DefaultCellStyle.ForeColor = Color.Red;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView1.SelectedRows.Count == 0)
|
|
{
|
|
MessageBox.Show("请选择一个计划");
|
|
return;
|
|
}
|
|
|
|
int index = dataGridView1.CurrentRow.Index; //取得选中行的索引
|
|
string id = dataGridView1.Rows[index].Cells["ID"].Value.ToString(); //获取单元格列名为‘Id’的值
|
|
|
|
if (OkClick != null)
|
|
{
|
|
OkClick(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|