Warehouse_NewPiInOut.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. try { UAS_MES_NEW.I18n.LanguageManager.Localize(this); } catch { }
  46. }
  47. private void Confirm_Click(object sender, EventArgs e)
  48. {
  49. generate = false;
  50. if (pi_inoutno.Text == "")
  51. {
  52. if (autogener.Checked)
  53. {
  54. string _macode = "";
  55. string[] param = new string[] { caller, "2", _macode };
  56. dh.CallProcedure("SP_GETMAXNUMBER", ref param);
  57. pi_inoutno.Text = param[2];
  58. }
  59. else {
  60. MessageBox.Show(UAS_MES_NEW.I18n.LanguageManager.T("出货单号") + pi_inoutno.Text + UAS_MES_NEW.I18n.LanguageManager.T("未填"));
  61. return;
  62. }
  63. }
  64. if (int.Parse(dh.getFieldDataByCondition("prodinout", "count(1)cn", "pi_inoutno='" + pi_inoutno.Text + "'").ToString()) > 0)
  65. {
  66. MessageBox.Show(UAS_MES_NEW.I18n.LanguageManager.T("出货单号") + pi_inoutno.Text + UAS_MES_NEW.I18n.LanguageManager.T("重复"));
  67. return;
  68. }
  69. if (cu_code.Text == "" || cu_name.Text == "")
  70. {
  71. MessageBox.Show(UAS_MES_NEW.I18n.LanguageManager.T("客户编号未填"));
  72. return;
  73. }
  74. sql.Clear();
  75. sql.Append("insert into prodinout (pi_id,pi_class,pi_inoutno,pi_pdastatus,pi_type,pi_cardcode,pi_title,pi_recordman,");
  76. sql.Append("pi_recordcode,pi_recorddate,pi_remark)values(prodinout_seq.nextval,'出货单','" + pi_inoutno.Text + "','未备货',");
  77. sql.Append("'自由出货','" + cu_code.Text + "','" + cu_name.Text + "','" + User.UserName + "',");
  78. sql.Append("'" + User.UserCode + "',sysdate,'" + note.Text + "')");
  79. dh.ExecuteSql(sql.GetString(), "insert");
  80. MessageBox.Show(UAS_MES_NEW.I18n.LanguageManager.T("添加出货单成功"));
  81. generate = true;
  82. }
  83. private void Warehouse_NewPiInOut_Load(object sender, EventArgs e)
  84. {
  85. dh = SystemInf.dh;
  86. caller = "ProdInOut";
  87. cu_code.TableName = "customer";
  88. cu_code.DBTitle = "出货单查询";
  89. cu_code.SelectField = "cu_code # 编号,cu_name # 名称";
  90. cu_code.SetValueField = new string[] { "cu_code", "cu_name" };
  91. cu_code.FormName = Name;
  92. cu_code.DbChange += Cu_code_DbChange;
  93. generate = false;
  94. }
  95. private void Cu_code_DbChange(object sender, EventArgs e)
  96. {
  97. dbfind = cu_code.ReturnData;
  98. BaseUtil.SetFormValue(this.Controls, dbfind);
  99. }
  100. private void pi_inoutno_TextChanged(object sender, EventArgs e)
  101. {
  102. pi_inoutno1 = pi_inoutno.Text;
  103. }
  104. private void headBar1_MouseDown(object sender, MouseEventArgs e)
  105. {
  106. ReleaseCapture();
  107. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  108. }
  109. }
  110. }