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.
96 lines
2.8 KiB
96 lines
2.8 KiB
using PunchAndWeld.DataSouce;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PunchAndWeld
|
|
{
|
|
public partial class FrmSearchPlan : Form
|
|
{
|
|
public FrmSearchPlan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public event Action<string> OkClick;
|
|
|
|
private void FrmSearchPlan_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
|
|
}
|
|
|
|
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_1(starttime, endtime, stationNo);
|
|
dataGridView1.DataSource = dt;
|
|
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 btClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btSearch_Click(object sender, EventArgs e)
|
|
{
|
|
Query(dateTimePicker1.Value.ToString("yyyy-MM-dd").Trim(), dateTimePicker2.Value.ToString("yyyy-MM-dd").Trim());
|
|
}
|
|
|
|
private void btOk_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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|