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.

184 lines
6.2 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Stone.Common;
using Stone.Entity;
namespace Stone.WinModule.BasicData
{
public partial class frmFeatureMatch : Stone.WinModule.frmBase
{
public frmFeatureMatch()
{
InitializeComponent();
DataTable dtState = new DataTable();
dtState.Columns.Add("Name");
dtState.Columns.Add("Code");
DataRow drState = null;
drState = dtState.NewRow();
drState["Name"] = "全部";
drState["Code"] = "";
dtState.Rows.Add(drState);
drState = dtState.NewRow();
drState["Name"] = "成功";
drState["Code"] = "成功";
dtState.Rows.Add(drState);
drState = dtState.NewRow();
drState["Name"] = "失败";
drState["Code"] = "失败";
dtState.Rows.Add(drState);
this.txtState.DataSource = dtState;
this.txtState.ValueMember = "Code";
this.txtState.DisplayMember = "Name";
}
private void frmFeatureMatch_Load(object sender, EventArgs e)
{
}
private void btnQuery_Click(object sender, EventArgs e)
{
this.btnQuery.Enabled = false;
this.btnQuery.Update();
try
{
string d1 = MyDateTime.Format(this.txtD1.Value, MyDateTimeType.Date);
string d2 = MyDateTime.Format(this.txtD2.Value, MyDateTimeType.Date);
string State = this.txtState.SelectedValue.ToString();
string OrderNumber = this.txtOrderNumber.Text.Trim();
string Feature1 = this.txtFeature1.Text.Trim();
string Feature2 = this.txtFeature2.Text.Trim();
string strWhere = "([AssemblyDate] between '" + d1 + "' and '" + d2 + "')";
if (State != "") strWhere += " and [State]='" + State + "'";
if (OrderNumber != "") strWhere += " and [OrderNumber]='" + OrderNumber + "'";
if (Feature1 != "") strWhere += " and [Match1]='" + Feature1 + "'";
if (Feature2 != "") strWhere += " and [Match2]='" + Feature2 + "'";
string sql = "select * from t_FeatureMatch where " + strWhere + " order by AssemblyDate asc";
Gm_WMS.DataAccess.DataService.LocalDBService db = new Gm_WMS.DataAccess.DataService.LocalDBService();
DataSet dsData = db.Exec_DataSet(sql);
this.dgrdView.DataSource = null;
this.dgrdView.DataSource = dsData.Tables[0];
MyGridViewStyle.SetDataGridMenuCommon(this.dgrdView);
this.toolStripStatusLabel1.Text = "记录:" + this.dgrdView.Rows.Count;
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
finally
{
this.btnQuery.Enabled = true;
Application.DoEvents();
}
}
private void btnReMatch_Click(object sender, EventArgs e)
{
this.btnReMatch.Enabled = false;
this.Update();
try
{
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要匹配的记录");
if (MyMessageBox.ShowQuestion("是否要重新配置选择记录"))
{
string OrderNumber = this.dgrdView.SelectedRows[0].Cells["OrderNumber"].Value.ToString();
Entity_t_JIS_Tod t_JIS_Tod = new Entity_t_JIS_Tod();
DataSet dsTod = t_JIS_Tod.GetData("[orderNumber]='" + OrderNumber + "'");
if (dsTod.Tables[0].Rows.Count == 0)
{
throw new Exception("未在TOD中找到订单 " + OrderNumber);
}
foreach (DataRow drTod in dsTod.Tables[0].Rows)
{
string SupplyGroup = drTod["SupplyGroup"].ToString();
string PartNumber = drTod["PartNumber"].ToString();
string AssemblyDate = MyDateTime.Format(Convert.ToDateTime(drTod["expectedAssemblyDate"]), MyDateTimeType.Date);
//F_EDI_JIS5000Sequence.TodFeatureMatch(OrderNumber, SupplyGroup, PartNumber, "", AssemblyDate);
}
btnQuery_Click(new object(), new EventArgs());
}
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
finally
{
this.btnReMatch.Enabled = true;
Application.DoEvents();
}
}
private void btnMatch_Click(object sender, EventArgs e)
{
this.btnMatch.Enabled = false;
this.Update();
try
{
if (this.dgrdView.SelectedRows.Count == 0) throw new Exception("请选择要匹配的记录");
string OrderNumber = this.dgrdView.SelectedRows[0].Cells["OrderNumber"].Value.ToString();
frmFeatureMatchHand frm = new frmFeatureMatchHand();
frm.textBox1.Text = OrderNumber;
if (frm.ShowDialog() == DialogResult.OK)
{
Entity_t_FeatureMatch t_FeatureMatch = new Entity_t_FeatureMatch();
t_FeatureMatch.Edit("[Match1]='" + frm.textBox2.Text.Trim() + "',[Match2]='" + frm.textBox3.Text.Trim() + "',[State]='成功'", "[OrderNumber]='" + OrderNumber + "'");
btnQuery_Click(new object(), new EventArgs());
}
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
finally
{
this.btnMatch.Enabled = true;
Application.DoEvents();
}
}
private void btnOut_Click(object sender, EventArgs e)
{
Stone.Common.MyExport.ShowExport(this.dgrdView);
}
}
}