private void UpdateMstOrder() { using (UpdateMstQty updForm = new UpdateMstQty(currentMstOrder.LastUpdateTime, currentMstOrder.MadeQty, currentMstOrder.PcbOnMb)) { updateFormDisplayed = true; if (updForm.ShowDialog() == DialogResult.OK) { currentMstOrder.LastUpdateTime = (DateTime.Now - currentMstOrder.DateStart).TotalMinutes >= 1 ? DateTime.Now : DateTime.Now.AddMinutes(1); currentMstOrder.MadeQty = updForm.newTotalQty; UpdateMstLabels(); updateFormDisplayed = false; if (currentMstOrder.RecordId > 0) { //update SqlOperations.UpdateCurrentMstOrderQuantity(currentMstOrder.MadeQty, currentMstOrder.RecordId); } else { //insert SqlOperations.SaveRecordToDb(currentMstOrder.DateStart, DateTime.Now, smtLine, currentMstOrder.Oper, currentMstOrder.OrderNumber, currentMstOrder.Nc10, currentMstOrder.MadeQty.ToString(), "0", "0", "check", "", currentMstOrder.Stencil, "MST", 0); int lastRecordId = 0; lastRecordId = SqlOperations.GetLastRecordIdForLine(smtLine); if (lastRecordId > 0) { currentMstOrder.RecordId = lastRecordId; } } var eff = Math.Round(MstCurrentShiftEfficiency.CalculateCurrentShiftEff(currentMstOrder, dataGridViewMstOrders), 0); angularGauge1.Value = Math.Min(100, eff); labelCurrentShiftEfficiency.Text = $"Wydajność aktualnej zmiany: {eff}%"; } } }
private void button5_Click(object sender, EventArgs e) { using (UpdateMstQty updateQtyForm = new UpdateMstQty(currentMstOrder.LastUpdateTime, currentMstOrder.MadeQty, currentMstOrder.PcbOnMb)) { if (updateQtyForm.ShowDialog() == DialogResult.OK) { currentMstOrder.MadeQty = updateQtyForm.newTotalQty; currentMstOrder.LastUpdateTime = DateTime.Now; UpdateMstLabels(); } } }