版博士V2.0程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

195 行
8.8 KiB

  1. using MaiMuAOI.SysCtrl;
  2. using Models;
  3. using Newtonsoft.Json;
  4. using SqlSugar;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. namespace MaiMuAOI.SysUI.DefectPicShow
  15. {
  16. public partial class AmendantRecordFrm : Form
  17. {
  18. Service.OrderService OrderService = new Service.OrderService();
  19. Order _order;
  20. List<OrderHistory> _OrderHistoryList = new List<OrderHistory>();
  21. public AmendantRecordFrm(Order order)
  22. {
  23. InitializeComponent();
  24. UIStyle.SetUIStyle(this);
  25. this.uiTitel1.FatherForm = this;
  26. _order = order;
  27. _OrderHistoryList = _order.OrderHistoryList;
  28. this.BackColor = Color.White;
  29. }
  30. private void AmendantRecordFrm_Load(object sender, EventArgs e)
  31. {
  32. if(_order.CompareResult == 2)
  33. radioButton3.Checked = true;
  34. else if (_order.CompareResult == 1)
  35. radioButton2.Checked = true;
  36. else
  37. radioButton1.Checked = true;
  38. numericUpDown1.Value = (decimal)_order.TensionValue;
  39. numericUpDown2.Value = (decimal)_order.HeightValue;
  40. numericUpDown3.Value = (decimal)_order.PTValue;
  41. numericUpDown4.Value = (decimal)_order.LineWidthValue;
  42. numericUpDown5.Value = 0;
  43. numericUpDown6.Value = (decimal)_order.XPTValue;
  44. numericUpDown7.Value = 0;
  45. numericUpDown8.Value = 0;
  46. numericUpDown9.Value = 0;
  47. numericUpDown10.Value = 0;
  48. numericUpDown11.Value = 0;
  49. numericUpDown12.Value = (decimal)_order.DKCount;
  50. numericUpDown13.Value = (decimal)_order.ZWCount;
  51. numericUpDown14.Value = (decimal)_order.GSYCCount;
  52. numericUpDown15.Value = (decimal)_order.XWSCount;
  53. numericUpDown16.Value = (decimal)_order.QKCount;
  54. numericUpDown17.Value = (decimal)_order.ZKCount;
  55. numericUpDown18.Value = (decimal)_order.PPCount;
  56. numericUpDown19.Value = (decimal)_order.HSCount;
  57. numericUpDown20.Value = (decimal)_order.YXCount;
  58. numericUpDown21.Value = (decimal)_order.XBCount;
  59. numericUpDown22.Value = (decimal)_order.SXCount;
  60. }
  61. #region 取消
  62. private void skinButton3_Click(object sender, EventArgs e)
  63. {
  64. this.Close();
  65. }
  66. #endregion
  67. #region 保存
  68. private bool IsModify()
  69. {
  70. bool ret = true;
  71. if ((_order.CompareResult == 2) && (radioButton3.Checked))
  72. ret = ret & true;
  73. else if ((_order.CompareResult == 1) && (radioButton2.Checked))
  74. ret = ret & true;
  75. else if ((_order.CompareResult == 0) && (radioButton1.Checked))
  76. ret = ret & true;
  77. else
  78. ret = ret & false;
  79. ret = ret & (_order.TensionValue == (double)numericUpDown1.Value);
  80. ret = ret & (_order.HeightValue == (double)numericUpDown2.Value);
  81. ret = ret & (_order.PTValue == (double)numericUpDown3.Value);
  82. ret = ret & (_order.LineWidthValue == (double)numericUpDown4.Value);
  83. ret = ret & (_order.XPTValue == (double)numericUpDown6.Value);
  84. ret = ret & (_order.DKCount == (int)numericUpDown12.Value);
  85. ret = ret & (_order.ZWCount == (int)numericUpDown13.Value);
  86. ret = ret & (_order.GSYCCount == (int)numericUpDown14.Value);
  87. ret = ret & (_order.XWSCount == (int)numericUpDown15.Value);
  88. ret = ret & (_order.QKCount == (int)numericUpDown16.Value);
  89. ret = ret & (_order.ZKCount == (int)numericUpDown17.Value);
  90. ret = ret & (_order.PPCount == (int)numericUpDown18.Value);
  91. ret = ret & (_order.HSCount == (int)numericUpDown19.Value);
  92. ret = ret & (_order.YXCount == (int)numericUpDown20.Value);
  93. ret = ret & (_order.XBCount == (int)numericUpDown21.Value);
  94. ret = ret & (_order.SXCount == (int)numericUpDown22.Value);
  95. return !ret;
  96. }
  97. private void skinButton1_Click(object sender, EventArgs e)
  98. {
  99. if (IsModify())
  100. {
  101. if(_OrderHistoryList == null)
  102. _OrderHistoryList = new List<OrderHistory>();
  103. _OrderHistoryList.Add(new OrderHistory()
  104. {
  105. TensionValue = _order.TensionValue,
  106. HeightValue = _order.HeightValue,
  107. PTValue = _order.PTValue,
  108. LineWidthValue = _order.LineWidthValue,
  109. XPTValue = _order.XPTValue,
  110. CompareResult = _order.CompareResult,
  111. Qualified = _order.Qualified,
  112. DKCount = _order.DKCount,
  113. ZWCount = _order.ZWCount,
  114. GSYCCount = _order.GSYCCount,
  115. XWSCount = _order.XWSCount,
  116. QKCount = _order.QKCount,
  117. ZKCount = _order.ZKCount,
  118. PPCount = _order.PPCount,
  119. HSCount = _order.HSCount,
  120. XBCount = _order.XBCount,
  121. YXCount = _order.YXCount,
  122. SXCount = _order.SXCount,
  123. CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code,
  124. ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code
  125. });
  126. _order.HistoryCount++;
  127. _order.CompareResult = radioButton3.Checked ? 2 : radioButton2.Checked ? 1 : 0;
  128. _order.TensionValue = (double)numericUpDown1.Value;
  129. _order.HeightValue = (double)numericUpDown2.Value;
  130. _order.PTValue = (double)numericUpDown3.Value;
  131. _order.LineWidthValue = (double)numericUpDown4.Value;
  132. _order.XPTValue = (double)numericUpDown6.Value;
  133. _order.DKCount = (int)numericUpDown12.Value;
  134. _order.ZWCount = (int)numericUpDown13.Value;
  135. _order.GSYCCount = (int)numericUpDown14.Value;
  136. _order.XWSCount = (int)numericUpDown15.Value;
  137. _order.QKCount = (int)numericUpDown16.Value;
  138. _order.ZKCount = (int)numericUpDown17.Value;
  139. _order.PPCount = (int)numericUpDown18.Value;
  140. _order.HSCount = (int)numericUpDown19.Value;
  141. _order.YXCount = (int)numericUpDown20.Value;
  142. _order.XBCount = (int)numericUpDown21.Value;
  143. _order.SXCount = (int)numericUpDown22.Value;
  144. _order.OrderHistoryList = _OrderHistoryList;
  145. _order.ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code;
  146. bool qua = true;
  147. qua = qua & (_order.CompareResult == 1);
  148. if ((_order.ProductInfo.TensionDownFloatValue + _order.ProductInfo.TensionUpFloatValue) > 0)
  149. qua = qua & (((_order.ProductInfo.TensionDownFloatValue + _order.ProductInfo.TensionBaseValue) < _order.TensionValue) &&
  150. ((_order.ProductInfo.TensionUpFloatValue + _order.ProductInfo.TensionBaseValue) > _order.TensionValue));
  151. if ((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightUpFloatValue) > 0)
  152. qua = qua & (((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightBaseValue) < _order.HeightValue) &&
  153. ((_order.ProductInfo.HeightUpFloatValue + _order.ProductInfo.HeightBaseValue) > _order.HeightValue));
  154. if ((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTUpFloatValue) > 0)
  155. qua = qua & (((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTBaseValue) < _order.PTValue) &&
  156. ((_order.ProductInfo.PTUpFloatValue + _order.ProductInfo.PTBaseValue) > _order.PTValue));
  157. if ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXDownFloatValue) > 0)
  158. qua = qua & (((_order.ProductInfo.PTXDownFloatValue + _order.ProductInfo.PTXBaseValue) < _order.XPTValue) &&
  159. ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXBaseValue) > _order.XPTValue));
  160. _order.Qualified = qua;
  161. bool result = OrderService.UpdateableListEx(_order);
  162. if (result)
  163. MessageBox.Show("修改成功", "完成");
  164. else
  165. MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
  166. }
  167. }
  168. #endregion
  169. }
  170. }