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; numericUpDown5.Value = (decimal)_order.TensionValue; 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; //numericUpDown31.Value = (decimal)_order.ChilopodLengthValue; //numericUpDown25.Value = (decimal)_order.ChilopodWidthValue; } #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.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, //FLineWidthValue = _order.FLineWidthValue, //XPTValue = _order.XPTValue, //MGridIntervalValue = _order.MGridIntervalValue, //MGridWidthValue = _order.MGridWidthValue, //MGridSpreadValue = _order.MGridSpreadValue, //FGridSpreadValue = _order.FGridSpreadValue, //BackPoleWidthValue = _order.BackPoleWidthValue, //MGridLengthValue = _order.MGridLengthValue, //MarkXDisValue = _order.MarkXDisValue, //MarkYDisValue = _order.MarkYDisValue, //ForkDisValue = _order.ForkDisValue, //ForkWidthValue = _order.ForkWidthValue, //ForkLengthValue = _order.ForkLengthValue, //ChilopodLengthValue = _order.ChilopodLengthValue, //ChilopodWidthValue = _order.ChilopodWidthValue, //ShardingDisValue = _order.ShardingDisValue, //WeldingSpotDisValue = _order.WeldingSpotDisValue, //WeldingSpotLengthValue = _order.WeldingSpotLengthValue, //WeldingSpotWidthValue = _order.WeldingSpotWidthValue, //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.FLineWidthValue = (double)numericUpDown5.Value; //_order.XPTValue = (double)numericUpDown6.Value; //_order.MGridIntervalValue = (double)numericUpDown7.Value; //_order.MGridWidthValue = (double)numericUpDown8.Value; //_order.MGridSpreadValue = (double)numericUpDown9.Value; //_order.FGridSpreadValue = (double)numericUpDown10.Value; //_order.BackPoleWidthValue = (double)numericUpDown11.Value; //_order.MGridLengthValue = (double)numericUpDown27.Value; //_order.MarkXDisValue = (double)numericUpDown30.Value; //_order.MarkYDisValue = (double)numericUpDown29.Value; //_order.ForkLengthValue = (double)numericUpDown28.Value; //_order.ForkWidthValue = (double)numericUpDown24.Value; //_order.ForkDisValue = (double)numericUpDown26.Value; //_order.ChilopodLengthValue = (double)numericUpDown31.Value; //_order.ChilopodWidthValue = (double)numericUpDown25.Value; //_order.ShardingDisValue = (double)numericUpDown32.Value; //_order.WeldingSpotLengthValue = (double)numericUpDown35.Value; //_order.WeldingSpotWidthValue = (double)numericUpDown34.Value; //_order.WeldingSpotDisValue = (double)numericUpDown33.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.DSCount = (int)numericUpDown23.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.TensionBaseValue - _order.ProductInfo.TensionDownFloatValue ) < _order.TensionValue) && ((_order.ProductInfo.TensionUpFloatValue + _order.ProductInfo.TensionBaseValue) > _order.TensionValue)); if ((_order.ProductInfo.HeightDownFloatValue + _order.ProductInfo.HeightUpFloatValue) > 0) qua = qua & (((_order.ProductInfo.HeightBaseValue - _order.ProductInfo.HeightDownFloatValue) < _order.HeightValue) && ((_order.ProductInfo.HeightUpFloatValue + _order.ProductInfo.HeightBaseValue) > _order.HeightValue)); if ((_order.ProductInfo.PTDownFloatValue + _order.ProductInfo.PTUpFloatValue) > 0) qua = qua & (((_order.ProductInfo.PTBaseValue - _order.ProductInfo.PTDownFloatValue) < _order.PTValue) && ((_order.ProductInfo.PTUpFloatValue + _order.ProductInfo.PTBaseValue) > _order.PTValue)); //if ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXDownFloatValue) > 0) // qua = qua & (((_order.ProductInfo.PTXBaseValue - _order.ProductInfo.PTXDownFloatValue) < _order.XPTValue) && // ((_order.ProductInfo.PTXUpFloatValue + _order.ProductInfo.PTXBaseValue) > _order.XPTValue)); if ((_order.ProductInfo.LineWidthUpFloatValue + _order.ProductInfo.LineWidthDownFloatValue) > 0) qua = qua & (((_order.ProductInfo.LineWidthBaseValue - _order.ProductInfo.LineWidthDownFloatValue) < _order.LineWidthValue) && ((_order.ProductInfo.LineWidthUpFloatValue + _order.ProductInfo.LineWidthBaseValue) > _order.LineWidthValue)); //if ((_order.ProductInfo.FLineWidthUpFloatValue + _order.ProductInfo.FLineWidthDownFloatValue) > 0) // qua = qua & (((_order.ProductInfo.FLineWidthBaseValue - _order.ProductInfo.FLineWidthDownFloatValue) < _order.FLineWidthValue) && // ((_order.ProductInfo.FLineWidthUpFloatValue + _order.ProductInfo.FLineWidthBaseValue) > _order.FLineWidthValue)); //if ((_order.ProductInfo.MGridIntervalDownFloatValue + _order.ProductInfo.MGridIntervalUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MGridIntervalBaseValue - _order.ProductInfo.MGridIntervalDownFloatValue) < _order.MGridIntervalValue) && // ((_order.ProductInfo.MGridIntervalUpFloatValue + _order.ProductInfo.MGridIntervalBaseValue) > _order.MGridIntervalValue)); //if ((_order.ProductInfo.MGridWidthDownFloatValue + _order.ProductInfo.MGridWidthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MGridWidthBaseValue - _order.ProductInfo.MGridWidthDownFloatValue) < _order.MGridWidthValue) && // ((_order.ProductInfo.MGridWidthUpFloatValue + _order.ProductInfo.MGridWidthBaseValue) > _order.MGridWidthValue)); //if ((_order.ProductInfo.MGridSpreadDownFloatValue + _order.ProductInfo.MGridSpreadUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MGridSpreadBaseValue - _order.ProductInfo.MGridSpreadDownFloatValue) < _order.MGridSpreadValue) && // ((_order.ProductInfo.MGridSpreadUpFloatValue + _order.ProductInfo.MGridSpreadBaseValue) > _order.MGridSpreadValue)); //if ((_order.ProductInfo.FGridSpreadDownFloatValue + _order.ProductInfo.FGridSpreadUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.FGridSpreadBaseValue - _order.ProductInfo.FGridSpreadDownFloatValue) < _order.FGridSpreadValue) && // ((_order.ProductInfo.FGridSpreadUpFloatValue + _order.ProductInfo.FGridSpreadBaseValue) > _order.FGridSpreadValue)); //if ((_order.ProductInfo.BackPoleWidthDownFloatValue + _order.ProductInfo.BackPoleWidthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.BackPoleWidthBaseValue - _order.ProductInfo.BackPoleWidthDownFloatValue) < _order.BackPoleWidthValue) && // ((_order.ProductInfo.BackPoleWidthUpFloatValue + _order.ProductInfo.BackPoleWidthBaseValue) > _order.BackPoleWidthValue)); //if ((_order.ProductInfo.MGridLengthDownFloatValue + _order.ProductInfo.MGridLengthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MGridLengthBaseValue - _order.ProductInfo.MGridLengthDownFloatValue) < _order.MGridLengthValue) && // ((_order.ProductInfo.MGridLengthUpFloatValue + _order.ProductInfo.MGridLengthBaseValue) > _order.MGridLengthValue)); //if ((_order.ProductInfo.MarkXDisDownFloatValue + _order.ProductInfo.MarkXDisUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MarkXDisBaseValue - _order.ProductInfo.MarkXDisDownFloatValue) < _order.MarkXDisValue) && // ((_order.ProductInfo.MarkXDisUpFloatValue + _order.ProductInfo.MarkXDisBaseValue) > _order.MarkXDisValue)); //if ((_order.ProductInfo.MarkYDisDownFloatValue + _order.ProductInfo.MarkYDisUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.MarkYDisBaseValue - _order.ProductInfo.MarkYDisDownFloatValue) < _order.MarkYDisValue) && // ((_order.ProductInfo.MarkYDisUpFloatValue + _order.ProductInfo.MarkYDisBaseValue) > _order.MarkYDisValue)); //if ((_order.ProductInfo.ForkWidthDownFloatValue + _order.ProductInfo.ForkWidthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ForkWidthBaseValue - _order.ProductInfo.ForkWidthDownFloatValue) < _order.ForkWidthValue) && // ((_order.ProductInfo.ForkWidthUpFloatValue + _order.ProductInfo.ForkWidthBaseValue) > _order.ForkWidthValue)); //if ((_order.ProductInfo.ForkLengthDownFloatValue + _order.ProductInfo.ForkLengthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ForkLengthBaseValue - _order.ProductInfo.ForkLengthDownFloatValue) < _order.FLineWidthValue) && // ((_order.ProductInfo.ForkLengthUpFloatValue + _order.ProductInfo.ForkLengthBaseValue) > _order.ForkLengthValue)); //if ((_order.ProductInfo.ForkDisDownFloatValue + _order.ProductInfo.ForkDisUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ForkDisBaseValue - _order.ProductInfo.ForkDisDownFloatValue) < _order.ForkDisValue) && // ((_order.ProductInfo.ForkDisUpFloatValue + _order.ProductInfo.ForkDisBaseValue) > _order.ForkDisValue)); //if ((_order.ProductInfo.ChilopodLengthDownFloatValue + _order.ProductInfo.ChilopodLengthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ChilopodLengthBaseValue - _order.ProductInfo.ChilopodLengthDownFloatValue) < _order.ChilopodLengthValue) && // ((_order.ProductInfo.ChilopodLengthUpFloatValue + _order.ProductInfo.ChilopodLengthBaseValue) > _order.ChilopodLengthValue)); //if ((_order.ProductInfo.ChilopodWidthDownFloatValue + _order.ProductInfo.ChilopodWidthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ChilopodWidthBaseValue - _order.ProductInfo.ChilopodWidthDownFloatValue) < _order.ChilopodLengthValue) && // ((_order.ProductInfo.ChilopodWidthUpFloatValue + _order.ProductInfo.ChilopodWidthBaseValue) > _order.ChilopodWidthValue)); //if ((_order.ProductInfo.ShardingDisDownFloatValue + _order.ProductInfo.ShardingDisUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.ShardingDisBaseValue - _order.ProductInfo.ShardingDisDownFloatValue) < _order.ShardingDisValue) && // ((_order.ProductInfo.ShardingDisUpFloatValue + _order.ProductInfo.ShardingDisBaseValue) > _order.ShardingDisValue)); //if ((_order.ProductInfo.WeldingSpotLengthDownFloatValue + _order.ProductInfo.WeldingSpotLengthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.WeldingSpotLengthBaseValue - _order.ProductInfo.WeldingSpotLengthDownFloatValue) < _order.WeldingSpotLengthValue) && // ((_order.ProductInfo.WeldingSpotLengthUpFloatValue + _order.ProductInfo.WeldingSpotLengthBaseValue) > _order.WeldingSpotLengthValue)); //if ((_order.ProductInfo.WeldingSpotWidthDownFloatValue + _order.ProductInfo.WeldingSpotWidthUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.WeldingSpotWidthBaseValue - _order.ProductInfo.WeldingSpotWidthDownFloatValue) < _order.WeldingSpotWidthValue) && // ((_order.ProductInfo.WeldingSpotWidthUpFloatValue + _order.ProductInfo.WeldingSpotWidthBaseValue) > _order.WeldingSpotWidthValue)); //if ((_order.ProductInfo.WeldingSpotDisDownFloatValue + _order.ProductInfo.WeldingSpotDisUpFloatValue) > 0) // qua = qua & (((_order.ProductInfo.WeldingSpotDisBaseValue - _order.ProductInfo.WeldingSpotDisDownFloatValue) < _order.WeldingSpotDisValue) && // ((_order.ProductInfo.WeldingSpotDisUpFloatValue + _order.ProductInfo.WeldingSpotDisBaseValue) > _order.WeldingSpotDisValue)); _order.Qualified = qua; bool result = OrderService.UpdateableListEx(_order); if (result) MessageBox.Show("修改成功", "完成"); else MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } } #endregion } }