Warehouse_NewPiInOut.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES.DataOperate;
  10. using UAS_MES.Entity;
  11. using UAS_MES.PublicMethod;
  12. namespace UAS_MES.Warehouse
  13. {
  14. public partial class Warehouse_NewPiInOut : Form
  15. {
  16. DataTable dbfind;
  17. DataHelper dh;
  18. LogStringBuilder sql = new LogStringBuilder();
  19. //页面Caller
  20. string caller;
  21. string pi_inoutno1;
  22. public string pi_inoutno_text
  23. {
  24. get
  25. {
  26. return pi_inoutno1;
  27. }
  28. set
  29. {
  30. pi_inoutno1 = value;
  31. }
  32. }
  33. public Warehouse_NewPiInOut()
  34. {
  35. InitializeComponent();
  36. }
  37. private void Confirm_Click(object sender, EventArgs e)
  38. {
  39. if (pi_inoutno.Text == "")
  40. {
  41. MakeButton_Click(sender, e);
  42. }
  43. if (int.Parse(dh.getFieldDataByCondition("prodinout", "count(1)cn", "pi_inoutno='" + pi_inoutno.Text + "'").ToString()) > 0)
  44. {
  45. MessageBox.Show("出货单号" + pi_inoutno.Text + "重复");
  46. return;
  47. }
  48. if (cu_code.Text == "" || cu_name.Text == "")
  49. {
  50. MessageBox.Show("客户编号未填");
  51. return;
  52. }
  53. sql.Clear();
  54. sql.Append("insert into prodinout (pi_id,pi_class,pi_inoutno,pi_pdastatus,pi_type,pi_cardcode,pi_title,pi_recordman,");
  55. sql.Append("pi_recordcode,pi_recorddate,pi_remark)values(prodinout_seq.nextval,'出货单','" + pi_inoutno.Text + "','未备货',");
  56. sql.Append("'自由出货','" + cu_code.Text + "','" + cu_name.Text + "','" + User.UserName + "',");
  57. sql.Append("'" + User.UserCode + "',sysdate,'" + note.Text + "')");
  58. dh.ExecuteSql(sql.GetString(), "insert");
  59. MessageBox.Show("添加出货单成功");
  60. }
  61. private void Warehouse_NewPiInOut_Load(object sender, EventArgs e)
  62. {
  63. dh = new DataHelper();
  64. caller = "ProdInOut";
  65. cu_code.TableName = "customer";
  66. cu_code.DBTitle = "出货单查询";
  67. cu_code.SelectField = "cu_code # 编号,cu_name # 名称";
  68. cu_code.SetValueField = new string[] { "cu_code", "cu_name" };
  69. cu_code.FormName = Name;
  70. cu_code.DbChange += Cu_code_DbChange;
  71. }
  72. private void Cu_code_DbChange(object sender, EventArgs e)
  73. {
  74. dbfind = cu_code.ReturnData;
  75. BaseUtil.SetFormValue(this.Controls, dbfind);
  76. }
  77. private void MakeButton_Click(object sender, EventArgs e)
  78. {
  79. string _macode = "";
  80. string[] param = new string[] { caller, "2", _macode };
  81. dh.CallProcedure("SP_GETMAXNUMBER", ref param);
  82. pi_inoutno.Text = param[2];
  83. }
  84. private void pi_inoutno_TextChanged(object sender, EventArgs e)
  85. {
  86. pi_inoutno1 = pi_inoutno.Text;
  87. }
  88. }
  89. }