private void showReal() { var dr = DataTableEx.FindRowInTable(dataTable, unitCode, "КодЕИ"); if (dr != null) { showReal(dr); } }
private void OnEnterToActTextbox(object obj, EventArgs e) { if (!actedLabel.Visible) { return; } bool cancel = false; if (!Number.IsNumber(actedTextBox.Text)) { cancel = true; } int count = Convert.ToInt32(actedTextBox.Text); var dr = DataTableEx.FindRowInTable(dataTable, unitCode, "КодЕИ"); if (((double)(dr["КоличествоЕдиницПоУмолчанию"])) <= count) { ShowMessage(string.Format("Введенное значение - {0} превышает допустимое - {1}", count, ((double)(dr["КоличествоЕдиницПоУмолчанию"])) - 1)); return; } cancel = count == 0; actedLabel.Hide(); actedTextBox.Hide(); uniqueCodeText = 0; if (cancel) { return; } var newR = dataTable.NewRow(); newR["КодЕИ"] = dr["КодЕИПоУмолчанию"]; newR["КодЕИПоУмолчанию"] = 0; newR["План"] = dr["КоличествоЕдиницПоУмолчанию"]; newR["Факт"] = System.Convert.ToInt32(newR["План"]) - count; newR["УникальныйНомер"] = unqueCode; newR["КоличествоЕдиницПоУмолчанию"] = 1; dataTable.Rows.InsertAt(newR, dataTable.Rows.IndexOf(dr) + 1); showReal(dr); }
private void OnUniqueCode() { var existDr = DataTableEx.FindRowInTable(dataTable, unqueCode, "УникальныйНомер"); if (existDr != null) { if (ShowQuery(string.Format("Удалить паллету из прихода (уникальный код = {0})?", unqueCode))) { var dr = DataTableEx.FindRowInTable(dataTable, unitCode, "КодЕИ"); dataTable.Rows.Remove(existDr); showReal(dr); } return; } uniqueCodeText = unqueCode; actedLabel.Show(); actedTextBox.Text = "1"; actedTextBox.Show(); actedTextBox.SelectionStart = 0; actedTextBox.SelectionLength = 1; actedTextBox.Focus(); }
public override void OnBarcode(string Barcode) { if (processStep == Steps.DocumentSelecting) { return; } bool isUniqueCode = false; int asterixIndex = 0; #region Получение кода единицы измерения, уник. кода if (Barcode.Length > 8 && Barcode.Substring(0, 3) == "SB_" && Barcode.IndexOf('.') > 0) { bool isWrongFormat = false; if (Barcode.Substring(3, 5) != "UNIT.") { isWrongFormat = true; } else { string barBody = Barcode.Substring(8, Barcode.Length - 8); asterixIndex = barBody.IndexOf('*'); if (asterixIndex == -1) { if (!Number.IsNumber(barBody)) { isWrongFormat = true; } else { unitCode = Convert.ToUInt64(barBody); } } else { isUniqueCode = true; string unitCodeStr = barBody.Substring(0, asterixIndex); string uniqueCodeStr = barBody.Substring(asterixIndex + 1, barBody.Length - asterixIndex - 1); if (!Number.IsNumber(unitCodeStr) || !Number.IsNumber(uniqueCodeStr)) { isWrongFormat = true; } else { unitCode = Convert.ToUInt64(unitCodeStr); unqueCode = Convert.ToUInt64(uniqueCodeStr); } } } if (isWrongFormat) { ShowMessage("Неверный тип штрих-кода, ожидается единица измерения расх. мат."); return; } } else { PerformQuery("НайтиКодЕдИзм", Barcode); if (ResultParameters == null || ResultParameters[0] == null) { return; } unitCode = Convert.ToUInt64(ResultParameters[0] as string); if (unitCode == 0) { ShowMessage("Штрих-код не найден среди единиц измерения расходных материалов."); return; } } #endregion var dr = DataTableEx.FindRowInTable(dataTable, unitCode, "КодЕИ"); if (dr == null) { ShowMessage("Данного товара нет в плане прихода!"); return; } if (isUniqueCode) { OnUniqueCode(); } else { dr["Факт"] = ((int)(dr["Факт"])) + 1; } currentRow = dr; showReal(dr); }