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 UAS_MES.DataOperate; using UAS_MES.Entity; using UAS_MES.PublicMethod; namespace UAS_MES.Warehouse { public partial class Warehouse_NewPiInOut : Form { DataTable dbfind; DataHelper dh; LogStringBuilder sql = new LogStringBuilder(); //页面Caller string caller; string pi_inoutno1; public string pi_inoutno_text { get { return pi_inoutno1; } set { pi_inoutno1 = value; } } public Warehouse_NewPiInOut() { InitializeComponent(); } private void Confirm_Click(object sender, EventArgs e) { if (pi_inoutno.Text == "") { MakeButton_Click(sender, e); } if (int.Parse(dh.getFieldDataByCondition("prodinout", "count(1)cn", "pi_inoutno='" + pi_inoutno.Text + "'").ToString()) > 0) { MessageBox.Show("出货单号" + pi_inoutno.Text + "重复"); return; } if (cu_code.Text == "" || cu_name.Text == "") { MessageBox.Show("客户编号未填"); return; } sql.Clear(); sql.Append("insert into prodinout (pi_id,pi_class,pi_inoutno,pi_pdastatus,pi_type,pi_cardcode,pi_title,pi_recordman,"); sql.Append("pi_recordcode,pi_recorddate,pi_remark)values(prodinout_seq.nextval,'出货单','" + pi_inoutno.Text + "','未备货',"); sql.Append("'自由出货','" + cu_code.Text + "','" + cu_name.Text + "','" + User.UserName + "',"); sql.Append("'" + User.UserCode + "',sysdate,'" + note.Text + "')"); dh.ExecuteSql(sql.GetString(), "insert"); MessageBox.Show("添加出货单成功"); } private void Warehouse_NewPiInOut_Load(object sender, EventArgs e) { dh = new DataHelper(); caller = "ProdInOut"; cu_code.TableName = "customer"; cu_code.DBTitle = "出货单查询"; cu_code.SelectField = "cu_code # 编号,cu_name # 名称"; cu_code.SetValueField = new string[] { "cu_code", "cu_name" }; cu_code.FormName = Name; cu_code.DbChange += Cu_code_DbChange; } private void Cu_code_DbChange(object sender, EventArgs e) { dbfind = cu_code.ReturnData; BaseUtil.SetFormValue(this.Controls, dbfind); } private void MakeButton_Click(object sender, EventArgs e) { string _macode = ""; string[] param = new string[] { caller, "2", _macode }; dh.CallProcedure("SP_GETMAXNUMBER", ref param); pi_inoutno.Text = param[2]; } private void pi_inoutno_TextChanged(object sender, EventArgs e) { pi_inoutno1 = pi_inoutno.Text; } } }