Ejemplo n.º 1
0
 private void txtScan_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         DataRow products_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
         if (products_row == null)
         {
             MessageBox.Show("Barcode Not Recognized!");
             return;
         }
         if (products_row["product"].ToString() != lblProduct.Text)
         {
             MessageBox.Show("Barcode Not Recognized!\nNot the same product ID");
             return;
         }
         if (products_row["MATCHED_UOM"].ToString() != lblUOM.Text)
         {
             MessageBox.Show("Barcode Not Recognized!\nPlease scan the requested UOM.");
             return;
         }
         scanned_grid.Rows.Clear();
         scanqty += 1;
         scanned_grid.Rows.Add(products_row["product"], scanqty, products_row["MATCHED_UOM"], productsupportdetail["lotno"], productsupportdetail["expiry"], "STAGING IN");
     }
 }
Ejemplo n.º 2
0
        private void txtScan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var product_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
                if (product_row == null)
                {
                    MessageBox.Show("Barcode not recognized");
                    return;
                }

                product = product_row["PRODUCT"].ToString();
                uom     = product_row["MATCHED_UOM"].ToString();

                DialogResult = DialogResult.OK;
            }
        }
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    DataRow products_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
                    if (products_row == null)
                    {
                        throw new Exception("Barcode Not Recognized!");
                    }

                    String product = products_row["PRODUCT"].ToString();
                    String uom     = products_row["MATCHED_UOM"].ToString();

                    DataTable lotsDt = new DataTable();
                    lotsDt.Columns.Add("Lot No");
                    lotsDt.Columns.Add("Expiry");

                    foreach (DataGridViewRow row in putaway_details_grid.Rows)
                    {
                        if (row.Cells["product"].Value.ToString() == product &&
                            row.Cells["uom"].Value.ToString() == uom &&
                            int.Parse(row.Cells["Quantity"].Value.ToString()) > 0
                            )
                        {
                            lotsDt.Rows.Add(row.Cells["Lot No"].Value.ToString(), row.Cells["Expiry"].Value.ToString());
                        }
                    }

                    if (lotsDt.Rows.Count == 0)
                    {
                        throw new Exception("Scanned item not recognized!");
                    }
                    SelectGridWindow select_dialog = new SelectGridWindow();
                    select_dialog.dataGridView1.DataSource = lotsDt;


                    if (select_dialog.ShowDialog() == DialogResult.OK)
                    {
                        var selected_row = select_dialog.dataGridView1.SelectedRows[0];

                        List <DataGridViewRow> for_deletion = new List <DataGridViewRow>();
                        foreach (DataGridViewRow row in putaway_details_grid.Rows)
                        {
                            if (row.Cells["product"].Value.ToString() == product &&
                                row.Cells["uom"].Value.ToString() == uom &&
                                row.Cells["Lot No"].Value.ToString() == selected_row.Cells["Lot No"].Value.ToString() &&
                                row.Cells["Expiry"].Value.ToString() == selected_row.Cells["Expiry"].Value.ToString()
                                )
                            {
                                row.Cells["Quantity"].Value = int.Parse(row.Cells["Quantity"].Value.ToString()) - 1;
                                if (int.Parse(row.Cells["Quantity"].Value.ToString()) <= 0)
                                {
                                    for_deletion.Add(row);
                                }

                                Boolean is_existing = false;
                                foreach (DataGridViewRow return_row in returns_grid.Rows)
                                {
                                    if (return_row.Cells["product"].Value.ToString() == product &&
                                        return_row.Cells["uom"].Value.ToString() == uom &&
                                        return_row.Cells["lot_no"].Value.ToString() == selected_row.Cells["Lot No"].Value.ToString() &&
                                        return_row.Cells["expiry"].Value.ToString() == selected_row.Cells["Expiry"].Value.ToString()
                                        )
                                    {
                                        return_row.Cells["Quantity"].Value = int.Parse(return_row.Cells["Quantity"].Value.ToString()) + 1;
                                        is_existing = true;
                                    }
                                }

                                if (!is_existing)
                                {
                                    returns_grid.Rows.Add(product, uom, selected_row.Cells["Lot No"].Value.ToString(), selected_row.Cells["Expiry"].Value.ToString(), 1);
                                }
                            }
                        }
                        foreach (DataGridViewRow row in for_deletion)
                        {
                            putaway_details_grid.Rows.Remove(row);
                        }

                        txtScan.Text = "";
                        txtScan.Focus();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        private void txtScan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (txtReleaseTo.Text.Trim() == "" ||
                    txtReleaseToPerson.Text.Trim() == "" ||
                    txtTripReference.Text.Trim() == ""
                    )
                {
                    MessageBox.Show("Fill out details first");
                    txtScan.Text = "";
                    return;
                }


                var product_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
                if (product_row == null)
                {
                    MessageBox.Show("Barcode Not Recognized");
                    return;
                }
                String product = product_row["PRODUCT"].ToString();
                String uom     = product_row["MATCHED_UOM"].ToString();

                DataTable dt = DataSupport.RunDataSet("SELECT Product,Uom, lot_no[Lot No],Expiry, Qty FROM ForDisposals WHERE trans_id = @picklist_id AND product=@product AND @uom = @uom", "picklist_id", txtPicklistID.Text, "product", product, "uom", uom).Tables[0];

                SelectGridWindow dialog = new SelectGridWindow();
                dialog.dataGridView1.DataSource = dt;
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var selected_row = dialog.dataGridView1.SelectedRows[0];

                String expiry = selected_row.Cells["Expiry"].Value.ToString();
                String lot_no = selected_row.Cells["Lot No"].Value.ToString();

                List <DataGridViewRow> for_transfer = new List <DataGridViewRow>();
                foreach (DataGridViewRow row in for_scanning_grid.Rows)
                {
                    if (row.Cells["Product"].Value.ToString().ToUpper() == product.ToUpper() &&
                        row.Cells["Uom"].Value.ToString().ToUpper() == uom.ToUpper() &&
                        row.Cells["Expiry"].Value.ToString().ToUpper() == expiry.ToUpper() &&
                        row.Cells["Lot No"].Value.ToString().ToUpper() == lot_no.ToUpper()
                        )
                    {
                        for_transfer.Add(row);
                    }
                }

                foreach (DataGridViewRow row in for_transfer)
                {
                    List <Object> list = new List <object>();
                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        list.Add(cell.Value.ToString());
                    }

                    scanned_grid.Rows.Add(list.ToArray());

                    for_scanning_grid.Rows.Remove(row);
                }
            }
        }
Ejemplo n.º 5
0
        private void txtContainer_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                // Check if the barcode is recognized
                product_row = BarcodeSupport.GetProductFromBarcode(txtContainer.Text);
                if (product_row == null)
                {
                    MessageBox.Show("Barcode not recognized");
                    return;
                }

                // If it's recognized, get staging area items
                DataTable dt = DataSupport.RunDataSet("SELECT * FROM LocationProductsLedger WHERE location = 'STAGING-IN' AND product = '" + product_row["PRODUCT"] + "' AND uom = '" + product_row["MATCHED_UOM"] + "' AND qty > 0").Tables[0];

                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("Item is not declared in the STAGING-IN area");
                    return;
                }

                List <DataRow> for_deletion = new List <DataRow>();
                foreach (DataRow row in dt.Rows)
                {
                    row["expiry"] = DateTime.Parse(row["expiry"].ToString()).ToShortDateString();
                    foreach (DataGridViewRow existing_row in header_grid.Rows)
                    {
                        if (
                            existing_row.Cells["product"].Value.ToString() == row["product"].ToString() &&
                            existing_row.Cells["uom"].Value.ToString() == row["uom"].ToString() &&
                            existing_row.Cells["lot"].Value.ToString() == row["lot_no"].ToString() &&
                            existing_row.Cells["expiry"].Value.ToString() == row["expiry"].ToString()
                            )
                        {
                            int qty     = int.Parse(existing_row.Cells["Quantity"].Value.ToString());
                            var new_qty = int.Parse(row["qty"].ToString()) - qty;
                            row["qty"] = new_qty;
                            if (new_qty <= 0)
                            {
                                for_deletion.Add(row);
                            }
                        }
                    }
                }
                foreach (DataRow row in for_deletion)
                {
                    dt.Rows.Remove(row);
                }


                // Ask which of the staging area items
                SelectGridWindow dialog = new SelectGridWindow();
                dialog.dataGridView1.DataSource = dt;
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("Items is already scanned in the STAGING-IN area");
                    return;
                }
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                lot_row      = dialog.dataGridView1.SelectedRows[0];
                DialogResult = DialogResult.OK;
            }
        }
Ejemplo n.º 6
0
        private void txtScan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                DataRow products_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
                if (products_row == null)
                {
                    MessageBox.Show("Barcode Not Recognized!");
                    return;
                }

                String product = products_row["PRODUCT"].ToString();
                String uom     = products_row["MATCHED_UOM"].ToString();

                DataTable lotsDt = new DataTable();
                lotsDt.Columns.Add("Lot No");
                lotsDt.Columns.Add("Expiry");
                lotsDt.Columns.Add("Location");

                foreach (DataGridViewRow row in picklist_details_grid.Rows)
                {
                    if (row.Cells["product"].Value.ToString() == product &&
                        row.Cells["uom"].Value.ToString().Replace("PIECES", "PCS") == uom.Replace("PIECES", "PCS") &&
                        int.Parse(row.Cells["Quantity"].Value.ToString()) > 0
                        )
                    {
                        lotsDt.Rows.Add(row.Cells["Lot No"].Value.ToString(), row.Cells["Expiry"].Value.ToString(), row.Cells["Location"].Value.ToString());
                    }
                }

                if (lotsDt.Rows.Count == 0)
                {
                    MessageBox.Show("Scanned item not recognized!");
                    return;
                }
                SelectGridWindow select_dialog = new SelectGridWindow();
                select_dialog.dataGridView1.DataSource = lotsDt;
                if (select_dialog.ShowDialog() == DialogResult.OK)
                {
                    DeclareCaseBreakPCS cbpcs_dialog = new DeclareCaseBreakPCS();
                    cbpcs_dialog.lblProduct.Text = product;
                    Dictionary <String, String> productbreakdetails = getProductSupportDetail(product, uom, select_dialog.dataGridView1.SelectedRows[0]);
                    cbpcs_dialog.lblUOM.Text          = productbreakdetails["breakto"];
                    cbpcs_dialog.productsupportdetail = productbreakdetails;
                    cbpcs_dialog.parent = this;

                    if (cbpcs_dialog.ShowDialog() == DialogResult.OK)
                    {
                        var selected_row = select_dialog.dataGridView1.SelectedRows[0];

                        List <DataGridViewRow> for_deletion = new List <DataGridViewRow>();
                        foreach (DataGridViewRow row in picklist_details_grid.Rows)
                        {
                            if (row.Cells["product"].Value.ToString() == product &&
                                row.Cells["uom"].Value.ToString().Replace("PIECES", "PCS") == uom.Replace("PIECES", "PCS") &&
                                row.Cells["Lot No"].Value.ToString() == selected_row.Cells["Lot No"].Value.ToString() &&
                                row.Cells["Expiry"].Value.ToString() == selected_row.Cells["Expiry"].Value.ToString() &&
                                row.Cells["Location"].Value.ToString() == selected_row.Cells["Location"].Value.ToString()
                                )
                            {
                                row.Cells["Quantity"].Value = int.Parse(row.Cells["Quantity"].Value.ToString()) - 1;
                                if (int.Parse(row.Cells["Quantity"].Value.ToString()) <= 0)
                                {
                                    for_deletion.Add(row);
                                }

                                Boolean is_existing = false;
                                foreach (DataGridViewRow scanned_row in scanned_grid.Rows)
                                {
                                    if (scanned_row.Cells["product"].Value.ToString() == product &&
                                        scanned_row.Cells["uom"].Value.ToString().Replace("PIECES", "PCS") == uom.Replace("PIECES", "PCS") &&
                                        scanned_row.Cells["lot_no"].Value.ToString() == selected_row.Cells["Lot No"].Value.ToString() &&
                                        scanned_row.Cells["expiry"].Value.ToString() == selected_row.Cells["Expiry"].Value.ToString() &&
                                        scanned_row.Cells["original_location"].Value.ToString() == selected_row.Cells["Location"].Value.ToString()
                                        )
                                    {
                                        scanned_row.Cells["qty"].Value = int.Parse(scanned_row.Cells["qty"].Value.ToString()) + 1;
                                        is_existing = true;
                                    }
                                }

                                if (!is_existing)
                                {
                                    scanned_grid.Rows.Add(product, 1, uom, selected_row.Cells["Lot No"].Value.ToString(), selected_row.Cells["Expiry"].Value.ToString(), "STAGING-OUT", selected_row.Cells["Location"].Value.ToString());
                                }
                                break;
                            }
                        }
                        scanned_grid_details.Rows.Clear();
                        foreach (DataRow dRow in casebreak_detailscan.Rows)
                        {
                            scanned_grid_details.Rows.Add(dRow["product"], dRow["qty"], dRow["uom"], dRow["lotno"], dRow["expiry"], dRow["location"]);
                        }

                        foreach (DataGridViewRow row in for_deletion)
                        {
                            picklist_details_grid.Rows.Remove(row);
                        }

                        txtScan.Text = "";
                        txtScan.Focus();
                        SyncSaveButton();
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void txtScan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var product_row = BarcodeSupport.GetProductFromBarcode(txtScan.Text);
                if (product_row == null)
                {
                    MessageBox.Show("Barcode Not Recognized");
                    return;
                }
                String product = product_row["PRODUCT"].ToString();
                String uom     = product_row["MATCHED_UOM"].ToString();

                DataTable dt = DataSupport.RunDataSet("SELECT order_id[Order], Product, Expiry, lot_no[Lot No], order_qty[Order Qty], Uom, Scanned_qty[Scanned Qty], scanned_on [Scanned On] FROM ReleaseDetailItems WHERE release = @release AND order_id = @order_id AND product=@product AND @uom = @uom", "release", release_id, "order_id", current_order, "product", product, "uom", uom).Tables[0];

                SelectGridWindow dialog = new SelectGridWindow();
                dialog.dataGridView1.DataSource = dt;
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var selected_row = dialog.dataGridView1.SelectedRows[0];

                String expiry = selected_row.Cells["Expiry"].Value.ToString();
                String lot_no = selected_row.Cells["Lot No"].Value.ToString();


                String sql = "";

                sql += " UPDATE ReleaseDetailItems SET Scanned_qty = Scanned_qty +1 WHERE release = '" + release_id + "' AND order_id = '" + current_order + "' AND product='" + product + "' AND uom = '" + uom + "' AND expiry = '" + expiry + "' AND lot_no='" + lot_no + "'  ";


                // Update Transaction Ledger
                {
                    // Out with the location
                    DataTable outsDT = LedgerSupport.GetLocationLedgerDT();

                    outsDT.Rows.Add("STAGING-OUT", now, "OUT", "RELEASE", release_id);

                    sql += LedgerSupport.UpdateLocationLedger(outsDT);

                    // In with both Staging out and for resolution
                    DataTable insDT = LedgerSupport.GetLocationLedgerDT();

                    insDT.Rows.Add("RELEASED", now, "IN", "PICKLIST_DECLARE_COMPLETE", release_id);
                    sql += LedgerSupport.UpdateLocationLedger(insDT);
                }
                // Update Location Products Ledger
                {
                    // Out with the staging out
                    DataTable outsDT = LedgerSupport.GetLocationProductsLedgerDT();

                    outsDT.Rows.Add("STAGING-OUT", product, -1, uom, lot_no, expiry);


                    sql += LedgerSupport.UpdateLocationProductsLedger(outsDT);

                    DataTable insDT = LedgerSupport.GetLocationProductsLedgerDT();
                    insDT.Rows.Add("RELEASED", product, 1, uom, lot_no, expiry);


                    sql += LedgerSupport.UpdateLocationProductsLedger(insDT);
                }

                DataSupport.RunNonQuery(sql, IsolationLevel.ReadCommitted);

                SynchroSupport.UpdateOrderStatus(release_id);
                LoadData();
            }
        }