public void SetVariables(PrinterInfoDto dto)
 {
     if (_variableManager != null)
     {
         _variableManager.SetVariables(dto);
     }
 }
예제 #2
0
        private void OnVariableChanged(PrinterInfoDto dto)
        {
            var temp = VariablesChanged;

            temp?.Invoke(this, new VariableEventArgs()
            {
                PrinterInfo = dto
            });
        }
예제 #3
0
        private void Variable_ValueChanged(object sender, BR.AN.PviServices.VariableEventArgs e)
        {
            Variable v = sender as Variable;

            if (v != null)
            {
                _log.Info($"Variable={v.Name} Value={v.Value}");

                var printerInfo = new PrinterInfoDto();
                printerInfo.SetProperty(nameof(printerInfo.SideLabelPosition), Variables["PVI.SideLabelPosition"].Value);
                printerInfo.SetProperty(nameof(printerInfo.StatusText), Variables["PVI.StatusText"].Value);
                printerInfo.SetProperty(nameof(printerInfo.InfeedSpeed), Variables["PVI.Speed[0]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.PrinterConveyorSpeed), Variables["PVI.Speed[1]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.LabelApplyFormat), Variables["PVI.LabelApplyFormat"].Value);
                printerInfo.SetProperty(nameof(printerInfo.StartConveyor), Variables["PVI.Command[0]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.StopConveyor), Variables["PVI.Command[1]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetConveyor), Variables["PVI.Command[2]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.PrinterOnOff), Variables["PVI.Command[3]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.NumberOfBoxes), Variables["PVI.Counter[0].CountValue"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfBoxes), Variables["PVI.Counter[0].Reset"].Value);
                printerInfo.SetProperty(nameof(printerInfo.NumberOfFrontLabels), Variables["PVI.Counter[1].CountValue"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfFrontLabels), Variables["PVI.Counter[1].Reset"].Value);
                printerInfo.SetProperty(nameof(printerInfo.NumberOfSideLabels), Variables["PVI.Counter[2].CountValue"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfSideLabels), Variables["PVI.Counter[2].Reset"].Value);
                printerInfo.SetProperty(nameof(printerInfo.TotalLabelsApplied), Variables["PVI.Counter[3].CountValue"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetTotalLabelsApplied), Variables["PVI.Counter[3].Reset"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfBoxes), Variables["PVI.Command[0]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfFrontLabels), Variables["PVI.Command[1]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetNumberOfSideLabels), Variables["PVI.Command[2]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ResetTotalLabelsApplied), Variables["PVI.Command[3]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.RefreshLabel), Variables["PVI.Command[4]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ClearPrinter), Variables["PVI.Command[13]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.ConyorsRunning), Variables["PVI.Status[0]"].Value);
                printerInfo.SetProperty(nameof(printerInfo.PrinterOnOk), Variables["PVI.Status[1]"].Value);

                OnVariableChanged(printerInfo);

                if (v.Name == "PVI.Command[4]")
                {
                    SetVariable(v.Name, 0);
                }

                if (v.Name == "PVI.Command[13]")
                {
                    SetVariable(v.Name, 0);
                }
            }
        }
예제 #4
0
        public void SetVariables(PrinterInfoDto dto)
        {
            if (dto.LabelApplyFormat.HasValue)
            {
                Variables["PVI.LabelApplyFormat"].Value.Assign(dto.LabelApplyFormat.Value);
                Variables["PVI.LabelApplyFormat"].WriteValue();
            }
            if (dto.SideLabelPosition.HasValue)
            {
                Variables["PVI.SideLabelPosition"].Value.Assign(dto.SideLabelPosition.Value);
                Variables["PVI.SideLabelPosition"].WriteValue();
            }
            if (dto.InfeedSpeed.HasValue)
            {
                Variables["PVI.Speed[0]"].Value.Assign(dto.InfeedSpeed.Value);
                Variables["PVI.Speed[0]"].WriteValue();
            }
            if (dto.PrinterConveyorSpeed.HasValue)
            {
                Variables["PVI.Speed[1]"].Value.Assign(dto.PrinterConveyorSpeed.Value);
                Variables["PVI.Speed[1]"].WriteValue();
            }
            if (dto.StartConveyor.HasValue)
            {
                Variables["PVI.Command[0]"].Value.Assign(dto.StartConveyor.Value);
                Variables["PVI.Command[0]"].WriteValue();
            }
            if (dto.StopConveyor.HasValue)
            {
                Variables["PVI.Command[1]"].Value.Assign(dto.StopConveyor.Value);
                Variables["PVI.Command[1]"].WriteValue();
            }

            if (dto.BoxDimension.HasValue)
            {
                Variables["PVI.BoxDimension"].Value.Assign(dto.BoxDimension.Value);
                Variables["PVI.BoxDimension"].WriteValue();
            }

            if (dto.ResetNumberOfBoxes.HasValue)
            {
                if (dto.ResetNumberOfBoxes.Value == 1)
                {
                    Variables["PVI.Counter[0].Reset"].Value.Assign(dto.ResetNumberOfBoxes.Value);
                    Variables["PVI.Counter[0].Reset"].WriteValue();
                }
            }

            if (dto.ResetNumberOfFrontLabels.HasValue)
            {
                if (dto.ResetNumberOfBoxes.Value == 1)
                {
                    Variables["PVI.Counter[1].Reset"].Value.Assign(dto.ResetNumberOfFrontLabels.Value);
                    Variables["PVI.Counter[1].Reset"].WriteValue();
                }
            }

            if (dto.ResetNumberOfSideLabels.HasValue)
            {
                if (dto.ResetNumberOfSideLabels.Value == 1)
                {
                    Variables["PVI.Counter[2].Reset"].Value.Assign(dto.ResetNumberOfSideLabels.Value);
                    Variables["PVI.Counter[2].Reset"].WriteValue();
                }
            }

            if (dto.ResetTotalLabelsApplied.HasValue)
            {
                if (dto.ResetTotalLabelsApplied.Value == 1)
                {
                    Variables["PVI.Counter[3].Reset"].Value.Assign(dto.ResetTotalLabelsApplied.Value);
                    Variables["PVI.Counter[3].Reset"].WriteValue();
                }
            }
        }