版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

292 lines
17 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.FLineWidthValue;
  42. numericUpDown5.Value = (decimal)_order.TensionValue;
  43. numericUpDown6.Value = (decimal)_order.XPTValue;
  44. numericUpDown7.Value = (decimal)_order.MGridIntervalValue;
  45. numericUpDown8.Value = (decimal)_order.MGridWidthValue;
  46. numericUpDown9.Value = (decimal)_order.MGridSpreadValue;
  47. numericUpDown10.Value = (decimal)_order.FGridSpreadValue;
  48. numericUpDown11.Value = (decimal)_order.BackPoleWidthValue;
  49. numericUpDown27.Value = (decimal)_order.MGridLengthValue;
  50. numericUpDown30.Value = (decimal)_order.MarkXDisValue;
  51. numericUpDown29.Value = (decimal)_order.MarkYDisValue;
  52. numericUpDown28.Value = (decimal)_order.ForkLengthValue;
  53. numericUpDown24.Value = (decimal)_order.ForkWidthValue;
  54. numericUpDown26.Value = (decimal)_order.ForkDisValue;
  55. numericUpDown12.Value = (decimal)_order.DKCount;
  56. numericUpDown13.Value = (decimal)_order.ZWCount;
  57. numericUpDown14.Value = (decimal)_order.GSYCCount;
  58. numericUpDown15.Value = (decimal)_order.XWSCount;
  59. numericUpDown16.Value = (decimal)_order.QKCount;
  60. numericUpDown17.Value = (decimal)_order.ZKCount;
  61. numericUpDown18.Value = (decimal)_order.PPCount;
  62. numericUpDown19.Value = (decimal)_order.HSCount;
  63. numericUpDown20.Value = (decimal)_order.YXCount;
  64. numericUpDown21.Value = (decimal)_order.XBCount;
  65. numericUpDown22.Value = (decimal)_order.SXCount;
  66. }
  67. #region 取消
  68. private void skinButton3_Click(object sender, EventArgs e)
  69. {
  70. this.Close();
  71. }
  72. #endregion
  73. #region 保存
  74. private bool IsModify()
  75. {
  76. bool ret = true;
  77. if ((_order.CompareResult == 2) && (radioButton3.Checked))
  78. ret = ret & true;
  79. else if ((_order.CompareResult == 1) && (radioButton2.Checked))
  80. ret = ret & true;
  81. else if ((_order.CompareResult == 0) && (radioButton1.Checked))
  82. ret = ret & true;
  83. else
  84. ret = ret & false;
  85. ret = ret & (_order.TensionValue == (double)numericUpDown1.Value);
  86. ret = ret & (_order.HeightValue == (double)numericUpDown2.Value);
  87. ret = ret & (_order.PTValue == (double)numericUpDown3.Value);
  88. ret = ret & (_order.LineWidthValue == (double)numericUpDown4.Value);
  89. ret = ret & (_order.FLineWidthValue == (double)numericUpDown5.Value);
  90. ret = ret & (_order.XPTValue == (double)numericUpDown6.Value);
  91. ret = ret & (_order.MGridIntervalValue == (double)numericUpDown7.Value);
  92. ret = ret & (_order.MGridWidthValue == (double)numericUpDown8.Value);
  93. ret = ret & (_order.MGridSpreadValue == (double)numericUpDown9.Value);
  94. ret = ret & (_order.FGridSpreadValue == (double)numericUpDown10.Value);
  95. ret = ret & (_order.BackPoleWidthValue == (double)numericUpDown11.Value);
  96. ret = ret & (_order.MGridLengthValue == (double)numericUpDown27.Value);
  97. ret = ret & (_order.MarkXDisValue == (double)numericUpDown30.Value);
  98. ret = ret & (_order.MarkYDisValue == (double)numericUpDown29.Value);
  99. ret = ret & (_order.ForkLengthValue == (double)numericUpDown28.Value);
  100. ret = ret & (_order.ForkWidthValue == (double)numericUpDown24.Value);
  101. ret = ret & (_order.ForkDisValue == (double)numericUpDown26.Value);
  102. ret = ret & (_order.DKCount == (int)numericUpDown12.Value);
  103. ret = ret & (_order.ZWCount == (int)numericUpDown13.Value);
  104. ret = ret & (_order.GSYCCount == (int)numericUpDown14.Value);
  105. ret = ret & (_order.XWSCount == (int)numericUpDown15.Value);
  106. ret = ret & (_order.QKCount == (int)numericUpDown16.Value);
  107. ret = ret & (_order.ZKCount == (int)numericUpDown17.Value);
  108. ret = ret & (_order.PPCount == (int)numericUpDown18.Value);
  109. ret = ret & (_order.HSCount == (int)numericUpDown19.Value);
  110. ret = ret & (_order.YXCount == (int)numericUpDown20.Value);
  111. ret = ret & (_order.XBCount == (int)numericUpDown21.Value);
  112. ret = ret & (_order.SXCount == (int)numericUpDown22.Value);
  113. return !ret;
  114. }
  115. private void skinButton1_Click(object sender, EventArgs e)
  116. {
  117. if (IsModify())
  118. {
  119. if(_OrderHistoryList == null)
  120. _OrderHistoryList = new List<OrderHistory>();
  121. _OrderHistoryList.Add(new OrderHistory()
  122. {
  123. TensionValue = _order.TensionValue,
  124. HeightValue = _order.HeightValue,
  125. PTValue = _order.PTValue,
  126. LineWidthValue = _order.LineWidthValue,
  127. FLineWidthValue = _order.FLineWidthValue,
  128. XPTValue = _order.XPTValue,
  129. MGridIntervalValue = _order.MGridIntervalValue,
  130. MGridWidthValue = _order.MGridWidthValue,
  131. MGridSpreadValue = _order.MGridSpreadValue,
  132. FGridSpreadValue = _order.FGridSpreadValue,
  133. BackPoleWidthValue = _order.BackPoleWidthValue,
  134. MGridLengthValue = _order.MGridLengthValue,
  135. MarkXDisValue = _order.MarkXDisValue,
  136. MarkYDisValue = _order.MarkYDisValue,
  137. ForkDisValue = _order.ForkDisValue,
  138. ForkWidthValue = _order.ForkWidthValue,
  139. ForkLengthValue = _order.ForkLengthValue,
  140. CompareResult = _order.CompareResult,
  141. Qualified = _order.Qualified,
  142. DKCount = _order.DKCount,
  143. ZWCount = _order.ZWCount,
  144. GSYCCount = _order.GSYCCount,
  145. XWSCount = _order.XWSCount,
  146. QKCount = _order.QKCount,
  147. ZKCount = _order.ZKCount,
  148. PPCount = _order.PPCount,
  149. HSCount = _order.HSCount,
  150. XBCount = _order.XBCount,
  151. YXCount = _order.YXCount,
  152. SXCount = _order.SXCount,
  153. CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code,
  154. ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code
  155. });
  156. _order.HistoryCount++;
  157. _order.CompareResult = radioButton3.Checked ? 2 : radioButton2.Checked ? 1 : 0;
  158. _order.TensionValue = (double)numericUpDown1.Value;
  159. _order.HeightValue = (double)numericUpDown2.Value;
  160. _order.PTValue = (double)numericUpDown3.Value;
  161. _order.LineWidthValue = (double)numericUpDown4.Value;
  162. _order.FLineWidthValue = (double)numericUpDown5.Value;
  163. _order.XPTValue = (double)numericUpDown6.Value;
  164. _order.MGridIntervalValue = (double)numericUpDown7.Value;
  165. _order.MGridWidthValue = (double)numericUpDown8.Value;
  166. _order.MGridSpreadValue = (double)numericUpDown9.Value;
  167. _order.FGridSpreadValue = (double)numericUpDown10.Value;
  168. _order.BackPoleWidthValue = (double)numericUpDown11.Value;
  169. _order.MGridLengthValue = (double)numericUpDown27.Value;
  170. _order.MarkXDisValue = (double)numericUpDown30.Value;
  171. _order.MarkYDisValue = (double)numericUpDown29.Value;
  172. _order.ForkLengthValue = (double)numericUpDown28.Value;
  173. _order.ForkWidthValue = (double)numericUpDown24.Value;
  174. _order.ForkDisValue = (double)numericUpDown26.Value;
  175. _order.DKCount = (int)numericUpDown12.Value;
  176. _order.ZWCount = (int)numericUpDown13.Value;
  177. _order.GSYCCount = (int)numericUpDown14.Value;
  178. _order.XWSCount = (int)numericUpDown15.Value;
  179. _order.QKCount = (int)numericUpDown16.Value;
  180. _order.ZKCount = (int)numericUpDown17.Value;
  181. _order.PPCount = (int)numericUpDown18.Value;
  182. _order.HSCount = (int)numericUpDown19.Value;
  183. _order.YXCount = (int)numericUpDown20.Value;
  184. _order.XBCount = (int)numericUpDown21.Value;
  185. _order.SXCount = (int)numericUpDown22.Value;
  186. //_order.DSCount = (int)numericUpDown23.Value;
  187. _order.OrderHistoryList = _OrderHistoryList;
  188. _order.ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code;
  189. bool qua = true;
  190. qua = qua & (_order.CompareResult == 1);
  191. if ((_order.ProductInfo.TensionDownFloatValue + _order.ProductInfo.TensionUpFloatValue) > 0)
  192. qua = qua & (((_order.ProductInfo.TensionBaseValue - _order.ProductInfo.TensionDownFloatValue ) < _order.TensionValue) &&
  193. ((_order.ProductInfo.TensionUpFloatValue + _order.ProductInfo.TensionBaseValue) > _order.TensionValue));
  194. if ((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightUpFloatValue) > 0)
  195. qua = qua & (((_order.ProductInfo.HeightBaseValue - _order.ProductInfo.HeightDownFloatValue) < _order.HeightValue) &&
  196. ((_order.ProductInfo.HeightUpFloatValue + _order.ProductInfo.HeightBaseValue) > _order.HeightValue));
  197. if ((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTUpFloatValue) > 0)
  198. qua = qua & (((_order.ProductInfo.PTBaseValue - _order.ProductInfo.PTDownFloatValue) < _order.PTValue) &&
  199. ((_order.ProductInfo.PTUpFloatValue + _order.ProductInfo.PTBaseValue) > _order.PTValue));
  200. if ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXDownFloatValue) > 0)
  201. qua = qua & (((_order.ProductInfo.PTXBaseValue - _order.ProductInfo.PTXDownFloatValue) < _order.XPTValue) &&
  202. ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXBaseValue) > _order.XPTValue));
  203. if ((_order.ProductInfo.LineWidthUpFloatValue + _order.ProductInfo.LineWidthDownFloatValue) > 0)
  204. qua = qua & (((_order.ProductInfo.LineWidthBaseValue - _order.ProductInfo.LineWidthDownFloatValue) < _order.LineWidthValue) &&
  205. ((_order.ProductInfo.LineWidthUpFloatValue + _order.ProductInfo.LineWidthBaseValue) > _order.LineWidthValue));
  206. if ((_order.ProductInfo.FLineWidthUpFloatValue + _order.ProductInfo.FLineWidthDownFloatValue) > 0)
  207. qua = qua & (((_order.ProductInfo.FLineWidthBaseValue - _order.ProductInfo.FLineWidthDownFloatValue) < _order.FLineWidthValue) &&
  208. ((_order.ProductInfo.FLineWidthUpFloatValue + _order.ProductInfo.FLineWidthBaseValue) > _order.FLineWidthValue));
  209. if ((_order.ProductInfo.MGridIntervalDownFloatValue + _order.ProductInfo.MGridIntervalUpFloatValue) > 0)
  210. qua = qua & (((_order.ProductInfo.MGridIntervalBaseValue - _order.ProductInfo.MGridIntervalDownFloatValue) < _order.MGridIntervalValue) &&
  211. ((_order.ProductInfo.MGridIntervalUpFloatValue + _order.ProductInfo.MGridIntervalBaseValue) > _order.MGridIntervalValue));
  212. if ((_order.ProductInfo.MGridWidthDownFloatValue + _order.ProductInfo.MGridWidthUpFloatValue) > 0)
  213. qua = qua & (((_order.ProductInfo.MGridWidthBaseValue - _order.ProductInfo.MGridWidthDownFloatValue) < _order.MGridWidthValue) &&
  214. ((_order.ProductInfo.MGridWidthUpFloatValue + _order.ProductInfo.MGridWidthBaseValue) > _order.MGridWidthValue));
  215. if ((_order.ProductInfo.MGridSpreadDownFloatValue + _order.ProductInfo.MGridSpreadUpFloatValue) > 0)
  216. qua = qua & (((_order.ProductInfo.MGridSpreadBaseValue - _order.ProductInfo.MGridSpreadDownFloatValue) < _order.MGridSpreadValue) &&
  217. ((_order.ProductInfo.MGridSpreadUpFloatValue + _order.ProductInfo.MGridSpreadBaseValue) > _order.MGridSpreadValue));
  218. if ((_order.ProductInfo.FGridSpreadDownFloatValue + _order.ProductInfo.FGridSpreadUpFloatValue) > 0)
  219. qua = qua & (((_order.ProductInfo.FGridSpreadBaseValue - _order.ProductInfo.FGridSpreadDownFloatValue) < _order.FGridSpreadValue) &&
  220. ((_order.ProductInfo.FGridSpreadUpFloatValue + _order.ProductInfo.FGridSpreadBaseValue) > _order.FGridSpreadValue));
  221. if ((_order.ProductInfo.BackPoleWidthDownFloatValue + _order.ProductInfo.BackPoleWidthUpFloatValue) > 0)
  222. qua = qua & (((_order.ProductInfo.BackPoleWidthBaseValue - _order.ProductInfo.BackPoleWidthDownFloatValue) < _order.BackPoleWidthValue) &&
  223. ((_order.ProductInfo.BackPoleWidthUpFloatValue + _order.ProductInfo.BackPoleWidthBaseValue) > _order.BackPoleWidthValue));
  224. if ((_order.ProductInfo.MGridLengthDownFloatValue + _order.ProductInfo.MGridLengthUpFloatValue) > 0)
  225. qua = qua & (((_order.ProductInfo.MGridLengthBaseValue - _order.ProductInfo.MGridLengthDownFloatValue) < _order.MGridLengthValue) &&
  226. ((_order.ProductInfo.MGridLengthUpFloatValue + _order.ProductInfo.MGridLengthBaseValue) > _order.MGridLengthValue));
  227. if ((_order.ProductInfo.MarkXDisDownFloatValue + _order.ProductInfo.MarkXDisUpFloatValue) > 0)
  228. qua = qua & (((_order.ProductInfo.MarkXDisBaseValue - _order.ProductInfo.MarkXDisDownFloatValue) < _order.MarkXDisValue) &&
  229. ((_order.ProductInfo.MarkXDisUpFloatValue + _order.ProductInfo.MarkXDisBaseValue) > _order.MarkXDisValue));
  230. if ((_order.ProductInfo.MarkYDisDownFloatValue + _order.ProductInfo.MarkYDisUpFloatValue) > 0)
  231. qua = qua & (((_order.ProductInfo.MarkYDisBaseValue - _order.ProductInfo.MarkYDisDownFloatValue) < _order.MarkYDisValue) &&
  232. ((_order.ProductInfo.MarkYDisUpFloatValue + _order.ProductInfo.MarkYDisBaseValue) > _order.MarkYDisValue));
  233. if ((_order.ProductInfo.ForkWidthDownFloatValue + _order.ProductInfo.ForkWidthUpFloatValue) > 0)
  234. qua = qua & (((_order.ProductInfo.ForkWidthBaseValue - _order.ProductInfo.ForkWidthDownFloatValue) < _order.ForkWidthValue) &&
  235. ((_order.ProductInfo.ForkWidthUpFloatValue + _order.ProductInfo.ForkWidthBaseValue) > _order.ForkWidthValue));
  236. if ((_order.ProductInfo.ForkLengthDownFloatValue + _order.ProductInfo.ForkLengthUpFloatValue) > 0)
  237. qua = qua & (((_order.ProductInfo.ForkLengthBaseValue - _order.ProductInfo.ForkLengthDownFloatValue) < _order.FLineWidthValue) &&
  238. ((_order.ProductInfo.ForkLengthUpFloatValue + _order.ProductInfo.ForkLengthBaseValue) > _order.ForkLengthValue));
  239. if ((_order.ProductInfo.ForkDisDownFloatValue + _order.ProductInfo.ForkDisUpFloatValue) > 0)
  240. qua = qua & (((_order.ProductInfo.ForkDisBaseValue - _order.ProductInfo.ForkDisDownFloatValue) < _order.ForkDisValue) &&
  241. ((_order.ProductInfo.ForkDisUpFloatValue + _order.ProductInfo.ForkDisBaseValue) > _order.ForkDisValue));
  242. _order.Qualified = qua;
  243. bool result = OrderService.UpdateableListEx(_order);
  244. if (result)
  245. MessageBox.Show("修改成功", "完成");
  246. else
  247. MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
  248. }
  249. }
  250. #endregion
  251. }
  252. }