Beispiel #1
0
 private void SetReturnCommandStatus()
 {
     if ((int)operationRGroup.EditValue == 0)
     {
         _returnCommand = (_command == Utils.ProcessComand.OpenCell) ? Utils.ProcessComand.CellOpenAgain : Utils.ProcessComand.CellCloseAgain;
     }
     else
     {
         _returnCommand = (_command == Utils.ProcessComand.OpenCell) ? Utils.ProcessComand.CellCloseAgain : Utils.ProcessComand.CellOpenAgain;
     }
 }
Beispiel #2
0
        public WaitDialogFm(PLC plc, Utils.ProcessComand command, int interval, Utils.ProcessInfo infoSource)
        {
            InitializeComponent();

            _plc      = plc;
            _interval = interval;
            _command  = command;

            processInfoBS.DataSource = infoSource;

            operationInfoLbl.DataBindings.Add("Text", processInfoBS, "OperationName");
            stackerInfoLbl.DataBindings.Add("Text", processInfoBS, "StackerName");
            cellInfoLbl.DataBindings.Add("Text", processInfoBS, "CellNumber");
            dropoffInfoLbl.DataBindings.Add("Text", processInfoBS, "WindowNumber");

            this.Focus();

            StartTimer();
        }
Beispiel #3
0
        public OperationCustomWaitFm(Utils.ProcessComand command)
        {
            InitializeComponent();

            _returnCommand = Utils.ProcessComand.None;
            _command       = command;

            SetReturnCommandStatus();

            if (_command == Utils.ProcessComand.OpenCell)
            {
                operationRGroup.Properties.Items[0].Description = "Продолжить доставку кассеты на стол выдачи";
                operationRGroup.Properties.Items[1].Description = "Вернуть кассету на склад";
            }
            else
            {
                operationRGroup.Properties.Items[0].Description = "Продолжить доставку кассеты на склад";
                operationRGroup.Properties.Items[1].Description = "Вернуть кассету на стол выдачи";
            }
        }
Beispiel #4
0
        private void ProcessIndicator(Utils.ProcessComand currCommand, List <DataItemsQueryDTO> itemSource)
        {
            if (currCommand != Utils.ProcessComand.None)
            {
                bool error  = false;
                bool result = Boolean.TryParse(itemSource.First(s => s.Name == "Error").CurrentValue, out error);

                _errorList = itemSource.First(s => s.Name == "ErrorList").CurrentValue.Replace("\0", String.Empty);

                if (error || _errorList.Length > 0)
                {
                    _command = Utils.ProcessComand.Error;
                }
            }

            switch (currCommand)
            {
            case Utils.ProcessComand.ConfirmQuantity:
                break;

            case Utils.ProcessComand.ChangeCell:
                operationInfoLbl.Text = "Вернуть ячейку на склад";
                bool putToDoneForChange = Boolean.Parse(itemSource.First(s => s.Name == "PutToDone").CurrentValue);
                if (putToDoneForChange)
                {
                    _command = Utils.ProcessComand.OpenCell;

                    var itemCellNumber     = TagList.First(s => s.Name == "CellNumber");
                    var itemPLCDropoffWind = TagList.First(s => s.Name == "PLCDropoffWind");
                    var ItemPLCSetOpen     = TagList.First(s => s.Name == "PLCSetOpen");

                    _plc.WriteTag(itemCellNumber.AbsoleteItemName, ((Utils.ProcessInfo)processInfoBS.Current).CellNumber);
                    _plc.WriteTag(itemPLCDropoffWind.AbsoleteItemName, ((Utils.ProcessInfo)processInfoBS.Current).WindowNumber);
                    _plc.WriteTag(ItemPLCSetOpen.AbsoleteItemName, 1);

                    operationInfoLbl.Text = "Выдвинуть ячейку";
                }
                break;

            case Utils.ProcessComand.CellCloseAgain:
                bool putToDoneRetry = Boolean.Parse(itemSource.First(s => s.Name == "PutToDone").CurrentValue);
                if (putToDoneRetry)
                {
                    _command = Utils.ProcessComand.None;

                    _plc.ResetAllVar();

                    DialogResult = System.Windows.Forms.DialogResult.Retry;
                    this.Close();
                }
                break;

            case Utils.ProcessComand.CancelOperation:
            case Utils.ProcessComand.CloseCellWithLoadUp:
            case Utils.ProcessComand.CloseCellFull:
                bool putToDone = Boolean.Parse(itemSource.First(s => s.Name == "PutToDone").CurrentValue);
                if (putToDone)
                {
                    _command = Utils.ProcessComand.None;

                    _plc.ResetAllVar();

                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
                break;

            case Utils.ProcessComand.BreakOperation:
                var ItemStopBit = TagList.First(s => s.Name == "StopBit");
                _plc.WriteTag(ItemStopBit.AbsoleteItemName, true);

                using (OperationCustomWaitFm operationUCFromError = new OperationCustomWaitFm(_command))
                {
                    if (operationUCFromError.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        _command = operationUCFromError.Return();

                        if (_command == Utils.ProcessComand.CellOpenAgain)
                        {
                            operationInfoLbl.Text = "Выдвинуть ячейку";
                            processInfoBS.EndEdit();
                            var ItemSetOpenAgain = TagList.First(s => s.Name == "SetOpenAgain");
                            _plc.WriteTag(ItemSetOpenAgain.AbsoleteItemName, true);
                        }
                        else
                        {
                            operationInfoLbl.Text = "Вернуть ячейку";
                            processInfoBS.EndEdit();
                            var ItemSetCloseAgain = TagList.First(s => s.Name == "SetCloseAgain");
                            _plc.WriteTag(ItemSetCloseAgain.AbsoleteItemName, true);
                        }
                    }
                }

                waitTimer.Start();
                break;

            case Utils.ProcessComand.CellOpenAgain:
                bool getFromDoneIgnore = Boolean.Parse(itemSource.First(s => s.Name == "GetFromDone").CurrentValue);
                if (getFromDoneIgnore)
                {
                    _command = Utils.ProcessComand.None;

                    var itemPLCLoadStatus = TagList.First(s => s.Name == "PLCLoadStatus");
                    var ItemPLCSetOpen    = TagList.First(s => s.Name == "PLCSetOpen");
                    _plc.WriteTag(itemPLCLoadStatus.AbsoleteItemName, 0);
                    _plc.WriteTag(ItemPLCSetOpen.AbsoleteItemName, 0);

                    DialogResult = System.Windows.Forms.DialogResult.Ignore;
                    this.Close();
                }
                break;

            case Utils.ProcessComand.OpenCell:
                bool getFromDone = Boolean.Parse(itemSource.First(s => s.Name == "GetFromDone").CurrentValue);
                if (getFromDone)
                {
                    _command = Utils.ProcessComand.None;

                    var itemPLCLoadStatus = TagList.First(s => s.Name == "PLCLoadStatus");
                    var ItemPLCSetOpen    = TagList.First(s => s.Name == "PLCSetOpen");
                    _plc.WriteTag(itemPLCLoadStatus.AbsoleteItemName, 0);
                    _plc.WriteTag(ItemPLCSetOpen.AbsoleteItemName, 0);

                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
                break;

            case Utils.ProcessComand.Error:
                _command = Utils.ProcessComand.None;

                waitTimer.Stop();

                ErrorListControl displayAlarm = new ErrorListControl(AlarmsList(_errorList));
                DevExpress.XtraEditors.XtraDialog.Show(displayAlarm, "Журнал ошибок", MessageBoxButtons.OK);

                var itemMessageReset = TagList.First(s => s.Name == "MessageReset");
                var itemErrorList    = TagList.First(s => s.Name == "ErrorList");
                var itemError        = TagList.First(s => s.Name == "Error");

                _plc.WriteTag(itemMessageReset.AbsoleteItemName, true);
                _plc.WriteTag(itemError.AbsoleteItemName, false);
                _plc.WriteEmptyTextTag(itemErrorList, (_errorList.Length > 0) ? _errorList.Length : 1);

                _errorList = string.Empty;

                int  itemPLCSetOpenValue = 0;
                bool isDigitStatus       = Int32.TryParse(TagList.First(s => s.Name == "PLCSetOpen").CurrentValue, out itemPLCSetOpenValue);

                //определяем управляющую команду перед вызовом журнала ошибок, путем исключеия...
                _command = (itemPLCSetOpenValue == 1) ? Utils.ProcessComand.OpenCell : Utils.ProcessComand.CloseCellFull;

                using (OperationCustomWaitFm operationUCFromError = new OperationCustomWaitFm(_command))
                {
                    if (operationUCFromError.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        _command = operationUCFromError.Return();

                        if (_command == Utils.ProcessComand.CellOpenAgain)
                        {
                            operationInfoLbl.Text = "Выдвинуть ячейку";
                            processInfoBS.EndEdit();
                            var ItemSetOpenAgain = TagList.First(s => s.Name == "SetOpenAgain");
                            _plc.WriteTag(ItemSetOpenAgain.AbsoleteItemName, true);
                        }
                        else
                        {
                            operationInfoLbl.Text = "Вернуть ячейку";
                            processInfoBS.EndEdit();
                            var ItemSetCloseAgain = TagList.First(s => s.Name == "SetCloseAgain");
                            _plc.WriteTag(ItemSetCloseAgain.AbsoleteItemName, true);
                        }
                    }
                }
                waitTimer.Start();

                break;

            default:
                break;
            }
        }