| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.LZMes.Client.UIM
- {
- public partial class UIM010110 : FrmBase
- {
- private string COIL_NO = "";
- public UIM010110()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Save":
- this.DoSave();
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询钢卷信息
- /// </summary>
- private void DoQuery()
- {
- try
- {
- string coilNo = "R" + this.textBox1.Text.Trim() /*+ "-" */+ this.textBox2.Text.Trim() + "A" + this.textBox3.Text.Trim();
- this.dataSet1.Tables[0].Clear();
- COIL_NO = coilNo;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010110";
- ccp.MethodName = "queryCoilInfo";
- ccp.ServerParams = new object[] { coilNo };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- /// <summary>
- /// 盘入盘出操作
- /// </summary>
- private void DoSave()
- {
- try
- {
- if (this.dataTable1.Rows.Count < 1)
- {
- MessageBox.Show("钢卷信息不能为空,请先查询出钢卷信息再进行盘入盘出操作!");
- return;
- }
- Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
- rs = this.ultraGrid1.Rows;
- string wdlivno = "";
- foreach (UltraGridRow ugr in rs)
- {
- wdlivno = rs[0].Cells["wdlivno"].Text.ToString(); //获取提货单号
- }
- string curLoadLoc = this.textBox4.Text.Trim();
- int type = 0;
- if (checkBox2.Checked)
- {
- type = 1;
- }
- else if (checkBox3.Checked || checkBox4.Checked)
- {
- type = 2;//外卖或者废钢
- }
- else if(!checkBox1.Checked)
- {
- MessageBox.Show("请选择盘入盘出类型!");
- return;
- }
- else if ("".Equals(curLoadLoc))
- {
- MessageBox.Show("盘入操作需要垛位信息,请输入相应的垛位信息!");
- return;
- }
- if ("".Equals(wdlivno) && (checkBox3.Checked || checkBox4.Checked))
- {
- MessageBox.Show("外卖或者废钢提货单号不能为空!");
- return;
- }
- string coilInReg = this.UserInfo.GetUserID();
- string userOrder = this.UserInfo.GetUserOrder();
- string userGroup = this.UserInfo.GetUserGroup();
- string userTime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss") : "";
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010110";
- ccp.MethodName = "save";
- ccp.ServerParams = new object[] { type, COIL_NO, curLoadLoc, coilInReg, userOrder, userGroup, userTime, wdlivno };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- {
- this.checkBox3.Checked = false;
- this.checkBox2.Checked = false;
- this.checkBox4.Checked = false;
- }
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.checkBox2.Checked)
- {
- this.checkBox1.Checked = false;
- this.checkBox3.Checked = false;
- this.checkBox4.Checked = false;
- }
- }
- private void textBox4_MouseEnter(object sender, EventArgs e)
- {
- this.toolTip1.Show("盘入操作需要垛位信息,请输入相应的垛位信息", this.textBox4);
- }
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == (char)Keys.Enter)
- {
- textBox2.Focus();
- }
- if ((int)e.KeyChar == 3)
- {
- Clipboard.SetDataObject("R" + textBox1.Text.Trim() + "-" + textBox2.Text.Trim() + "A" + textBox3.Text.Trim(), true);
- }
- if ((int)e.KeyChar == 22)
- {
- // GetDataObject检索当前剪贴板上的数据
- IDataObject iData = Clipboard.GetDataObject();
- // 将数据与指定的格式进行匹配,返回bool
- if (iData.GetDataPresent(DataFormats.Text))
- {
- // GetData检索数据并指定一个格式
- string text = (string)iData.GetData(DataFormats.Text);
- if (text.Length >= 13)
- {
- textBox1.Text = text.Substring(1, 1);
- textBox2.Text = text.Substring(3, 6);
- textBox3.Text = text.Substring(10, 3);
- }
- }
- }
- e.Handled = (e.KeyChar == 3 || e.KeyChar == 22);
- }
- private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == (char)Keys.Enter)
- {
- textBox3.Focus();
- }
- }
- private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == (char)Keys.Enter)
- {
- this.DoQuery();
- }
- }
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- this.checkBox1.Checked = false;
- this.checkBox2.Checked = false;
- this.checkBox4.Checked = false;
- }
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.checkBox1.Checked = false;
- this.checkBox2.Checked = false;
- this.checkBox3.Checked = false;
- }
- }
- }
|