Beispiel #1
0
        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);
        }
Beispiel #2
0
        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");
                    }
                }
            }
        }