版博士V2.0程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

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