FrmAddPalletizing.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using DevComponents.DotNetBar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using WCS.Data.Models;
  12. using WCS_Client.UC;
  13. namespace WCS_Client.Frm
  14. {
  15. public partial class FrmAddPalletizing : Office2007Form
  16. {
  17. public FrmAddPalletizing()
  18. {
  19. InitializeComponent();
  20. }
  21. private void btnCancel_Click(object sender, EventArgs e)
  22. {
  23. this.Close();
  24. }
  25. private void btnAddP_Click(object sender, EventArgs e)
  26. {
  27. if (nudPalletizingNo.Value == 0)
  28. {
  29. MessageUtil.ShowError("码垛编号不能为空");
  30. return;
  31. }
  32. //else if (nudSonTrayNo.Value == 0)
  33. //{
  34. // MessageUtil.ShowError("子托盘编号不能为空");
  35. // return;
  36. //}
  37. else if (nudBoxNo.Value == 0)
  38. {
  39. MessageUtil.ShowError("箱子编号不能为空");
  40. return;
  41. }
  42. else if (string.IsNullOrWhiteSpace(txtBoxSize.Text))
  43. {
  44. MessageUtil.ShowError("箱子尺寸不能为空");
  45. return;
  46. }
  47. //else if (string.IsNullOrWhiteSpace(txtSonTraySize.Text))
  48. //{
  49. // MessageUtil.ShowError("子托盘尺寸不能为空");
  50. // return;
  51. //}
  52. var palletizingCode = new WCS_PalletizingCode();
  53. palletizingCode.PalletizingNo = Convert.ToInt32(nudPalletizingNo.Value);
  54. palletizingCode.PalletizingSonTrayNo = Convert.ToInt32(nudSonTrayNo.Value);
  55. palletizingCode.PalletizingSonTrayCode = txtSonTraycode.Text.Trim();
  56. palletizingCode.PalletizingSonTraySize = txtSonTraySize.Text.Trim();
  57. palletizingCode.PalletizingBoxNo = Convert.ToInt32(nudBoxNo.Value);
  58. palletizingCode.PalletizingBoxSize = txtBoxSize.Text.Trim();
  59. string result = TryCachHelper.TryExecute((db) =>
  60. {
  61. db.Insertable(palletizingCode).ExecuteCommand();
  62. });
  63. if (string.IsNullOrWhiteSpace(result))
  64. {
  65. result = string.Format("添加机械码垛信息成功");
  66. }
  67. MessageUtil.ShowTips(result);
  68. }
  69. }
  70. }