⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchform.cs

📁 企业管理系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using System.Data;
using System.Data.OleDb;

namespace Eboer.MIS.MF.WinForm.Stock
{
	/// <summary>
	/// SearchForm 的摘要说明。
	/// </summary>
	public class SearchForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.RadioButton item;
		private System.Windows.Forms.RadioButton list;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.RadioButton jh;
		private System.Windows.Forms.RadioButton jy;
		private System.Windows.Forms.TextBox djhm;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.DateTimePicker endDate;
		private System.Windows.Forms.TextBox executeEr;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.DateTimePicker startDate;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.ComboBox pro;
		private System.Windows.Forms.ComboBox offer;
		private System.Windows.Forms.RadioButton noTime;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox areaName;
		private System.Windows.Forms.Label labd;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public SearchForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			this.LoadOffer();

			this.pro = Public.GetProList(this.pro);

			this.startDate.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月1日";
			this.endDate.Text   = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";
		}

		/// <summary>
		/// 载入订货商
		/// </summary>
		private void LoadOffer(){
			try{
				string sql = "select * from CorpColl where comType='STOCK'";
				OleDbDataAdapter ad = new OleDbDataAdapter(sql,Public.conn);
				DataSet ds = new DataSet();
				ad.Fill(ds,"list");
				if(ds != null){
					foreach(DataRow row in ds.Tables[0].Rows){
						this.offer.Items.Add(row["corName"].ToString() + "(" + row["sign"].ToString() +")");
					}
				}
			}catch(Exception ex){
				MessageBox.Show(ex.Message.ToString());
				return;
			}
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.item = new System.Windows.Forms.RadioButton();
			this.list = new System.Windows.Forms.RadioButton();
			this.button2 = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.pro = new System.Windows.Forms.ComboBox();
			this.jh = new System.Windows.Forms.RadioButton();
			this.jy = new System.Windows.Forms.RadioButton();
			this.djhm = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.offer = new System.Windows.Forms.ComboBox();
			this.endDate = new System.Windows.Forms.DateTimePicker();
			this.executeEr = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.startDate = new System.Windows.Forms.DateTimePicker();
			this.button1 = new System.Windows.Forms.Button();
			this.noTime = new System.Windows.Forms.RadioButton();
			this.label5 = new System.Windows.Forms.Label();
			this.areaName = new System.Windows.Forms.TextBox();
			this.labd = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// item
			// 
			this.item.Checked = true;
			this.item.Location = new System.Drawing.Point(80, 224);
			this.item.Name = "item";
			this.item.Size = new System.Drawing.Size(88, 24);
			this.item.TabIndex = 42;
			this.item.TabStop = true;
			this.item.Text = "采购单明细";
			// 
			// list
			// 
			this.list.Location = new System.Drawing.Point(8, 224);
			this.list.Name = "list";
			this.list.Size = new System.Drawing.Size(64, 24);
			this.list.TabIndex = 41;
			this.list.Text = "采购单";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(240, 224);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(64, 23);
			this.button2.TabIndex = 40;
			this.button2.Text = "查 询";
			this.button2.Click += new System.EventHandler(this.button2_Click_2);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.labd);
			this.groupBox1.Controls.Add(this.areaName);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.noTime);
			this.groupBox1.Controls.Add(this.pro);
			this.groupBox1.Controls.Add(this.jh);
			this.groupBox1.Controls.Add(this.jy);
			this.groupBox1.Controls.Add(this.djhm);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.offer);
			this.groupBox1.Controls.Add(this.endDate);
			this.groupBox1.Controls.Add(this.executeEr);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.startDate);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(360, 208);
			this.groupBox1.TabIndex = 39;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "查询条件";
			// 
			// pro
			// 
			this.pro.Location = new System.Drawing.Point(104, 96);
			this.pro.Name = "pro";
			this.pro.Size = new System.Drawing.Size(248, 20);
			this.pro.TabIndex = 35;
			// 
			// jh
			// 
			this.jh.Location = new System.Drawing.Point(184, 72);
			this.jh.Name = "jh";
			this.jh.Size = new System.Drawing.Size(72, 24);
			this.jh.TabIndex = 34;
			this.jh.Text = "交货时间";
			// 
			// jy
			// 
			this.jy.Location = new System.Drawing.Point(104, 72);
			this.jy.Name = "jy";
			this.jy.Size = new System.Drawing.Size(72, 24);
			this.jy.TabIndex = 33;
			this.jy.Text = "签约时间";
			this.jy.CheckedChanged += new System.EventHandler(this.jy_CheckedChanged);
			// 
			// djhm
			// 
			this.djhm.Location = new System.Drawing.Point(104, 144);
			this.djhm.Name = "djhm";
			this.djhm.Size = new System.Drawing.Size(128, 21);
			this.djhm.TabIndex = 32;
			this.djhm.Text = "";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(16, 152);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(72, 16);
			this.label7.TabIndex = 29;
			this.label7.Text = "单据号码";
			// 
			// offer
			// 
			this.offer.Location = new System.Drawing.Point(104, 24);
			this.offer.Name = "offer";
			this.offer.Size = new System.Drawing.Size(248, 20);
			this.offer.TabIndex = 27;
			// 
			// endDate
			// 
			this.endDate.Location = new System.Drawing.Point(240, 48);
			this.endDate.Name = "endDate";
			this.endDate.Size = new System.Drawing.Size(112, 21);
			this.endDate.TabIndex = 24;
			// 
			// executeEr
			// 
			this.executeEr.Location = new System.Drawing.Point(104, 120);
			this.executeEr.Name = "executeEr";
			this.executeEr.Size = new System.Drawing.Size(128, 21);
			this.executeEr.TabIndex = 23;
			this.executeEr.Text = "";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(16, 128);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(72, 16);
			this.label6.TabIndex = 22;
			this.label6.Text = "经 办 人";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 104);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 16);
			this.label4.TabIndex = 18;
			this.label4.Text = "产品名称/目录";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(224, 56);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(8, 16);
			this.label3.TabIndex = 16;
			this.label3.Text = "-";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(16, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(56, 16);
			this.label2.TabIndex = 14;
			this.label2.Text = "时 间 段";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(56, 16);
			this.label1.TabIndex = 12;
			this.label1.Text = "供 货 商";
			// 
			// startDate
			// 
			this.startDate.Location = new System.Drawing.Point(104, 48);
			this.startDate.Name = "startDate";
			this.startDate.Size = new System.Drawing.Size(112, 21);
			this.startDate.TabIndex = 3;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(304, 224);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(64, 23);
			this.button1.TabIndex = 38;
			this.button1.Text = "取 消";
			this.button1.Click += new System.EventHandler(this.button1_Click_2);
			// 
			// noTime
			// 
			this.noTime.Location = new System.Drawing.Point(264, 72);
			this.noTime.Name = "noTime";
			this.noTime.Size = new System.Drawing.Size(72, 24);
			this.noTime.TabIndex = 36;
			this.noTime.Text = "不限时间";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(16, 176);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(72, 16);
			this.label5.TabIndex = 37;
			this.label5.Text = "所在地区";
			// 
			// areaName
			// 
			this.areaName.Location = new System.Drawing.Point(104, 168);
			this.areaName.Name = "areaName";
			this.areaName.Size = new System.Drawing.Size(128, 21);
			this.areaName.TabIndex = 38;
			this.areaName.Text = "";
			// 
			// labd
			// 
			this.labd.Location = new System.Drawing.Point(240, 176);
			this.labd.Name = "labd";
			this.labd.Size = new System.Drawing.Size(104, 16);
			this.labd.TabIndex = 39;
			this.labd.Text = "地区编号或名称";
			// 
			// SearchForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(378, 263);
			this.Controls.Add(this.item);
			this.Controls.Add(this.list);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.button1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "SearchForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "查询采购数据";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 关闭
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button1_Click(object sender, System.EventArgs e) {
			this.Close();
		}

		/// <summary>
		/// 开始调出查询结果
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button2_Click(object sender, System.EventArgs e) {

			StockList result = new StockList();

			//设置查询条件
			if(this.offer.Text.Trim() != "" && Public.CheckCorpNameInput(this.offer.Text.Trim(),this.offer)){
				result.corpSign  = Public.CutCorString(this.offer.Text,1);
				result.corpName  = Public.CutCorString(this.offer.Text,0);
			}else{
				result.corpName = this.offer.Text.Trim();
			}

			result.startDate = this.startDate.Text.Replace("年","-").Replace("月","-").Replace("日","");
			result.endDate   = this.endDate.Text.Replace("年","-").Replace("月","-").Replace("日","");

			if(this.pro.Text.Trim() != "" && Public.CheckCorpNameInput(this.pro.Text.Trim(),this.pro)){
				result.proSign   = Public.CutProString(this.pro.Text,1);
				result.proName   = Public.CutProString(this.pro.Text,0).Replace("|-","").Trim();
			}else{
				result.proName = this.pro.Text.Trim();
			}

			result.executeEr = this.executeEr.Text;
			result.djhm      = this.djhm.Text;

			if(this.jy.Checked)      result.timeType = "JY";
			else if(this.jh.Checked) result.timeType = "JH";
			else                     result.timeType = "NO";

			if(this.list.Checked) result.viewType = "LIST";
			else                  result.viewType = "ITEM";

			result.areaName = this.areaName.Text.Trim();

			result.ListInit();

			result.MdiParent = Public.mainForm;
			result.Show();
			this.Close();
		}

		private void button1_Click_1(object sender, System.EventArgs e) {
			this.Close();
		}

		private void button2_Click_1(object sender, System.EventArgs e) {
			StockList result = new StockList();
			result.MdiParent = Public.mainForm;
			result.Show();
			this.Close();
		}

		private void jy_CheckedChanged(object sender, System.EventArgs e) {
			//
		}

		private void button2_Click_2(object sender, System.EventArgs e) {
			button2_Click(sender,e);
		}

		private void button1_Click_2(object sender, System.EventArgs e) {
			this.Close();
		}

		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -