private bool LoadActiveReference(string article, ProcessType pp) { using (var xsetting = new XSetting()) { var k = xsetting.GetDatabaseConnection(); var kk = new Database(k.TableName, k.Provider, k.FileLocation); var kkk = kk.LoadByArticle(article); if (!kkk) { return(false); } _currentRunning = ParseLoadedData(kk.Data, pp); UpdateActiveReferenceLabels(_currentRunning); _individualVariables = UpdateLabelVars("Individual1", kk.Data); _groupVariables = UpdateLabelVars("Group1", kk.Data); _incompleteVariables = UpdateLabelVars("Incomplete1", kk.Data); _individualLabel.Initiate(_individualVariables); _groupLabel.Initiate(_groupVariables); _incompleteLabel.Initiate(_incompleteVariables); xsetting.UpdateLastRunning(_currentRunning); xsetting.Save(); } return(true); }
private void btnSave_Click(object sender, EventArgs e) { try { Parity par; StopBits stop; Enum.TryParse(cboParity.Text, true, out par); Enum.TryParse(cboStopBits.Text, true, out stop); var baud = Convert.ToInt32(cboBaudRate.Text); var databits = Convert.ToInt32(cboDataBits.Text); var name = cboCom.Text; var tempComPortType = new ComPortType { Parity = par, StopBits = stop, BaudRate = baud, ComName = name == "" ? "COM1" : name, DataBits = databits }; var set = new XSetting(); set.UpdateComPort(tempComPortType); _comPortType = tempComPortType; set.Save(); ComPort.Close(); InitializeCom(_comPortType); ComPort.Open(); MessageBox.Show(@"Successful"); } catch { MessageBox.Show(@"Failed"); } }
private void PackingGroupOnGroupingPackedQuantitySizeAchieved(object sender, int quantity, int deltaQuantity) { _groupLabel.Print(); UpdateLabelVisibleWithInvoke(lblBoxRemove, true); using (var t = new XSetting()) { t.UpdateLastRunning(_currentRunning); t.Save(); } }
private void IncreaseIndividualFail(int delta) { if (_currentRunning.IndividualFail + delta < 0) { return; } _currentRunning.IndividualFail += delta; UpdateLabelWithInvoke(lblFail, _currentRunning.IndividualFail.ToString("000")); using (var t = new XSetting()) { t.UpdateLastRunning(_currentRunning); t.Save(); } }
private void IncreaseIndividualPass(int delta) { if (_currentRunning.IndividualPass + delta < 0) { return; } _currentRunning.IndividualPass += delta; UpdateLabelWithInvoke(lblPass, _currentRunning.IndividualPass.ToString("000")); _packingGroup.SetPackableQuantity(_currentRunning.IndividualPass); using (var t = new XSetting()) { t.UpdateLastRunning(_currentRunning); t.Save(); } }
private void btnTeach_Click(object sender, EventArgs e) { int pembagi; var d = MessageBox.Show(@"Letakkan beberapa Product ke dalam box di atas timbangan. Kemudian click [OK]", @"Teaching Weight", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (d != DialogResult.OK) { return; } using (var adj = new Adjust("Product Dalam Box", "OK")) { adj.ShowDialog(); var action = adj.ActionToTake; var delta = adj.AdjustmentQty; if (action != AdjusmentMode.Tambah) { return; } pembagi = delta <= 0 ? 1 : delta; } var weight = _packingGroup?.WeightTeach(_packingGroup.ActualWeight, pembagi); if (weight > 0.005) { using (var set = new XSetting()) { try { var k = set.GetDatabaseConnection(); var db = new Database(k.TableName, k.Provider, k.FileLocation); db.Update("upperweight", weight.Value.ToString("F3"), "Art_number", _currentRunning.Article); _packingGroup.SetNominalWeight(weight.Value); UpdateTextWithInvoke(tbLog, FormMessage($"Weighing Nominal update {weight} for reference {_currentRunning.Article}", true, "")); MessageBox.Show(@"Successfull"); } catch (Exception mess) { UpdateTextWithInvoke(tbLog, FormMessage(mess.StackTrace, false, "")); MessageBox.Show(@"Failed"); } } } }