public RemoveFinishForm(ProductsDataSet.ProductsTblRow datarow, ProductsDataSet.DocsTblRow docsRow) :this() { _datarow = datarow; _docsRow = docsRow; }
public ViewProductForm(WorkMode mode, string docId) : this() { _mode = mode; _documentId = docId; switch (_mode) { case WorkMode.SimpleIncome: { DialogResult dr = DialogFrm.ShowMessage( "Возвратные товары выделять и не считать?" , "" , "" , "Режим накладных"); if (dr == DialogResult.Yes) { label17.BackColor = System.Drawing.Color.Turquoise; label5.BackColor = System.Drawing.Color.Turquoise; label6.BackColor = System.Drawing.Color.Turquoise; label7.BackColor = System.Drawing.Color.Turquoise; label8.BackColor = System.Drawing.Color.Turquoise; label9.BackColor = System.Drawing.Color.Turquoise; label20.BackColor = System.Drawing.Color.Turquoise; label21.BackColor = System.Drawing.Color.Turquoise; actionLabel.BackColor = System.Drawing.Color.Turquoise; navCodeTB.BackColor = System.Drawing.Color.Turquoise; _invMode = InventarMode.UseReturns; } else { _invMode = InventarMode.DontUseReturns; } this.label15.Text = "F3-Накл.Закрыть"; Program.СurrentIncomeId = docId; inventRow = ActionsClass.Action.Products.DocsTbl.NewDocsTblRow(); inventRow.DocId = _documentId; inventRow.DocType = (byte)(TSDUtils.ActionCode.SimpleIncome); inventRow.DocumentDate = DateTime.Today; inventRow.LabelCode = (byte)TSDUtils.ShablonCode.NoShablon; inventRow.MusicCode = 5; // docRows.NavCode = row.NavCode; inventRow.Priority = 0; inventRow.Quantity = 0; inventRow.VibroCode = 5; inventRow.Text1 = ""; inventRow.Text2 = ""; inventRow.Text3 = ""; label14.Text = ""; break; } case WorkMode.InventarScan: { DialogResult dr = DialogFrm.ShowMessage( "Возвратные товары выделять и не считать?" , "" , "" , "Режим инвентаризации"); if (dr == DialogResult.Yes) { label17.BackColor = System.Drawing.Color.Turquoise; label5.BackColor = System.Drawing.Color.Turquoise; label6.BackColor = System.Drawing.Color.Turquoise; label7.BackColor = System.Drawing.Color.Turquoise; label8.BackColor = System.Drawing.Color.Turquoise; label9.BackColor = System.Drawing.Color.Turquoise; label20.BackColor = System.Drawing.Color.Turquoise; label21.BackColor = System.Drawing.Color.Turquoise; actionLabel.BackColor = System.Drawing.Color.Turquoise; navCodeTB.BackColor = System.Drawing.Color.Turquoise; _invMode = InventarMode.UseReturns; } else { _invMode = InventarMode.DontUseReturns; } this.label15.Text = "F3-Инв.Закрыть"; Program.СurrentInvId = docId; inventRow = ActionsClass.Action.Products.DocsTbl.NewDocsTblRow(); inventRow.DocId = _documentId; inventRow.DocType = (byte)(TSDUtils.ActionCode.InventoryGlobal); inventRow.DocumentDate = DateTime.Today; inventRow.LabelCode = (byte)TSDUtils.ShablonCode.NoShablon; inventRow.MusicCode = 5; // docRows.NavCode = row.NavCode; inventRow.Priority = 0; inventRow.Quantity = 0; inventRow.VibroCode = 5; inventRow.Text1 = ""; inventRow.Text2 = ""; inventRow.Text3 = ""; label14.Text = ""; break; } case WorkMode.BoxScan: { this.label15.Text = "F3-Выход"; if (Program.Default.EnableChgMlt == 1) this.label14.Text = "F2-Колво"; else this.label14.Text = ""; inventRow = ActionsClass.Action.Products.DocsTbl.NewDocsTblRow(); inventRow.DocId = _documentId; inventRow.DocType = (byte)(TSDUtils.ActionCode.BoxWProducts); inventRow.DocumentDate = DateTime.Today; inventRow.LabelCode = (byte)TSDUtils.ShablonCode.NoShablon; inventRow.MusicCode = 5; // docRows.NavCode = row.NavCode; inventRow.Priority = 0; inventRow.Quantity = 0; inventRow.VibroCode = 5; inventRow.Text1 = ""; inventRow.Text2 = ""; inventRow.Text3 = ""; break; } case WorkMode.ReturnBoxWProducts: { this.label15.Text = "F3-Выход"; if (Program.Default.EnableChgMlt == 1) this.label14.Text = "F2-Колво"; else this.label14.Text = ""; inventRow = ActionsClass.Action.Products.DocsTbl.NewDocsTblRow(); inventRow.DocId = _documentId; inventRow.DocType = (byte)(TSDUtils.ActionCode.ReturnBoxWProducts); inventRow.DocumentDate = DateTime.Today; inventRow.LabelCode = (byte)TSDUtils.ShablonCode.NoShablon; inventRow.MusicCode = 5; // docRows.NavCode = row.NavCode; inventRow.Priority = 0; inventRow.Quantity = 0; inventRow.VibroCode = 5; inventRow.Text1 = ""; inventRow.Text2 = ""; inventRow.Text3 = ""; break; } default: { break; } } currentdocRows = new ProductsDataSet.DocsTblRow[1]; currentdocRows[0] = inventRow; //label13.Text = ""; this.label13.Text = "Уменьш.КОЛВО"; }
void Action_OnActionCompleted(ProductsDataSet.DocsTblRow docsRow, ScannedProductsDataSet.ScannedBarcodesRow scannedRow) { if (this.InvokeRequired) { ActionsClass.ActionCompleted del = new ActionsClass.ActionCompleted(Action_OnActionCompleted); this.Invoke(del, docsRow, scannedRow); } else { this.label18.Text = ""; currentDocRow = docsRow; this.actionLabel.Text = TSDUtils.ActionCodeDescription.ActionDescription[docsRow.DocType]; label20.Text = (scannedRow["PlanQuanity"] == System.DBNull.Value || scannedRow["PlanQuanity"] == null) ? string.Empty : scannedRow.PlanQuanity.ToString(); label21.Text = (scannedRow["FactQuantity"] == System.DBNull.Value || scannedRow["FactQuantity"] == null) ? string.Empty : scannedRow.FactQuantity.ToString(); if (docsRow.DocType == (byte)TSDUtils.ActionCode.BoxWProducts) { //label21.Text = (scannedRow["FactQuantity"] == System.DBNull.Value || // scannedRow["FactQuantity"] == null) ? string.Empty : scannedRow.FactQuantity.ToString(); ScannedProductsDataSet.ScannedBarcodesRow[] rowsS = ActionsClass.Action.FindByDocIdAndDocType(scannedRow.DocId, scannedRow.DocType); int fQty = 0; for (int i = 0; i < rowsS.Length; i++) { if (rowsS[i].Barcode == currentProductRow.Barcode) fQty += rowsS[i].FactQuantity; } label21.Text = fQty.ToString(); if (fQty == scannedRow.PlanQuanity) { ProductsDataSet.DocsTblRow[] docsRows = ActionsClass.Action.GetDataByDocIdAndType(scannedRow.DocId, scannedRow.DocType); int pQuantity = 0; int fQuantity = 0; for (int i = 0; i < docsRows.Length; i++) pQuantity += docsRows[i].Quantity; for (int i = 0; i < rowsS.Length; i++) fQuantity += rowsS[i].FactQuantity; if (pQuantity == fQuantity) { //907218|3001011908672|7|1|8|2011-09-03|7|7|7|907218|002355438|03.09.2011 ProductsDataSet.DocsTblRow[] docsNaklRows = ActionsClass.Action.GetDataByDocIdAndType(scannedRow.DocId, (byte)TSDUtils.ActionCode.IncomeBox); //using (DialogForm dlgfrm = // new DialogForm( DialogResult dr = DialogFrm.ShowMessage( "Короб по накладной" , docsNaklRows[0].Text2 , "принят полностью!" , "Прием товара/nПо нажатию ЭНТЕР ВЫЙТИ в меню");//) ActionsClass.Action.PlaySound(250); //{ if (dr == DialogResult.Yes) { //inventRow.NavCode = row.NavCode; //ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.BoxWProducts, // row, // inventRow // ); } this.navCodeTB.Text = ""; //} } } } this.Refresh(); } }
/// <summary> /// Получить последний открытый короб /// </summary> /// <returns></returns> public ProductsDataSet.DocsTblRow GetActualBoxReturnsDocRow() //string boxBarcode, string returnNumber) { if (ActualBoxReturnsDocRow == null) { if (_scannedProducts.ScannedBarcodes.Rows.Count == 0) OpenScanned(); Dictionary<long, ScannedProductsDataSet.ScannedBarcodesRow> openedDocs = new Dictionary<long, ScannedProductsDataSet.ScannedBarcodesRow>(); //long last_barcode = -1; for (int i = 0; i < _scannedProducts.ScannedBarcodes.Rows.Count; i++) { ScannedProductsDataSet.ScannedBarcodesRow r = (ScannedProductsDataSet.ScannedBarcodesRow)_scannedProducts.ScannedBarcodes.Rows[i]; if ( r.DocType == ((byte)TSDUtils.ActionCode.BoxReturns) ) { openedDocs.Add(r.Barcode, r); //last_barcode = r.Barcode; } if ( r.DocType == ((byte)TSDUtils.ActionCode.CloseBoxReturns) ) { openedDocs.Remove(r.Barcode); } } if (openedDocs.Count > 0) { ScannedProductsDataSet.ScannedBarcodesRow[] r_array = new ScannedProductsDataSet.ScannedBarcodesRow[openedDocs.Count]; openedDocs.Values.CopyTo(r_array, 0); ActualBoxReturnsDocRow = Products.DocsTbl.AddDocsTblRow( r_array[0].Barcode.ToString(), r_array[0].Barcode.ToString(), ((byte)TSDUtils.ActionCode.BoxReturns), 0, 0, DateTime.Now, ((byte)TSDUtils.ActionCode.BoxReturns), ((byte)TSDUtils.ActionCode.BoxReturns), ((byte)TSDUtils.ActionCode.BoxReturns), r_array[0].DocId, string.Empty, string.Empty); return ActualBoxReturnsDocRow; } else return null; // ActualBoxReturnsDocRow = // GetDataByNavcodeDocIdAndType // ( // boxBarcode, // boxBarcode, // (byte)((byte)TSDUtils.ActionCode.BoxReturns)); // if (ActualBoxReturnsDocRow != null) // return ActualBoxReturnsDocRow; // else // { // ActualBoxReturnsDocRow = // Products.DocsTbl.AddDocsTblRow( // boxBarcode, // boxBarcode, // ((byte)TSDUtils.ActionCode.BoxReturns), // 0, // 0, // DateTime.Now, // ((byte)TSDUtils.ActionCode.BoxReturns), // ((byte)TSDUtils.ActionCode.BoxReturns), // ((byte)TSDUtils.ActionCode.BoxReturns), // returnNumber, // string.Empty, // string.Empty); // return ActualBoxReturnsDocRow; // } //} //else //return ActualBoxReturnsDocRow; //string Navcode, string DocId, byte docType) //this.columnNavCode.MaxLength = 13; //this.columnDocId.AllowDBNull = false; //this.columnDocId.MaxLength = 20; //this.columnDocType.AllowDBNull = false; //this.columnText1.MaxLength = 20; //this.columnText2.MaxLength = 20; //this.columnText3.MaxLength = 20; //ProductsDataSet.DocsTblRow docsRow = // Products.DocsTbl.AddDocsTblRow( } else return ActualBoxReturnsDocRow; }
/// <summary> /// Закрытыие короба /// </summary> /// <param name="boxBarcode">ШК короба</param> /// <param name="returnNumber">Номер возврата</param> public void CloseReturnBoxAction(string boxBarcode, string returnNumber) { ScannedProductsDataSet.ScannedBarcodesRow[] scannedrow = _scannedProducts.ScannedBarcodes.FindByDocIdAndDocType(boxBarcode, (byte)TSDUtils.ActionCode.CloseBoxReturns); if (scannedrow == null || scannedrow.Length == 0) { ScannedProductsDataSet.ScannedBarcodesRow r1 = AddScannedRow(long.Parse(boxBarcode), ((byte)TSDUtils.ActionCode.CloseBoxReturns) , returnNumber ,0 , byte.MaxValue); } else { //for (int i = 0; i < scannedrow.Length; i++) //{ // scannedrow[i].Priority = byte.MaxValue; //} throw new ApplicationException(string.Format( "Короб {0} уже закрыт",boxBarcode)); } { string s = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", boxBarcode, returnNumber, ((byte)TSDUtils.ActionCode.CloseBoxReturns), 0, DateTime.Today.ToString("dd.MM.yyyy"), Program.Default.TerminalID, byte.MaxValue, 0 ); byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n")); writer.Write(buff, 0, buff.Length); writer.Flush(); ActualBoxReturnsDocRow = null; } }
/// <summary> /// создать новую запись короба /// </summary> /// <param name="boxBarcode">ШК короба</param> /// <param name="returnNumber">№возврата</param> /// <returns>строка нового типа документа</returns> public ProductsDataSet.DocsTblRow CreateNewReturnBox(string boxBarcode, string returnNumber) { try { DoScanEvents = false; ScannedProductsDataSet.ScannedBarcodesRow r1 = AddScannedRow(long.Parse(boxBarcode), ((byte)TSDUtils.ActionCode.BoxReturns) , returnNumber, 0, 0); ActualBoxReturnsDocRow = Products.DocsTbl.AddDocsTblRow( boxBarcode, boxBarcode, ((byte)TSDUtils.ActionCode.BoxReturns), 0, 0, DateTime.Now, ((byte)TSDUtils.ActionCode.BoxReturns), ((byte)TSDUtils.ActionCode.BoxReturns), ((byte)TSDUtils.ActionCode.BoxReturns), returnNumber, string.Empty, string.Empty); string s = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", boxBarcode, returnNumber, ((byte)TSDUtils.ActionCode.BoxReturns), 0, DateTime.Today.ToString("dd.MM.yyyy"), Program.Default.TerminalID, 0, 0 ); byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, "\r\n")); //byte[] buff = System.Text.Encoding.UTF8.GetBytes(string.Concat(s, '\n')); //byte[] buff = new byte[] { 0xD, 0xA }; writer.Write(buff, 0, buff.Length); writer.Flush(); } finally { DoScanEvents = true; } return ActualBoxReturnsDocRow; //return GetActualBoxReturnsDocRow(boxBarcode, returnNumber); }