示例#1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            DataTable dt = FAQ.GetOMSIncoming();

            SelectGridWindow dialog = new SelectGridWindow();

            dialog.dataGridView1.DataSource = dt;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                // Load Header
                var header_row = dialog.dataGridView1.SelectedRows[0];

                txtReceivedFrom.Text      = header_row.Cells["client"].Value.ToString();
                txtReferenceDocument.Text = header_row.Cells["document_reference"].Value.ToString();


                // Load Details
                {
                    DataTable detail_dt = FAQ.GetOMSIncomingDetails(dialog.dataGridView1.SelectedRows[0].Cells[0].Value.ToString());

                    foreach (DataRow row in detail_dt.Rows)
                    {
                        headerGrid.Rows.Add(row["Product"], row["Product"], row["expected_qty"], row["Uom"], row["lot_no"], row["expiry"], "");
                    }
                }

                oms_shipment_id = dialog.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            }
        }
示例#2
0
        private void btnChangeLocation_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = items_grid.SelectedRows[0];

            DataTable        dt     = DataSupport.RunDataSet(@"SELECT location_id[Location], ISNULL((
	                                                                SELECT qty FROM LocationProductsLedger
	                                                                WHERE location = location_id
	                                                                      AND product = '"     + row.Cells["Product"].Value.ToString() + @"'
		                                                                  AND uom = '"         + row.Cells["Uom"].Value.ToString() + @"'
		                                                                  AND lot_no = '"         + row.Cells["Lot No"].Value.ToString() + @"'
		                                                                  and expiry='"         + row.Cells["Expiry"].Value.ToString() + @"'
                                                                ),0)[Qty]
                                                                FROM Locations        
                                                                WHERE type = 'STORAGE' 
                                                
                                                        ").Tables[0];
            SelectGridWindow dialog = new SelectGridWindow();

            dialog.dataGridView1.DataSource = dt;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                row.Cells["Putaway To"].Value = dialog.dataGridView1.SelectedRows[0].Cells["Location"].Value.ToString();
            }
        }
示例#3
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            String location = txtLocation.Text;

            DataTable dt = DataSupport.RunDataSet(@"SELECT Product,(SELECT description FROM Products WHERE product_id = product)[Description], Qty, Uom, lot_no[Lot No], Expiry 
                                                    FROM LocationProductsLedger
                                                    WHERE location = '" + location + @"' 
                                                      AND qty >0").Tables[0];


            SelectGridWindow dialog = new SelectGridWindow();

            dialog.dataGridView1.DataSource = dt;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                txtLocation.Enabled = false;
                var row = dialog.dataGridView1.SelectedRows[0];
                txtProduct.Text     = row.Cells["Product"].Value.ToString();
                txtDescription.Text = row.Cells["Description"].Value.ToString();
                txtUom.Text         = row.Cells["Uom"].Value.ToString();
                txtLotNo.Text       = row.Cells["Lot No"].Value.ToString();
                txtExpiry.Text      = DateTime.Parse(row.Cells["Expiry"].Value.ToString()).ToShortDateString();
            }
        }
        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);
                }
            }
        }
        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;
            }
        }
示例#7
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();
                    }
                }
            }
        }
        private void btnDeclareUnexpectedProduct_Click(object sender, EventArgs e)
        {
            // First dialog = scan item
            DeclareUnexpectedProductWindow dialog = new DeclareUnexpectedProductWindow();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                DataTable dt = DataSupport.RunDataSet("SELECT lot_no[Lot No], expiry[Expiry] FROM LocationProductsLedger WHERE product = '" + dialog.product + "' AND uom ='" + dialog.uom + "'; ").Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    row["Expiry"] = DateTime.Parse(row["Expiry"].ToString()).ToShortDateString();
                }

                // Second Dialog = select lot no and expiry
                SelectGridWindow select_dialog = new SelectGridWindow();
                select_dialog.dataGridView1.DataSource = dt;

                if (select_dialog.ShowDialog() == DialogResult.OK)
                {
                    // Third Dialog = select location
                    SelectGridWindow select_location_dialog = new SelectGridWindow();
                    select_location_dialog.Text = "WHERE DID YOU FIND IT?";
                    select_location_dialog.dataGridView1.DataSource = FAQ.GetLocationsFromPhysicalCount(phcount_id);
                    if (select_location_dialog.ShowDialog() == DialogResult.OK)
                    {
                        var location     = select_location_dialog.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                        var selected_row = select_dialog.dataGridView1.SelectedRows[0];

                        Boolean is_in_grid = false;
                        foreach (DataGridViewRow row in header_grid.Rows)
                        {
                            if (row.Cells["location"].Value.ToString() == location &&
                                row.Cells["product"].Value.ToString() == dialog.product &&
                                row.Cells["uom"].Value.ToString() == dialog.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()
                                )
                            {
                                if (row.Cells["actual_qty"].Value.ToString() == "")
                                {
                                    row.DefaultCellStyle.BackColor = Color.Yellow;

                                    MessageBox.Show("Sorry, this is not an unexpected product! Please see product highlighted in yellow");
                                    return;
                                }

                                row.Cells["actual_qty"].Value = int.Parse(row.Cells["actual_qty"].Value.ToString()) + 1;
                                is_in_grid = true;
                            }
                        }



                        if (!is_in_grid)
                        {
                            var row_index = header_grid.Rows.Add(location, dialog.product, dialog.uom, selected_row.Cells["Lot No"].Value.ToString(), selected_row.Cells["Expiry"].Value.ToString(), 1);
                            header_grid.Rows[row_index].Cells["actual_qty"].ReadOnly        = true;
                            header_grid.Rows[row_index].Cells["actual_qty"].Style.BackColor = Color.LightGray;
                            header_grid.Rows[row_index].Cells["expected"].Value             = "NO";
                        }
                    }
                }
            }
        }
示例#9
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();
            }
        }