贴标角度设置.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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_LabelMachine.Entity;
  10. using UAS_LabelMachine.PublicMethod;
  11. namespace UAS_LabelMachine
  12. {
  13. public partial class 贴标角度设置 : Form
  14. {
  15. DataHelper dh = SystemInf.dh;
  16. string custcode;
  17. public 贴标角度设置(string CustCode)
  18. {
  19. custcode = CustCode;
  20. InitializeComponent();
  21. }
  22. bool IninLoad = true;
  23. private void 附件内容打印_Load(object sender, EventArgs e)
  24. {
  25. Machine.Text = SystemInf.Machine;
  26. DataTable dt = (DataTable)dh.ExecuteSql("select * from PRINTXY where px_custcode='" + custcode + "' and px_machine='" + SystemInf.Machine + "'", "select");
  27. if (dt.Rows.Count == 0)
  28. {
  29. dt = (DataTable)dh.ExecuteSql("select * from PRINTXY where px_custcode='" + custcode + "'", "select");
  30. }
  31. if (dt.Rows.Count > 0)
  32. {
  33. X.Text = dt.Rows[0]["px_x"].ToString();
  34. Y.Text = dt.Rows[0]["px_y"].ToString();
  35. angle.Text = dt.Rows[0]["px_angle"].ToString();
  36. switch (dt.Rows[0]["px_type"].ToString().ToUpper())
  37. {
  38. case "TOP":
  39. Top.Checked = true;
  40. break;
  41. case "COVER":
  42. Cover.Checked = true;
  43. break;
  44. case "LEFT":
  45. Left.Checked = true;
  46. break;
  47. case "RIGHT":
  48. Right.Checked = true;
  49. break;
  50. case "BOTTOM":
  51. Bottom.Checked = true;
  52. break;
  53. default:
  54. break;
  55. }
  56. }
  57. IninLoad = false;
  58. }
  59. private void Confirm_Click(object sender, EventArgs e)
  60. {
  61. string Type = "";
  62. if (Bottom.Checked)
  63. {
  64. Type = "Bottom";
  65. }
  66. if (Top.Checked)
  67. {
  68. Type = "Top";
  69. }
  70. if (Left.Checked)
  71. {
  72. Type = "Left";
  73. }
  74. if (Right.Checked)
  75. {
  76. Type = "Right";
  77. }
  78. if (Cover.Checked)
  79. {
  80. Type = "Cover";
  81. }
  82. if (angle.Text == "" || X.Text == "" || Y.Text == "")
  83. {
  84. MessageBox.Show("参数必须都填写");
  85. return;
  86. }
  87. if (dh.CheckExist("PRINTXY", "px_custcode='" + custcode + "' and px_machine='" + SystemInf.Machine + "'"))
  88. {
  89. dh.ExecuteSql("update PRINTXY set px_x='" + X.Text + "',px_y='" + Y.Text + "',px_angle='" + angle.Text + "',px_type='" + Type + "',px_machine='" + Machine.Text + "' where px_custcode='" + custcode + "' and px_machine='" + Machine.Text + "'", "update");
  90. }
  91. else
  92. {
  93. dh.ExecuteSql("insert into PRINTXY (px_x,px_y,px_angle,px_custcode,px_type,px_machine)values('" + X.Text + "','" + Y.Text + "','" + angle.Text + "','" + custcode + "','" + Type + "','" + Machine.Text + "')", "insert");
  94. }
  95. LogManager.DoCommandLog(custcode, User.UserCode, "保持贴标角度成功", "成功");
  96. MessageBox.Show("保存成功");
  97. Close();
  98. }
  99. private void Button_CheckedChanged(object sender, EventArgs e)
  100. {
  101. if (!IninLoad)
  102. {
  103. RadioButton rad = (RadioButton)sender;
  104. switch (rad.Name.ToUpper())
  105. {
  106. case "TOP":
  107. angle.Text = "0";
  108. X.Text = "0";
  109. Y.Text = "0";
  110. break;
  111. case "COVER":
  112. angle.Text = "0";
  113. X.Text = "0";
  114. Y.Text = "0";
  115. break;
  116. case "LEFT":
  117. angle.Text = "270";
  118. X.Text = "0";
  119. Y.Text = "-88";
  120. break;
  121. case "RIGHT":
  122. angle.Text = "90";
  123. X.Text = "0";
  124. Y.Text = "-88";
  125. break;
  126. case "BOTTOM":
  127. angle.Text = "0";
  128. X.Text = "4";
  129. Y.Text = "-88";
  130. break;
  131. default:
  132. break;
  133. }
  134. }
  135. }
  136. }
  137. }