Esempio n. 1
0
        private void fastBarcodes_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                try
                {
                    FastObjectListView fastBarcodes = sender as FastObjectListView;
                    if (fastBarcodes.SelectedObject != null)
                    {
                        CartonDTO cartonDTO = null; PalletDTO palletDTO = null;
                        if (sender.Equals(this.fastCartons))
                        {
                            cartonDTO = fastBarcodes.SelectedObject as CartonDTO;
                        }
                        if (sender.Equals(this.fastPallets))
                        {
                            palletDTO = fastBarcodes.SelectedObject as PalletDTO;
                        }

                        if (cartonDTO != null || palletDTO != null)
                        {
                            QuickView quickView = new QuickView(this.scannerAPIs.GetBarcodeList((GlobalVariables.FillingLine)(cartonDTO != null ? cartonDTO.FillingLineID : palletDTO.FillingLineID), cartonDTO != null ? cartonDTO.CartonID : 0, palletDTO != null ? palletDTO.PalletID : 0), cartonDTO != null ? "Carton: " + cartonDTO.Code : "Pallet: " + palletDTO.Code);
                            quickView.ShowDialog(); quickView.Dispose();
                        }
                    }
                }
                catch (Exception exception)
                {
                    ExceptionHandlers.ShowExceptionMessageBox(this, exception);
                }
            }
        }
Esempio n. 2
0
        private void fastBarcodes_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                try
                {
                    if (this.fastBarcodes.SelectedObject != null)
                    {
                        int fillingLineID = 0; int cartonID = 0; int palletID = 0; int batchID = 0;

                        CartonDTO cartonDTO = this.fastBarcodes.SelectedObject as CartonDTO;
                        if (cartonDTO != null)
                        {
                            fillingLineID = cartonDTO.FillingLineID; cartonID = cartonDTO.CartonID;
                        }

                        PalletDTO palletDTO = this.fastBarcodes.SelectedObject as PalletDTO;
                        if (palletDTO != null)
                        {
                            fillingLineID = palletDTO.FillingLineID; palletID = palletDTO.PalletID;
                        }

                        if (fillingLineID > 0)
                        {
                            QuickView quickView = new QuickView(this.scannerAPIs.GetBarcodeList((GlobalVariables.FillingLine)fillingLineID, cartonID, palletID, batchID), (cartonDTO != null ? "Carton: " + cartonDTO.Code : (palletDTO != null ? "Pallet: " + palletDTO.Code : "")));
                            quickView.ShowDialog(); quickView.Dispose();
                        }
                    }
                }
                catch (Exception exception)
                {
                    ExceptionHandlers.ShowExceptionMessageBox(this, exception);
                }
            }
        }
Esempio n. 3
0
        private void labelLock_Click(object sender, EventArgs e)
        {
            try
            {
                PalletDTO palletDTO = this.fastBarcodes.SelectedObject as PalletDTO;
                if (palletDTO != null)
                {
                    PalletViewModel  palletViewModel  = CommonNinject.Kernel.Get <PalletViewModel>();
                    PalletController palletController = new PalletController(CommonNinject.Kernel.Get <IPalletService>(), palletViewModel);

                    palletController.Lock(palletDTO.PalletID);

                    if (CustomMsgBox.Show(this, "Are you sure you want to " + (palletViewModel.Lockable ? "lock" : "un-lock") + " this entry data" + "?", "Warning", MessageBoxButtons.YesNo, (palletViewModel.Lockable ? MessageBoxIcon.Information : MessageBoxIcon.Warning)) == DialogResult.Yes)
                    {
                        if (palletController.LockConfirmed())
                        {
                            ((PalletDTO)this.fastBarcodes.SelectedObject).Locked = !palletViewModel.Locked;
                            this.fastBarcodes.RefreshObject(this.fastBarcodes.SelectedObject);
                        }
                        else
                        {
                            throw new Exception("Lỗi khóa hay mở khóa pallet: " + palletViewModel.Code + "\r\n\r\nVui lòng đóng phần mềm và thử lại sau.");
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Esempio n. 4
0
        public IList <BarcodeDTO> GetBarcodeList(GlobalVariables.FillingLine fillingLineID, int cartonID, int palletID, int batchID)
        {
            try
            {
                IList <BarcodeDTO> barcodeList = new List <BarcodeDTO>();

                if (cartonID > 0)
                {
                    IList <Pack> packs = this.packRepository.GetPacks(fillingLineID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped, cartonID);
                    if (packs.Count > 0)
                    {
                        packs.Each(pack =>
                        {
                            PackDTO packDTO = Mapper.Map <Pack, PackDTO>(pack);
                            barcodeList.Add(packDTO);
                        });
                    }
                }
                else
                if (palletID > 0)
                {
                    IList <Carton> cartons = this.cartonRepository.GetCartons(fillingLineID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped + "," + (int)GlobalVariables.BarcodeStatus.Pending + "," + (int)GlobalVariables.BarcodeStatus.Noread, palletID);
                    if (cartons.Count > 0)
                    {
                        cartons.Each(carton =>
                        {
                            CartonDTO cartonDTO = Mapper.Map <Carton, CartonDTO>(carton);
                            barcodeList.Add(cartonDTO);
                        });
                    }
                }
                else
                if (batchID > 0)
                {
                    IList <Pallet> pallets = this.palletRepository.GetPallets(fillingLineID, batchID, (int)GlobalVariables.BarcodeStatus.Freshnew + "," + (int)GlobalVariables.BarcodeStatus.Readytoset + "," + (int)GlobalVariables.BarcodeStatus.Wrapped);
                    if (pallets.Count > 0)
                    {
                        pallets.Each(pallet =>
                        {
                            PalletDTO palletDTO = Mapper.Map <Pallet, PalletDTO>(pallet);
                            barcodeList.Add(palletDTO);
                        });
                    }
                }

                return(barcodeList);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Esempio n. 5
0
        public QuickView(IList <BarcodeDTO> barcodeList, string caption)
        {
            InitializeComponent();

            this.scannerAPIs = new ScannerAPIs(CommonNinject.Kernel.Get <IPackRepository>(), CommonNinject.Kernel.Get <ICartonRepository>(), CommonNinject.Kernel.Get <IPalletRepository>());

            this.fastBarcodes.SetObjects(barcodeList);

            this.Text = caption;

            if (barcodeList.Count > 0)
            {
                PalletDTO palletDTO = barcodeList[0] as PalletDTO;
                if (palletDTO != null)
                {
                    this.labelLock.Visible = true;
                }
            }
        }