Warehouse_NewPiInOut.cs 4.0 KB

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