Warehouse_NewPiInOut.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using System.Data;
  3. using System.Runtime.InteropServices;
  4. using System.Windows.Forms;
  5. using UAS_MES_NEW.DataOperate;
  6. using UAS_MES_NEW.Entity;
  7. using UAS_MES_NEW.PublicMethod;
  8. namespace UAS_MES_NEW.Warehouse
  9. {
  10. public partial class Warehouse_NewPiInOut : CustomControl.BaseForm.BaseForm
  11. {
  12. [DllImport("user32.dll")]
  13. public static extern bool ReleaseCapture();
  14. [DllImport("user32.dll")]
  15. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  16. public const int WM_SYSCOMMAND = 0x0112;
  17. public const int SC_MOVE = 0xF010;
  18. public const int HTCAPTION = 0x0002;
  19. DataTable dbfind;
  20. DataHelper dh;
  21. LogStringBuilder sql = new LogStringBuilder();
  22. //页面Caller
  23. string caller;
  24. string pi_inoutno1;
  25. public string pi_inoutno_text
  26. {
  27. get
  28. {
  29. return pi_inoutno1;
  30. }
  31. set
  32. {
  33. pi_inoutno1 = value;
  34. }
  35. }
  36. public Boolean generate;
  37. public Warehouse_NewPiInOut()
  38. {
  39. InitializeComponent();
  40. }
  41. private void Confirm_Click(object sender, EventArgs e)
  42. {
  43. generate = false;
  44. if (pi_inoutno.Text == "")
  45. {
  46. if (autogener.Checked)
  47. {
  48. string _macode = "";
  49. string[] param = new string[] { caller, "2", _macode };
  50. dh.CallProcedure("SP_GETMAXNUMBER", ref param);
  51. pi_inoutno.Text = param[2];
  52. }
  53. else
  54. {
  55. MessageBox.Show("出货单号" + pi_inoutno.Text + "未填");
  56. return;
  57. }
  58. }
  59. if (int.Parse(dh.getFieldDataByCondition("prodinout", "count(1)cn", "pi_inoutno='" + pi_inoutno.Text + "'").ToString()) > 0)
  60. {
  61. MessageBox.Show("出货单号" + pi_inoutno.Text + "重复");
  62. return;
  63. }
  64. if (cu_code.Text == "" || cu_name.Text == "")
  65. {
  66. MessageBox.Show("客户编号未填");
  67. return;
  68. }
  69. sql.Clear();
  70. sql.Append("insert into prodinout (pi_id,pi_class,pi_inoutno,pi_pdastatus,pi_type,pi_cardcode,pi_title,pi_recordman,");
  71. sql.Append("pi_recordcode,pi_recorddate,pi_remark)values(prodinout_seq.nextval,'出货单','" + pi_inoutno.Text + "','未备货',");
  72. sql.Append("'自由出货','" + cu_code.Text + "','" + cu_name.Text + "','" + User.UserName + "',");
  73. sql.Append("'" + User.UserCode + "',sysdate,'" + note.Text + "')");
  74. dh.ExecuteSql(sql.GetString(), "insert");
  75. MessageBox.Show("添加出货单成功");
  76. generate = true;
  77. }
  78. private void Warehouse_NewPiInOut_Load(object sender, EventArgs e)
  79. {
  80. dh = SystemInf.dh;
  81. caller = "ProdInOut";
  82. cu_code.TableName = "customer";
  83. cu_code.DBTitle = "出货单查询";
  84. cu_code.SelectField = "cu_code # 编号,cu_name # 名称";
  85. cu_code.SetValueField = new string[] { "cu_code", "cu_name" };
  86. cu_code.FormName = Name;
  87. cu_code.DbChange += Cu_code_DbChange;
  88. generate = false;
  89. }
  90. private void Cu_code_DbChange(object sender, EventArgs e)
  91. {
  92. dbfind = cu_code.ReturnData;
  93. BaseUtil.SetFormValue(this.Controls, dbfind);
  94. }
  95. private void pi_inoutno_TextChanged(object sender, EventArgs e)
  96. {
  97. pi_inoutno1 = pi_inoutno.Text;
  98. }
  99. private void headBar1_MouseDown(object sender, MouseEventArgs e)
  100. {
  101. ReleaseCapture();
  102. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  103. }
  104. }
  105. }