Special_AfterSaleIn.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  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.Special
  9. {
  10. public partial class Special_AfterSaleIn : Form
  11. {
  12. DataHelper dh = SystemInf.dh;
  13. LogStringBuilder sql = new LogStringBuilder();
  14. AutoSizeFormClass asc = new AutoSizeFormClass();
  15. public Special_AfterSaleIn()
  16. {
  17. InitializeComponent();
  18. try { UAS_MES_NEW.I18n.LanguageManager.Localize(this); } catch { }
  19. }
  20. private void Special_CancelProdinout_Load(object sender, EventArgs e)
  21. {
  22. //cu_code.TableName = "customer";
  23. //cu_code.DBTitle = "出货单查询";
  24. //cu_code.SelectField = "cu_id # ID,cu_code # 客户编号,cu_name # 客户名城";
  25. //cu_code.SetValueField = new string[] { "cu_code", "cu_name" };
  26. //cu_code.FormName = Name;
  27. pr_code.TableName = "product";
  28. pr_code.DBTitle = "出货单查询";
  29. pr_code.SelectField = "pr_code # 物料编号,pr_detail # 物料名称,pr_spec # 物料规格";
  30. pr_code.SetValueField = new string[] { "pr_code", "pr_detail", "pr_spec" };
  31. pr_code.FormName = Name;
  32. InDate.Value = DateTime.Now;
  33. asc.controllInitializeSize(this);
  34. }
  35. private void Confirm_Click(object sender, EventArgs e)
  36. {
  37. //正常录入资料的时候
  38. if (barcode.Text == "")
  39. {
  40. OperateResult.AppendText(">>输入信息不允许为空\n", Color.Red, barcode);
  41. return;
  42. }
  43. string oMSID = "";
  44. string oMakecode = "";
  45. string Err = "";
  46. DataTable dt = (DataTable)dh.ExecuteSql("select ma_custname,ma_prodcode,pr_spec,ma_softversion from makeserial_view left join make_view on ms_makecode=ma_code left join product on ms_prodcode=pr_code where ms_sncode='" + barcode.Text + "'", "select");
  47. if (dt.Rows.Count > 0)
  48. {
  49. cu_code.Text = dt.Rows[0]["ma_custname"].ToString();
  50. pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
  51. ma_softversion.Text = dt.Rows[0]["ma_softversion"].ToString();
  52. pr_spec.Text = dt.Rows[0]["pr_spec"].ToString();
  53. }
  54. if (cu_code.Text == "" || pr_code.Text == "")
  55. {
  56. OperateResult.AppendText(">>客户编号和物料编号不能为空\n", Color.Red, barcode);
  57. return;
  58. }
  59. if (LogicHandler.CheckStepSNAndMacode("MD22020001", "ZBRK", barcode.Text, User.UserCode, out oMakecode, out oMSID, out Err))
  60. {
  61. dh.ExecuteSql("update makeserial set ms_custname='" + cu_code.Text + "',ms_prodcode1='" + pr_code.Text + "',ms_softversion='" + ma_softversion.Text + "' where ms_id=" + oMSID, "update");
  62. LoadGridData();
  63. if (dh.getFieldDataByCondition("makeserial", "ms_stepcode", "ms_id=" + oMSID).ToString() == User.CurrentStepCode)
  64. {
  65. OperateResult.AppendText(">>条码已经执行过" + User.CurrentStepName + "\n", Color.Red, barcode);
  66. return;
  67. }
  68. if (LogicHandler.SetStepResult("MD22020001", "ZBRK", barcode.Text, "", "OK", User.UserCode, out Err))
  69. {
  70. OperateResult.AppendText(">>条码" + barcode.Text + "录入成功\n", Color.Green, barcode);
  71. }
  72. else
  73. {
  74. OperateResult.AppendText(">>" + Err + "\n", Color.Red, barcode);
  75. }
  76. }
  77. else
  78. {
  79. OperateResult.AppendText(">>" + Err + "\n", Color.Red, barcode);
  80. }
  81. }
  82. private void Clean_Click(object sender, EventArgs e)
  83. {
  84. OperateResult.Clear();
  85. }
  86. private void LoadGridData()
  87. {
  88. sql.Clear();
  89. sql.Append("select * from makeserial where trunc(ms_indate)=trunc(to_date('" + InDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "','yyyy-mm-dd hh24:mi:ss')) ");
  90. if (cu_code.Text != "")
  91. {
  92. sql.Append(" and ms_custname='" + cu_code.Text + "'");
  93. }
  94. if (pr_code.Text != "")
  95. {
  96. sql.Append(" and ms_prodcode1='" + pr_code.Text + "'");
  97. }
  98. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  99. BaseUtil.FillDgvWithDataTable(Info, dt);
  100. }
  101. private void Special_AfterSaleIn_SizeChanged(object sender, EventArgs e)
  102. {
  103. asc.controlAutoSize(this);
  104. }
  105. private void barcode_KeyDown(object sender, KeyEventArgs e)
  106. {
  107. if (e.KeyCode == Keys.Enter)
  108. {
  109. Confirm.PerformClick();
  110. }
  111. }
  112. private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
  113. {
  114. LoadGridData();
  115. }
  116. private void cu_code_UserControlTextChanged(object sender, EventArgs e)
  117. {
  118. LoadGridData();
  119. }
  120. private void pr_code_UserControlTextChanged(object sender, EventArgs e)
  121. {
  122. LoadGridData();
  123. }
  124. }
  125. }