protected override void OnReadBarCode(string Code, string OriginalCode) { switch (task.Kind) { case TaskKind.In: { ((InputTask)task).ReadBarCode(Code); if (task.number > -1) { if (!notConfirmation) { if (!DialogShowed) { l_name.Text = ((InputTask)task).vName; l_code.Text = ((InputTask)task).vCode; tb_count.Text = ((InputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); savedRowNumber = task.number; DialogShowed = true; AutoSave(); } else { if (l_code.Text == ((InputTask)task).vCode) { l_name.Text = ((InputTask)task).vName; l_code.Text = ((InputTask)task).vCode; int prevValue = 0; if (IntTryParse(tb_count.Text, out prevValue)) { int newValue = 0; if (IntTryParse(((InputTask)task).vCount, out newValue)) { tb_count.Text = (prevValue + newValue).ToString(); } } else { tb_count.Text = ((InputTask)task).vCount; } savedRowNumber = task.number; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); AutoSave(); } else { var currentRowNumber = task.number; task.number = savedRowNumber; ((InputTask)task).CountEntered(tb_count.Text); task.number = currentRowNumber; savedRowNumber = task.number; l_name.Text = ((InputTask)task).vName; l_code.Text = ((InputTask)task).vCode; tb_count.Text = ((InputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); AutoSave(); } } } else { ((InputTask)task).CountEntered("1"); dataGrid1.CurrentCell = new DataGridCell(((InputTask)task).vGridRow, 0); dataGrid1.Focus(); AutoSave(); } } } break; case TaskKind.Out: { ((OutputTask)task).ReadBarCode(Code); if (((OutputTask)task).vGridRow > -1) { if (!notConfirmation) { l_name.Text = ((OutputTask)task).vName; l_code.Text = ((OutputTask)task).vCode; l_count_doc.Text = ((OutputTask)task).vCountDoc; tb_count.Text = ((OutputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } else { ((OutputTask)task).CountEntered("1"); if (((OutputTask)task).vGridRow > -1) { dataGrid1.Focus(); dataGrid1.CurrentCell = new DataGridCell(((OutputTask)task).vGridRow, 0); AutoSave(); } } } } break; case TaskKind.Recalc: { if (!((RecalcTask)task).ReadBarCode(Code)) { Beeper.MessageBeep(); } if (!notConfirmation) { l_name.Text = ((RecalcTask)task).vName; l_code.Text = ((RecalcTask)task).vCode; tb_count.Text = ((RecalcTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } else { ((RecalcTask)task).CountEntered("1"); dataGrid1.CurrentCell = new DataGridCell(((RecalcTask)task).vGridRow, 0); dataGrid1.Focus(); AutoSave(); } } break; } }
/// <summary> /// Считан код /// </summary> /// <param name="Code">The code.</param> protected override void OnReadBarCode(string Code, string OriginalCode) { switch (task.Kind) { case TaskKind.In: { ((InputTask)task).ReadBarCode(Code); l_name.Text = ((InputTask)task).vName; l_code.Text = ((InputTask)task).vCode; tb_count.Text = ((InputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } break; case TaskKind.Out: { ((OutputTask)task).ReadBarCode(Code); if (((OutputTask)task).vGridRow > -1) { l_name.Text = ((OutputTask)task).vName; l_code.Text = ((OutputTask)task).vCode; l_count_doc.Text = ((OutputTask)task).vCountDoc; tb_count.Text = ((OutputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } } break; case TaskKind.CheckOut: { ((CheckOutputTask)task).ReadBarCode(Code); if (((CheckOutputTask)task).vGridRow > -1) { l_name.Text = ((CheckOutputTask)task).vName; l_code.Text = ((CheckOutputTask)task).vCode; l_count_doc.Text = ((CheckOutputTask)task).vCountDoc; tb_count.Text = ((CheckOutputTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } } break; case TaskKind.Recalc: { if (!((RecalcTask)task).ReadBarCode(Code)) { Beeper.MessageBeep(16); Beeper.MessageBeep(16); Beeper.MessageBeep(16); } if (!notConfirmation) { l_name.Text = ((RecalcTask)task).vName; l_code.Text = ((RecalcTask)task).vCode; tb_count.Text = ((RecalcTask)task).vCount; l_count_doc.Text = ((RecalcTask)task).place; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } else { ((RecalcTask)task).CountEntered("1"); dataGrid1.CurrentCell = new DataGridCell(((RecalcTask)task).vGridRow, 0); dataGrid1.Focus(); // AutoSave(); } } break; case TaskKind.InSup: { ((InputFromSupplierTask)task).ReadBarCode(Code); l_name.Text = ((InputFromSupplierTask)task).vName; l_code.Text = ((InputFromSupplierTask)task).vCode; tb_count.Text = ((InputFromSupplierTask)task).vCount; panel1.Location = new Point(0, 38); tb_count.SelectAll(); tb_count.Focus(); } break; } }