示例#1
0
        private void buttonRemoveDetailItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.EditableMode && this.goodsIssueViewModel.Editable)
                {
                    Equin.ApplicationFramework.ObjectView <TotalDTO.Inventories.GoodsIssueDetailDTO> objectViewGoodsIssueDetailDTO = (this.customTabCenter.SelectedIndex == 0 ? this.gridexPalletDetails : this.gridexCartonDetails).CurrentRow.DataBoundItem as Equin.ApplicationFramework.ObjectView <TotalDTO.Inventories.GoodsIssueDetailDTO>;
                    GoodsIssueDetailDTO goodsIssueDetailDTO = (GoodsIssueDetailDTO)objectViewGoodsIssueDetailDTO;

                    if (goodsIssueDetailDTO != null && CustomMsgBox.Show(this, "Xác nhận xóa " + (goodsIssueDetailDTO.PalletID != null ? "pallet" : "carton") + ":" + (char)13 + (char)13 + (goodsIssueDetailDTO.PalletID != null ? goodsIssueDetailDTO.PalletCode : goodsIssueDetailDTO.CartonCode) + (char)13 + (char)13 + "Tại vi trí: " + (char)13 + (char)13 + goodsIssueDetailDTO.BinLocationCode, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                    {
                        this.goodsIssueViewModel.ViewDetails.Remove(goodsIssueDetailDTO);
                        this.callAutoSave();
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
示例#2
0
        private void buttonAddESC_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender.Equals(this.buttonAddExit))
                {
                    FastObjectListView fastAvailableGoodsReceiptDetails = this.customTabBatch.SelectedIndex == 0 ? this.fastAvailablePallets : (this.customTabBatch.SelectedIndex == 1 ? this.fastAvailableCartons : this.customTabBatch.SelectedIndex == 2 ? this.fastAvailablePacks : null);

                    if (fastAvailableGoodsReceiptDetails != null)
                    {
                        if (fastAvailableGoodsReceiptDetails.CheckedObjects.Count > 0)
                        {
                            this.goodsIssueViewModel.ViewDetails.RaiseListChangedEvents = false;
                            foreach (var checkedObjects in fastAvailableGoodsReceiptDetails.CheckedObjects)
                            {
                                GoodsReceiptDetailAvailable goodsReceiptDetailAvailable = (GoodsReceiptDetailAvailable)checkedObjects;
                                GoodsIssueDetailDTO         goodsIssueDetailDTO         = new GoodsIssueDetailDTO()
                                {
                                    GoodsIssueID = this.goodsIssueViewModel.GoodsIssueID,

                                    DeliveryAdviceID        = goodsReceiptDetailAvailable.DeliveryAdviceID > 0 ? goodsReceiptDetailAvailable.DeliveryAdviceID : (int?)null,
                                    DeliveryAdviceDetailID  = goodsReceiptDetailAvailable.DeliveryAdviceDetailID > 0 ? goodsReceiptDetailAvailable.DeliveryAdviceDetailID : (int?)null,
                                    DeliveryAdviceReference = goodsReceiptDetailAvailable.PrimaryReference,
                                    DeliveryAdviceEntryDate = goodsReceiptDetailAvailable.PrimaryEntryDate,

                                    TransferOrderID        = goodsReceiptDetailAvailable.TransferOrderID > 0 ? goodsReceiptDetailAvailable.TransferOrderID : (int?)null,
                                    TransferOrderDetailID  = goodsReceiptDetailAvailable.TransferOrderDetailID > 0 ? goodsReceiptDetailAvailable.TransferOrderDetailID : (int?)null,
                                    TransferOrderReference = goodsReceiptDetailAvailable.PrimaryReference,
                                    TransferOrderEntryDate = goodsReceiptDetailAvailable.PrimaryEntryDate,

                                    CommodityID   = goodsReceiptDetailAvailable.CommodityID,
                                    CommodityCode = goodsReceiptDetailAvailable.CommodityCode,
                                    CommodityName = goodsReceiptDetailAvailable.CommodityName,

                                    PackageSize = goodsReceiptDetailAvailable.PackageSize,

                                    Volume        = goodsReceiptDetailAvailable.Volume,
                                    PackageVolume = goodsReceiptDetailAvailable.PackageVolume,

                                    GoodsReceiptID       = goodsReceiptDetailAvailable.GoodsReceiptID,
                                    GoodsReceiptDetailID = goodsReceiptDetailAvailable.GoodsReceiptDetailID,

                                    GoodsReceiptReference = goodsReceiptDetailAvailable.GoodsReceiptReference,
                                    GoodsReceiptEntryDate = goodsReceiptDetailAvailable.GoodsReceiptEntryDate,

                                    BatchID        = goodsReceiptDetailAvailable.BatchID,
                                    BatchEntryDate = goodsReceiptDetailAvailable.BatchEntryDate,

                                    BinLocationID   = goodsReceiptDetailAvailable.BinLocationID,
                                    BinLocationCode = goodsReceiptDetailAvailable.BinLocationCode,

                                    WarehouseID   = goodsReceiptDetailAvailable.WarehouseID,
                                    WarehouseCode = goodsReceiptDetailAvailable.WarehouseCode,

                                    PackID     = goodsReceiptDetailAvailable.PackID,
                                    PackCode   = goodsReceiptDetailAvailable.PackCode,
                                    CartonID   = goodsReceiptDetailAvailable.CartonID,
                                    CartonCode = goodsReceiptDetailAvailable.CartonCode,
                                    PalletID   = goodsReceiptDetailAvailable.PalletID,
                                    PalletCode = goodsReceiptDetailAvailable.PalletCode,

                                    PackCounts   = goodsReceiptDetailAvailable.PackCounts,
                                    CartonCounts = goodsReceiptDetailAvailable.CartonCounts,
                                    PalletCounts = goodsReceiptDetailAvailable.PalletCounts,

                                    QuantityAvailable   = (decimal)goodsReceiptDetailAvailable.QuantityAvailable,
                                    LineVolumeAvailable = (decimal)goodsReceiptDetailAvailable.LineVolumeAvailable,

                                    QuantityRemains   = goodsReceiptDetailAvailable.QuantityRemains,
                                    LineVolumeRemains = goodsReceiptDetailAvailable.LineVolumeRemains,

                                    Quantity   = (decimal)goodsReceiptDetailAvailable.QuantityAvailable,  //SHOULD: Quantity = QuantityAvailable (ALSO: LineVolume = LineVolumeAvailable): BECAUSE: WE ISSUE BY WHOLE UNIT OF PALLET/ OR CARTON/ OR PACK
                                    LineVolume = (decimal)goodsReceiptDetailAvailable.LineVolumeAvailable //IF Quantity > QuantityRemains (OR LineVolume > LineVolumeRemains) => THE GoodsIssueDetailDTO WILL BREAK THE ValidationRule => CAN NOT SAVE => USER MUST SELECT OTHER APPROPRIATE UNIT OF PALLET/ OR CARTON/ OR PACK WHICH MATCH THE Quantity/ LineVolume
                                };
                                this.goodsIssueViewModel.ViewDetails.Insert(0, goodsIssueDetailDTO);
                            }
                        }
                    }

                    if (this.MdiParent != null)
                    {
                        this.MdiParent.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                }

                if (sender.Equals(this.buttonESC))
                {
                    if (this.MdiParent != null)
                    {
                        this.MdiParent.DialogResult = DialogResult.Cancel;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.Cancel;
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
            finally
            {
                if (!this.goodsIssueViewModel.ViewDetails.RaiseListChangedEvents)
                {
                    this.goodsIssueViewModel.ViewDetails.RaiseListChangedEvents = true;
                    this.goodsIssueViewModel.ViewDetails.ResetBindings();
                }
            }
        }