private void repositoryItemButtonEdit1_DoubleClick(object sender, EventArgs e)
        {
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            if (gridItemMovementView.FocusedValue != null )
            {
                prev = gridItemMovementView.FocusedValue;
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
                if (!pl.IsColumnNull("PalletID"))
                {
                    pallet.GetAllItemsInPallet(pl.PalletID);
                    gridControl2.DataSource = pallet.DefaultView;
                    pallet.GetAllItemsInPalletSKUTotal(pl.PalletID);
                    Label l = new Label();
                    l.Dock = DockStyle.Bottom;

                    XtraForm f = new XtraForm();
                    //gridControl2.Parent = null;
                    f.ShowInTaskbar = false;
                    f.Width = gridControl2.Width;
                    if (pallet.RowCount > 0 && !pallet.IsColumnNull("Total"))
                    {

                        l.Text = string.Format("Total SKU: {0}", pallet.GetColumn("Total").ToString());
                    }
                    else
                    {
                        l.Text = "Total SKU: 0";
                    }
                    f.Controls.Add(l);

                    pallet.LoadByPrimaryKey(pl.PalletID);
                    if (!pallet.IsColumnNull("PalletNo"))
                    {
                        f.Text = String.Format("Pallet Number: {0}", pallet.PalletNo);

                    }
                    f.Controls.Add(gridControl2);

                    f.StartPosition = FormStartPosition.CenterScreen;
                    f.ShowDialog();
                }
            }
        }
コード例 #2
0
        private void PutAwayRecievedItems(bool reset)
        {
            if (_dtPutAwayNonPalletized == null || reset == true)
            {
                // Prep the data tables
                _dtPutAwayNonPalletized = new DataTable();
                _dtPutAwayPalletized = new DataTable();

                _dtPutAwayPalletized.Columns.Add("ID");
                _dtPutAwayPalletized.Columns.Add("Item Name");
                _dtPutAwayPalletized.Columns.Add("PalletNumber");
                _dtPutAwayPalletized.Columns.Add("Expiry Date", typeof(DateTime));
                _dtPutAwayPalletized.Columns.Add("PutAwayLocation");
                _dtPutAwayPalletized.Columns.Add("Consolidate", typeof(bool));
                _dtPutAwayPalletized.Columns.Add("Notes");
                _dtPutAwayPalletized.Columns.Add("Volume");
                _dtPutAwayPalletized.Columns.Add("Stock Code");

                _dtPutAwayNonPalletized.Columns.Add("ID");
                _dtPutAwayNonPalletized.Columns.Add("Item Name");
                _dtPutAwayNonPalletized.Columns.Add("Pack Qty", typeof(decimal));
                _dtPutAwayNonPalletized.Columns.Add("Expiry Date", typeof(DateTime));
                _dtPutAwayNonPalletized.Columns.Add("PutAwayLocation");
                _dtPutAwayNonPalletized.Columns.Add("Batch No");
                _dtPutAwayNonPalletized.Columns.Add("StorageType");
                _dtPutAwayNonPalletized.Columns.Add("BoxLevel", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("Index");
                _dtPutAwayNonPalletized.Columns.Add("BasicUnitPerQ");
                _dtPutAwayNonPalletized.Columns.Add("IsDamaged", typeof(bool));
                _dtPutAwayNonPalletized.Columns.Add("Volume");
                _dtPutAwayNonPalletized.Columns.Add("Manufacturer", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("UnitID", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("Stock Code");
                _dtPutAwayNonPalletized.Columns.Add("GUID");
                _dtPutAwayNonPalletized.Columns.Add("Palletized Quantity", typeof(decimal));
                // import the neccessary data tables
                _dtPalletizedItemList.DefaultView.Sort = "Ordering, PalletNumber";

                int prevPalletID = 0;
                int palletID = 0;
                DataRow LastDr = null;
                foreach (DataRowView drv in _dtPalletizedItemList.DefaultView)
                {
                    DataRow dr = drv.Row;
                    palletID = Convert.ToInt32(drv["PalletNumber"]);
                    if (palletID != prevPalletID)
                    {
                        _dtPutAwayPalletized.ImportRow(dr);
                        LastDr = _dtPutAwayPalletized.Rows[_dtPutAwayPalletized.Rows.Count - 1];
                        LastDr.EndEdit();
                        if (Convert.ToBoolean(LastDr["Consolidate"]))
                        {
                            int plid;
                            LastDr["PutAwayLocation"] = plid = Convert.ToInt32(drv["PalletNumber"]);
                            PalletLocation plc = new PalletLocation();
                            plc.LoadByPrimaryKey(plid);
                            Pallet plt = new Pallet();
                            plt.LoadByPrimaryKey(plc.PalletID);
                            LastDr["PalletNumber"] = (!plt.IsColumnNull("PalletNo")) ? plt.PalletNo : 0;
                        }
                    }
                    else
                    {
                        // add the volume
                        LastDr["Volume"] = Convert.ToDouble(LastDr["Volume"]) + Convert.ToDouble(dr["Volume"]);
                    }
                    prevPalletID = palletID;
                }
                //int quarantine = PalletLocation.GetQuaranteenPalletLocation();
                foreach (DataRowView drv in _dtNonPalletizedItemList.DefaultView)
                {
                    _dtPutAwayNonPalletized.ImportRow(drv.Row);

                    DataRow dr = _dtPutAwayNonPalletized.Rows[_dtPutAwayNonPalletized.Rows.Count - 1];
                    dr.ClearErrors();
                }
                foreach (DataRowView dr in _dtPutAwayNonPalletized.DefaultView)
                {
                    dr["Palletized Quantity"] = dr["Pack Qty"];
                }

                // Bind the data tables with the grids
                //gridPutAwayPalletized.DataSource = _dtPutAwayPalletized;
                //gridPutAwayPalletizedView.SelectRow(0);
                gridPutAwayNonPalletized.DataSource = _dtPutAwayNonPalletized;
                //gridPutAwayPalletizedView.SelectRow(0);
            }
        }