123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Runtime.InteropServices;
- 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 : CustomControl.BaseForm.BaseForm
- {
- [DllImport("user32.dll")]
- public static extern bool ReleaseCapture();
- [DllImport("user32.dll")]
- public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
- public const int WM_SYSCOMMAND = 0x0112;
- public const int SC_MOVE = 0xF010;
- public const int HTCAPTION = 0x0002;
- 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 Boolean generate;
- public Warehouse_NewPiInOut()
- {
- InitializeComponent();
- }
- private void Confirm_Click(object sender, EventArgs e)
- {
- generate = false;
- if (pi_inoutno.Text == "")
- {
- if (autogener.Checked)
- {
- string _macode = "";
- string[] param = new string[] { caller, "2", _macode };
- dh.CallProcedure("SP_GETMAXNUMBER", ref param);
- pi_inoutno.Text = param[2];
- }
- else {
- MessageBox.Show("出货单号" + pi_inoutno.Text + "未填");
- return;
- }
- }
- 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("添加出货单成功");
- generate = true;
- }
- private void Warehouse_NewPiInOut_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- 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;
- generate = false;
- }
- private void Cu_code_DbChange(object sender, EventArgs e)
- {
- dbfind = cu_code.ReturnData;
- BaseUtil.SetFormValue(this.Controls, dbfind);
- }
- private void pi_inoutno_TextChanged(object sender, EventArgs e)
- {
- pi_inoutno1 = pi_inoutno.Text;
- }
- private void headBar1_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
- }
- }
- }
|