using MaiMuAOI.SysCtrl; using Models; using Newtonsoft.Json; using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MaiMuAOI.SysUI.DefectPicShow { public partial class AmendantRecordFrm : Form { Service.OrderService OrderService = new Service.OrderService(); Order _order; List _OrderHistoryList = new List(); public AmendantRecordFrm(Order order) { InitializeComponent(); UIStyle.SetUIStyle(this); this.uiTitel1.FatherForm = this; _order = order; _OrderHistoryList = _order.OrderHistoryList; this.BackColor = Color.White; } private void AmendantRecordFrm_Load(object sender, EventArgs e) { if(_order.CompareResult == 2) radioButton3.Checked = true; else if (_order.CompareResult == 1) radioButton2.Checked = true; else radioButton1.Checked = true; numericUpDown1.Value = (decimal)_order.TensionValue; numericUpDown2.Value = (decimal)_order.HeightValue; numericUpDown3.Value = (decimal)_order.PTValue; numericUpDown4.Value = (decimal)_order.LineWidthValue; numericUpDown5.Value = 0; numericUpDown6.Value = (decimal)_order.XPTValue; numericUpDown7.Value = 0; numericUpDown8.Value = 0; numericUpDown9.Value = 0; numericUpDown10.Value = 0; numericUpDown11.Value = 0; numericUpDown12.Value = (decimal)_order.DKCount; numericUpDown13.Value = (decimal)_order.ZWCount; numericUpDown14.Value = (decimal)_order.GSYCCount; numericUpDown15.Value = (decimal)_order.XWSCount; numericUpDown16.Value = (decimal)_order.QKCount; numericUpDown17.Value = (decimal)_order.ZKCount; numericUpDown18.Value = (decimal)_order.PPCount; numericUpDown19.Value = (decimal)_order.HSCount; numericUpDown20.Value = (decimal)_order.YXCount; numericUpDown21.Value = (decimal)_order.XBCount; numericUpDown22.Value = (decimal)_order.SXCount; } #region 取消 private void skinButton3_Click(object sender, EventArgs e) { this.Close(); } #endregion #region 保存 private bool IsModify() { bool ret = true; if ((_order.CompareResult == 2) && (radioButton3.Checked)) ret = ret & true; else if ((_order.CompareResult == 1) && (radioButton2.Checked)) ret = ret & true; else if ((_order.CompareResult == 0) && (radioButton1.Checked)) ret = ret & true; else ret = ret & false; ret = ret & (_order.TensionValue == (double)numericUpDown1.Value); ret = ret & (_order.HeightValue == (double)numericUpDown2.Value); ret = ret & (_order.PTValue == (double)numericUpDown3.Value); ret = ret & (_order.LineWidthValue == (double)numericUpDown4.Value); ret = ret & (_order.XPTValue == (double)numericUpDown6.Value); ret = ret & (_order.DKCount == (int)numericUpDown12.Value); ret = ret & (_order.ZWCount == (int)numericUpDown13.Value); ret = ret & (_order.GSYCCount == (int)numericUpDown14.Value); ret = ret & (_order.XWSCount == (int)numericUpDown15.Value); ret = ret & (_order.QKCount == (int)numericUpDown16.Value); ret = ret & (_order.ZKCount == (int)numericUpDown17.Value); ret = ret & (_order.PPCount == (int)numericUpDown18.Value); ret = ret & (_order.HSCount == (int)numericUpDown19.Value); ret = ret & (_order.YXCount == (int)numericUpDown20.Value); ret = ret & (_order.XBCount == (int)numericUpDown21.Value); ret = ret & (_order.SXCount == (int)numericUpDown22.Value); return !ret; } private void skinButton1_Click(object sender, EventArgs e) { if (IsModify()) { if(_OrderHistoryList == null) _OrderHistoryList = new List(); _OrderHistoryList.Add(new OrderHistory() { TensionValue = _order.TensionValue, HeightValue = _order.HeightValue, PTValue = _order.PTValue, LineWidthValue = _order.LineWidthValue, XPTValue = _order.XPTValue, CompareResult = _order.CompareResult, Qualified = _order.Qualified, DKCount = _order.DKCount, ZWCount = _order.ZWCount, GSYCCount = _order.GSYCCount, XWSCount = _order.XWSCount, QKCount = _order.QKCount, ZKCount = _order.ZKCount, PPCount = _order.PPCount, HSCount = _order.HSCount, XBCount = _order.XBCount, YXCount = _order.YXCount, SXCount = _order.SXCount, CreateUserCode = SysMgr.Instance.UserMgr.LoginUser.Code, ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code }); _order.HistoryCount++; _order.CompareResult = radioButton3.Checked ? 2 : radioButton2.Checked ? 1 : 0; _order.TensionValue = (double)numericUpDown1.Value; _order.HeightValue = (double)numericUpDown2.Value; _order.PTValue = (double)numericUpDown3.Value; _order.LineWidthValue = (double)numericUpDown4.Value; _order.XPTValue = (double)numericUpDown6.Value; _order.DKCount = (int)numericUpDown12.Value; _order.ZWCount = (int)numericUpDown13.Value; _order.GSYCCount = (int)numericUpDown14.Value; _order.XWSCount = (int)numericUpDown15.Value; _order.QKCount = (int)numericUpDown16.Value; _order.ZKCount = (int)numericUpDown17.Value; _order.PPCount = (int)numericUpDown18.Value; _order.HSCount = (int)numericUpDown19.Value; _order.YXCount = (int)numericUpDown20.Value; _order.XBCount = (int)numericUpDown21.Value; _order.SXCount = (int)numericUpDown22.Value; _order.OrderHistoryList = _OrderHistoryList; _order.ModifyUserCode = SysMgr.Instance.UserMgr.LoginUser.Code; bool qua = true; qua = qua & (_order.CompareResult == 1); if ((_order.ProductInfo.TensionDownFloatValue + _order.ProductInfo.TensionUpFloatValue) > 0) qua = qua & (((_order.ProductInfo.TensionDownFloatValue + _order.ProductInfo.TensionBaseValue) < _order.TensionValue) && ((_order.ProductInfo.TensionUpFloatValue + _order.ProductInfo.TensionBaseValue) > _order.TensionValue)); if ((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightUpFloatValue) > 0) qua = qua & (((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightBaseValue) < _order.HeightValue) && ((_order.ProductInfo.HeightUpFloatValue + _order.ProductInfo.HeightBaseValue) > _order.HeightValue)); if ((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTUpFloatValue) > 0) qua = qua & (((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTBaseValue) < _order.PTValue) && ((_order.ProductInfo.PTUpFloatValue + _order.ProductInfo.PTBaseValue) > _order.PTValue)); if ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXDownFloatValue) > 0) qua = qua & (((_order.ProductInfo.PTXDownFloatValue + _order.ProductInfo.PTXBaseValue) < _order.XPTValue) && ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXBaseValue) > _order.XPTValue)); _order.Qualified = qua; bool result = OrderService.UpdateableListEx(_order); if (result) MessageBox.Show("修改成功", "完成"); else MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } } #endregion } }