using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SCM.单据资料
{
public partial class 分切检验明细表 : Form
{
//[h_c_barcodedetail]
//h_c_barcodemain
public 分切检验明细表()
{
InitializeComponent();
dateTimePicker1.Text = DateTime.Now.AddDays(-7).ToString();
dateTimePicker2.Text = DateTime.Now.ToString();
comboBox1.SelectedItem = "全部";
comboBox2.SelectedItem = "默认排序";
oWeb.Url = SCM.ClsPub1.WEBSURL;
}
public frmBillQueryCondition_Base frmCondition;
public string ViewName = "h_c_barcodedetail";
public string ModCaption = "成分分切检验明细表";
public const string ModName = "1250";
public string sDlgWhere = ""; //外窗体递入
public int selectRow = 0;
SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
///
/// 查询
///
///
///
private void cx_Click(object sender, EventArgs e)
{
Display();
}
public void SetCondition(frmBillQueryCondition_Base frmCondition, string ViewName, string Name)
{
frmCondition.Tag = "";
frmCondition.ViewName = ViewName;
frmCondition.ModName = Name;
}
private void Display()
{
StringBuilder whereBuilder = new StringBuilder();
if (string.IsNullOrEmpty(dateTimePicker1.Text) || string.IsNullOrEmpty(dateTimePicker2.Text))
{
MessageBox.Show("输入时间不能为空");
return;
}
if(DateTime.Parse(dateTimePicker1.Text)> DateTime.Parse(dateTimePicker2.Text))
{
MessageBox.Show("开始时间不能大于截至时间");
return;
}
whereBuilder.Append($" and a.HMakeDate>''{dateTimePicker1.Text}'' and a.HMakeDate<''{dateTimePicker2.Text}''");
if (!string.IsNullOrEmpty(txtHBillNo.Text))
whereBuilder.Append($" and a.HMaterName like ''%{txtHBillNo.Text}%''");
if(!string.IsNullOrEmpty(textBox1.Text))
whereBuilder.Append($" and b.FNUMBER like ''%{textBox1.Text}%''");
if (!string.IsNullOrEmpty(textBox2.Text))
whereBuilder.Append($" and c.FLOT_TEXT like ''%{textBox2.Text}%''");
if(comboBox1.Text!="全部")
whereBuilder.Append($" and a.HRemark=''{comboBox1.Text}''");
if (!string.IsNullOrEmpty(textBox4.Text))
whereBuilder.Append($" and d.HName like ''%{textBox4.Text}%''");
if (!string.IsNullOrEmpty(textBox5.Text))
whereBuilder.Append($" and e.HName like ''%{textBox5.Text}%''");
if (!string.IsNullOrEmpty(textBox6.Text))
whereBuilder.Append($" and a.HWorkLineName like ''%{textBox6.Text}%''");
string orderBy = " order by a.HMakeDate desc ";
if(comboBox2.Text=="产品名称")
{
orderBy = " order by a.HMaterName desc ";
}
if(comboBox2.Text=="批次排序")
{
orderBy = " order by a.HBatchNo desc";
}
string execSql = $"exec {ViewName} '{whereBuilder}','{orderBy}'";
DataSet DSet = oWeb.getDataSetBySQL(execSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
//生成首行标题
if (DSet == null)
{
MessageBox.Show("没有返回任何结果,请在过滤框中点击【恢复】按钮,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
return;
}
//
grdMain.DataSource = DSet.Tables[0].DefaultView;
//冻结
//int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
//string s = frmCondition.cmbHComplete.Text;
//ClsPub1.DisplayGrid(grdMain, this.Name, s, FrCol);
}
///
/// 退出
///
///
///
private void tc_Click(object sender, EventArgs e)
{
this.Close();
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void label9_Click(object sender, EventArgs e)
{
}
}
}