FrmShowWareHouseStatus.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using CasunCommon.BaseUI;
  2. using Pms.UserEvent.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PMSUI.UI.库位状态显示
  13. {
  14. public partial class FrmShowWareHouseStatus : CasunForm
  15. {
  16. public FrmShowWareHouseStatus()
  17. {
  18. InitializeComponent();
  19. }
  20. private void findData()
  21. {
  22. StringBuilder sb = new StringBuilder();
  23. sb.Append($" SELECT ");
  24. sb.Append($" * ");
  25. sb.Append($" from ");
  26. sb.Append($" UpStation");
  27. DataTable dt = ConDataBase.reDt(sb.ToString());
  28. if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
  29. {
  30. for (int i = 0; i < dt.Rows.Count; i++)
  31. {
  32. int StationSelect = int.Parse(dt.Rows[i]["StationSelect"].ToString());
  33. switch (StationSelect)
  34. {
  35. case 1:
  36. {
  37. string StationNum = dt.Rows[i]["StationNum"].ToString();
  38. int StationValue = int.Parse(dt.Rows[i]["StationValue"].ToString());
  39. switch (StationValue)
  40. {
  41. case 0:
  42. {
  43. btn_Up1.Text = StationNum;
  44. btn_Up1.BackColor = Color.Red;
  45. break;
  46. }
  47. case 1:
  48. {
  49. btn_Up1.Text = StationNum;
  50. btn_Up1.BackColor = Color.Green;
  51. break;
  52. }
  53. }
  54. break;
  55. }
  56. case 2:
  57. {
  58. string StationNum = dt.Rows[i]["StationNum"].ToString();
  59. int StationValue = int.Parse(dt.Rows[i]["StationValue"].ToString());
  60. switch (StationValue)
  61. {
  62. case 0:
  63. {
  64. btn_Up2.Text = StationNum;
  65. btn_Up2.BackColor = Color.Red;
  66. break;
  67. }
  68. case 1:
  69. {
  70. btn_Up2.Text = StationNum;
  71. btn_Up2.BackColor = Color.Green;
  72. break;
  73. }
  74. }
  75. break;
  76. }
  77. }
  78. }
  79. }
  80. }
  81. private void FrmShowWareHouseStatus_Load(object sender, EventArgs e)
  82. {
  83. findData();
  84. }
  85. private void btn_Up1_Click(object sender, EventArgs e)
  86. {
  87. EditWareHouseMsg sd = new EditWareHouseMsg();
  88. sd.StationNum = btn_Up1.Text.Trim();
  89. sd.ShowDialog();
  90. findData();
  91. }
  92. private void btn_Up2_Click(object sender, EventArgs e)
  93. {
  94. EditWareHouseMsg sd = new EditWareHouseMsg();
  95. sd.StationNum = btn_Up2.Text.Trim();
  96. sd.ShowDialog();
  97. findData();
  98. }
  99. private void FrmShowWareHouseStatus_Activated(object sender, EventArgs e)
  100. {
  101. findData();
  102. }
  103. private void button1_Click(object sender, EventArgs e)
  104. {
  105. findData();
  106. }
  107. }
  108. }