示例#1
0
        private void HandleRfid
        (
            [NotNull] string rfid
        )
        {
            _goodRecord = null;
            SetStatus(new bool?());
            _descriptionBox.Clear();
            PodsobRecord podsob = Kladovka.FindPodsobByBarcode(rfid);

            if (!ReferenceEquals(podsob, null) &&
                !ReferenceEquals(podsob.Record, null))
            {
                _descriptionBox.Text = podsob.Record.Description;

                bool status = CheckPodsob(rfid, podsob);
                SetStatus(status);
                if (status)
                {
                }
            }
            else
            {
                SetStatus(false);
            }
        }
示例#2
0
        private void _rfidBox_KeyDown
        (
            object sender,
            KeyEventArgs e
        )
        {
            if (e.KeyCode == Keys.Enter)
            {
                _goodRecord        = null;
                e.SuppressKeyPress = true;

                string text = _placeBox.Text.Trim();
                if (string.IsNullOrEmpty(text))
                {
                    MessageBox.Show("Не указано место хранения!");
                    return;
                }

                text = _rfidBox.Text.Trim();
                if (!string.IsNullOrEmpty(text))
                {
                    HandleRfid(text);
                }
                _rfidBox.Clear();
                _rfidBox.Focus();
            }
        }
示例#3
0
        private void _confirmButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            StatusRecord status = _goodRecord;

            if (ReferenceEquals(status, null))
            {
                return;
            }

            long         inventory = _goodRecord.Inventory;
            StatusRecord found     = _bindingList.FirstOrDefault
                                     (
                item => item.Inventory == inventory
                                     );

            if (!ReferenceEquals(found, null))
            {
                WriteLine("Уже отмечено: {0}", inventory);

                return;
            }

            WriteLine("Помечаем: {0}", inventory);
            RecordField field = status.Field;

            field.SetSubField('d', status.Place);
            field.SetSubField('s', IrbisDate.TodayText);
            field.SetSubField('!', status.Place);
            Kladovka.Connection.WriteRecord(status.Record);

            _bindingList.Add(_goodRecord);

            _descriptionBox.Clear();
            SetStatus(new bool?());

            _goodRecord = null;
        }
示例#4
0
        private bool CheckPodsob
        (
            [NotNull] string rfid,
            [NotNull] PodsobRecord podsob
        )
        {
            Code.NotNull(podsob, "podsob");

            bool usePodsob = podsob.Inventory != 0;

            string place = _placeBox.Text.Trim();

            if (string.IsNullOrEmpty(place))
            {
                WriteLine("Не задано место хранения!");

                return(false);
            }

            if (usePodsob && !string.IsNullOrEmpty(podsob.Ticket) &&
                !podsob.Ticket.SameString(place))
            {
                WriteLine
                (
                    "Место хранения не совпадает: {0}",
                    podsob.Ticket.ToVisibleString()
                );

                return(false);
            }

            if (usePodsob && !string.IsNullOrEmpty(podsob.OnHand))
            {
                WriteLine
                (
                    "Книга числится за {0}",
                    podsob.OnHand.ToVisibleString()
                );

                return(false);
            }

            if (usePodsob && !string.IsNullOrEmpty(podsob.Sigla) &&
                !place.SameString(podsob.Sigla))
            {
                WriteLine
                (
                    "Не совпадает сигла: {0}",
                    podsob.Sigla.ToVisibleString()
                );

                return(false);
            }

            MarcRecord  record = podsob.Record.ThrowIfNull("podsob.Record");
            RecordField field  = record.Fields
                                 .GetField(910)
                                 .FirstOrDefault
                                 (
                f => rfid.SameString(f.GetFirstSubFieldValue('b')) ||
                rfid.SameString(f.GetFirstSubFieldValue('h')) ||
                rfid.SameString(f.GetFirstSubFieldValue('t'))
                                 );

            if (ReferenceEquals(field, null))
            {
                WriteLine("Не найден экземпляр: {0}", rfid);

                return(false);
            }

            string status = field.GetFirstSubFieldValue('a');

            if (!status.SameString("0"))
            {
                WriteLine
                (
                    "Неожиданный статус: {0}",
                    status.ToVisibleString()
                );

                return(false);
            }

            string inventory = field.GetFirstSubFieldValue('b');

            if (string.IsNullOrEmpty(inventory))
            {
                WriteLine
                (
                    "Инвентарный номер: {0}",
                    inventory.ToVisibleString()
                );

                return(false);
            }
            if (usePodsob &&
                !inventory.SameString(podsob.Inventory.ToInvariantString()))
            {
                WriteLine
                (
                    "Инвентарный номер не совпадает: {0} и {1}",
                    podsob.Inventory,
                    inventory
                );

                return(false);
            }

            string fieldPlace = field.GetFirstSubFieldValue('d');

            if (!string.IsNullOrEmpty(fieldPlace) &&
                !place.SameString(fieldPlace))
            {
                WriteLine
                (
                    "Не совпадает место хранения: {0}",
                    fieldPlace.ToVisibleString()
                );

                return(false);
            }

            _goodRecord = new StatusRecord
            {
                Inventory   = podsob.Inventory,
                Record      = record,
                Description = record.Description,
                Field       = field,
                Place       = place
            };

            return(true);
        }