예제 #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);
        }
예제 #2
0
        public ProcessType GetLastRunning()
        {
            XElement last = (from xml2 in _xDocument.Descendants("Lastrunning")
                             select xml2).FirstOrDefault();

            if (last != null)
            {
                try
                {
                    var lastVars = new ProcessType
                    {
                        Article        = last.Element("Article").Value,
                        Reference      = last.Element("Reference").Value,
                        IndividualPass =
                            last.Element("IndividualPass").Value == ""
                                ? 0
                                : Convert.ToInt32(last.Element("IndividualPass").Value),
                        IndividualFail =
                            last.Element("IndividualFail").Value == ""
                                ? 0
                                : Convert.ToInt32(last.Element("IndividualFail").Value),
                        Box = last.Element("Box").Value == "" ? 0 : Convert.ToInt32(last.Element("Box").Value),
                    };
                    return(lastVars);
                }
                catch
                {
                    // ignored
                }
            }
            return(new ProcessType());
        }
예제 #3
0
 private void UpdateActiveReferenceLabels(ProcessType pp)
 {
     lblReference.Text = pp.Reference;
     lblArticle.Text   = pp.Article;
     lblGroupsize.Text = pp.GroupSize.ToString();
     lblEan13.Text     = pp.Ean13Code;
     lblNominal.Text   = pp.NominalWeight.ToString("F3");
 }
예제 #4
0
        private ProcessType ParseLoadedData(Dictionary <string, string> kkData, ProcessType process)
        {
            process.Article       = kkData["Art_number"];
            process.Reference     = kkData["Reference"];
            process.GroupSize     = Convert.ToInt32(kkData["Qty_group"]);
            process.NominalWeight = Convert.ToDouble(kkData["upperweight"]);

            return(process);
        }
예제 #5
0
        public void UpdateLastRunning(ProcessType lastData)
        {
            XElement last = (from xml2 in _xDocument.Descendants("Lastrunning")
                             select xml2).FirstOrDefault();

            if (last != null)
            {
                last.Element("Reference").Value      = lastData.Reference;
                last.Element("Article").Value        = lastData.Article;
                last.Element("IndividualPass").Value = lastData.IndividualPass.ToString();
                last.Element("IndividualFail").Value = lastData.IndividualFail.ToString();
                last.Element("Box").Value            = lastData.Box.ToString();
            }
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var p = new ProcessType();

            var j = LoadActiveReference(textBox4.Text, p);

            if (!j)
            {
                UpdateTextWithInvoke(tbLog, FormMessage($"Reference Not Found : {textBox4.Text} !!!", false, ""));
                return;
            }
            InitPackingGroup(_currentRunning.GroupSize, _currentRunning.Box, _currentRunning.NominalWeight,
                             _currentRunning.IndividualPass, 999999);
            IncreaseIndividualFail(0);
            IncreaseIndividualPass(0);
            lblPacked.Text = _packingGroup.PackedQuantity.ToString("000");
            UpdateTextWithInvoke(tbLog, FormMessage($"Reference Loaded : {_currentRunning.Article} {_currentRunning.Reference}!!!", true, ""));
        }