示例#1
0
 public void InsertGoodsReceiptDetail(GoodsReceiptDetailDTO goodsReceiptDetail)
 {
     try
     {
         GoodsReceiptDetailDAO.Instance.InsertGoodsReceiptDetail(goodsReceiptDetail);
     }
     catch (MySqlException ex)
     {
         throw new BUSException(ex.Message);
     }
 }
示例#2
0
 public MySqlDataReader InsertGoodsReceiptDetail(GoodsReceiptDetailDTO goodsReceiptDetail)
 {
     try
     {
         // query
         string query = string.Format(@"insert into GOODSRECEIPTDETAIL values('{0}', (select GoodsReceiptID from GOODSRECEIPT where GoodsReceiptID='{1}'),
                                         (select GoodsID from GOODS where GoodsID='{2}'),'{3}')", goodsReceiptDetail.ID, goodsReceiptDetail.GoodsReceiptID,
                                      goodsReceiptDetail.GoodsID, goodsReceiptDetail.Quantity);
         // excute query
         return(MySqlConnectionDAO.Instance.ExcuteQuery(query));
     }
     finally
     {
     }
 }
        protected override void SaveRelative(WarehouseTransfer warehouseTransfer, SaveRelativeOption saveRelativeOption)
        {
            base.SaveRelative(warehouseTransfer, saveRelativeOption);

            if (warehouseTransfer.OneStep)
            {
                GRHelperService grHelperService = new GRHelperService(this.GetGROption(warehouseTransfer.NMVNTaskID), this.GenericWithDetailRepository.TotalSmartPortalEntities, this.UserID);

                IGoodsReceiptAPIRepository goodsReceiptAPIRepository = new GoodsReceiptAPIRepository(this.GenericWithDetailRepository.TotalSmartPortalEntities);
                if (saveRelativeOption == SaveRelativeOption.Update)
                {
                    IGoodsReceiptDTO goodsReceiptDTO = grHelperService.NewGoodsReceiptDTO();

                    goodsReceiptDTO.EntryDate = warehouseTransfer.EntryDate;

                    goodsReceiptDTO.GoodsReceiptTypeID  = (int)GlobalEnums.GoodsReceiptTypeID.WarehouseTransfer;
                    goodsReceiptDTO.WarehouseTransferID = warehouseTransfer.WarehouseTransferID;

                    goodsReceiptDTO.ShiftID = warehouseTransfer.ShiftID;
                    goodsReceiptDTO.OneStep = warehouseTransfer.OneStep;

                    goodsReceiptDTO.Warehouse = new TotalDTO.Commons.WarehouseBaseDTO()
                    {
                        WarehouseID = warehouseTransfer.WarehouseReceiptID
                    };
                    goodsReceiptDTO.WarehouseIssue = new TotalDTO.Commons.WarehouseBaseDTO()
                    {
                        WarehouseID = warehouseTransfer.WarehouseID
                    };

                    goodsReceiptDTO.StorekeeperID    = warehouseTransfer.StorekeeperID;
                    goodsReceiptDTO.PreparedPersonID = warehouseTransfer.PreparedPersonID;
                    goodsReceiptDTO.ApproverID       = warehouseTransfer.PreparedPersonID;

                    goodsReceiptDTO.Purposes    = warehouseTransfer.Caption;
                    goodsReceiptDTO.Description = warehouseTransfer.Description;
                    goodsReceiptDTO.Remarks     = warehouseTransfer.Remarks;

                    goodsReceiptDTO.Approved     = warehouseTransfer.Approved;
                    goodsReceiptDTO.ApprovedDate = warehouseTransfer.ApprovedDate;

                    List <GoodsReceiptPendingWarehouseTransferDetail> pendingWarehouseTransferDetails = goodsReceiptAPIRepository.GetPendingWarehouseTransferDetails((int)goodsReceiptDTO.NMVNTaskID, null, goodsReceiptDTO.WarehouseTransferID, goodsReceiptDTO.WarehouseID, goodsReceiptDTO.WarehouseIssueID, null, goodsReceiptDTO.OneStep);
                    foreach (GoodsReceiptPendingWarehouseTransferDetail pendingWarehouseTransferDetail in pendingWarehouseTransferDetails)
                    {
                        GoodsReceiptDetailDTO goodsReceiptDetailDTO = new GoodsReceiptDetailDTO()
                        {
                            GoodsReceiptID = goodsReceiptDTO.GoodsReceiptID,

                            WarehouseTransferID        = pendingWarehouseTransferDetail.WarehouseTransferID,
                            WarehouseTransferDetailID  = pendingWarehouseTransferDetail.WarehouseTransferDetailID,
                            WarehouseTransferReference = pendingWarehouseTransferDetail.WarehouseTransferReference,
                            WarehouseTransferEntryDate = pendingWarehouseTransferDetail.WarehouseTransferEntryDate,
                            GoodsReceiptReference      = pendingWarehouseTransferDetail.GoodsReceiptReference,
                            GoodsReceiptEntryDate      = pendingWarehouseTransferDetail.GoodsReceiptEntryDate,

                            BatchID        = pendingWarehouseTransferDetail.BatchID,
                            BatchEntryDate = pendingWarehouseTransferDetail.BatchEntryDate,


                            CommodityID     = pendingWarehouseTransferDetail.CommodityID,
                            CommodityCode   = pendingWarehouseTransferDetail.CommodityCode,
                            CommodityName   = pendingWarehouseTransferDetail.CommodityName,
                            CommodityTypeID = pendingWarehouseTransferDetail.CommodityTypeID,

                            LabID = pendingWarehouseTransferDetail.LabID,

                            Barcode   = pendingWarehouseTransferDetail.Barcode,
                            BatchCode = pendingWarehouseTransferDetail.BatchCode,
                            SealCode  = pendingWarehouseTransferDetail.SealCode,
                            LabCode   = pendingWarehouseTransferDetail.LabCode,

                            ProductionDate = pendingWarehouseTransferDetail.ProductionDate,
                            ExpiryDate     = pendingWarehouseTransferDetail.ExpiryDate,

                            BinLocationID   = pendingWarehouseTransferDetail.BinLocationID,
                            BinLocationCode = pendingWarehouseTransferDetail.BinLocationCode,

                            UnitWeight = pendingWarehouseTransferDetail.UnitWeight,
                            TareWeight = pendingWarehouseTransferDetail.TareWeight,

                            QuantityRemains = (decimal)pendingWarehouseTransferDetail.QuantityRemains,
                            Quantity        = (decimal)pendingWarehouseTransferDetail.QuantityRemains,
                        };
                        goodsReceiptDTO.ViewDetails.Add(goodsReceiptDetailDTO);
                    }

                    goodsReceiptDTO.TotalQuantity = goodsReceiptDTO.GetTotalQuantity();

                    grHelperService.Save(goodsReceiptDTO);
                }

                if (saveRelativeOption == SaveRelativeOption.Undo)
                {//NOTES: THIS UNDO REQUIRE: JUST SAVE ONLY ONE GoodsReceipt FOR AN WarehouseTransfer
                    int?goodsReceiptID = goodsReceiptAPIRepository.GetGoodsReceiptID(null, null, warehouseTransfer.WarehouseTransferID, null);
                    grHelperService.Delete(goodsReceiptID);
                }
            }
        }
        protected override void SaveRelative(WarehouseAdjustment warehouseAdjustment, SaveRelativeOption saveRelativeOption)
        {
            base.SaveRelative(warehouseAdjustment, saveRelativeOption);

            if (warehouseAdjustment.HasPositiveLine)
            {
                IGoodsReceiptAPIRepository goodsReceiptAPIRepository = new GoodsReceiptAPIRepository(this.GenericWithDetailRepository.TotalSmartCodingEntities);
                IGoodsReceiptBaseService   goodsReceiptBaseService   = new GoodsReceiptBaseService(new GoodsReceiptRepository(this.GenericWithDetailRepository.TotalSmartCodingEntities));

                //VERY IMPORTANT: THE BaseService.UserID IS AUTOMATICALLY SET BY CustomControllerAttribute OF CONTROLLER, ONLY WHEN BaseService IS INITIALIZED BY CONTROLLER. BUT HERE, THE this.goodsReceiptBaseService IS INITIALIZED BY VehiclesInvoiceService => SO SHOULD SET goodsReceiptBaseService.UserID = this.UserID
                goodsReceiptBaseService.UserID = this.UserID;

                if (saveRelativeOption == SaveRelativeOption.Update)
                {
                    GoodsReceiptDTO goodsReceiptDTO = new GoodsReceiptDTO();

                    goodsReceiptDTO.EntryDate   = warehouseAdjustment.EntryDate;
                    goodsReceiptDTO.WarehouseID = warehouseAdjustment.WarehouseReceiptID;

                    goodsReceiptDTO.WarehouseAdjustmentID = warehouseAdjustment.WarehouseAdjustmentID;

                    goodsReceiptDTO.GoodsReceiptTypeID = (int)GlobalEnums.GoodsReceiptTypeID.WarehouseAdjustments;

                    goodsReceiptDTO.StorekeeperID = warehouseAdjustment.StorekeeperID;

                    goodsReceiptDTO.Description = warehouseAdjustment.Description;
                    goodsReceiptDTO.Remarks     = warehouseAdjustment.Remarks;

                    List <PendingWarehouseAdjustmentDetail> pendingWarehouseAdjustmentDetails = goodsReceiptAPIRepository.GetPendingWarehouseAdjustmentDetails(warehouseAdjustment.LocationID, null, warehouseAdjustment.WarehouseAdjustmentID, warehouseAdjustment.WarehouseID, null, false);
                    foreach (PendingWarehouseAdjustmentDetail pendingWarehouseAdjustmentDetail in pendingWarehouseAdjustmentDetails)
                    {
                        GoodsReceiptDetailDTO goodsReceiptDetailDTO = new GoodsReceiptDetailDTO()
                        {
                            GoodsReceiptID = goodsReceiptDTO.GoodsReceiptID,

                            WarehouseAdjustmentID        = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentID,
                            WarehouseAdjustmentDetailID  = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentDetailID,
                            WarehouseAdjustmentReference = pendingWarehouseAdjustmentDetail.PrimaryReference,
                            WarehouseAdjustmentEntryDate = pendingWarehouseAdjustmentDetail.PrimaryEntryDate,

                            BatchID        = pendingWarehouseAdjustmentDetail.BatchID,
                            BatchEntryDate = pendingWarehouseAdjustmentDetail.BatchEntryDate,

                            BinLocationID   = pendingWarehouseAdjustmentDetail.BinLocationID,
                            BinLocationCode = pendingWarehouseAdjustmentDetail.BinLocationCode,

                            CommodityID   = pendingWarehouseAdjustmentDetail.CommodityID,
                            CommodityCode = pendingWarehouseAdjustmentDetail.CommodityCode,
                            CommodityName = pendingWarehouseAdjustmentDetail.CommodityName,

                            Quantity   = (decimal)pendingWarehouseAdjustmentDetail.QuantityRemains,
                            LineVolume = (decimal)pendingWarehouseAdjustmentDetail.LineVolumeRemains,

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

                            PackCounts   = pendingWarehouseAdjustmentDetail.PackCounts,
                            CartonCounts = pendingWarehouseAdjustmentDetail.CartonCounts,
                            PalletCounts = pendingWarehouseAdjustmentDetail.PalletCounts
                        };
                        goodsReceiptDTO.ViewDetails.Add(goodsReceiptDetailDTO);
                    }

                    goodsReceiptBaseService.Save(goodsReceiptDTO, true);
                }

                if (saveRelativeOption == SaveRelativeOption.Undo)
                {//NOTES: THIS UNDO REQUIRE: JUST SAVE ONLY ONE GoodsReceipt FOR AN WarehouseAdjustment
                    int?goodsReceiptID = goodsReceiptAPIRepository.GetGoodsReceiptIDofWarehouseAdjustment(warehouseAdjustment.WarehouseAdjustmentID);
                    if (goodsReceiptID != null)
                    {
                        goodsReceiptBaseService.Delete((int)goodsReceiptID, true);
                    }
                    else
                    {
                        throw new Exception("Lỗi không tìm thấy phiếu nhập kho cũ của phiếu điều chỉnh kho này!" + "\r\n" + "\r\n" + "Vui lòng kiểm tra lại dữ liệu trước khi tiếp tục.");
                    }
                }
            }
        }
        protected override void SaveRelative(WarehouseAdjustment warehouseAdjustment, SaveRelativeOption saveRelativeOption)
        {
            base.SaveRelative(warehouseAdjustment, saveRelativeOption);

            if (warehouseAdjustment.HasPositiveLine)
            {
                GRHelperService grHelperService = new GRHelperService(this.GetGROption(warehouseAdjustment.NMVNTaskID), this.GenericWithDetailRepository.TotalSmartPortalEntities, this.UserID);

                IGoodsReceiptAPIRepository goodsReceiptAPIRepository = new GoodsReceiptAPIRepository(this.GenericWithDetailRepository.TotalSmartPortalEntities);
                if (saveRelativeOption == SaveRelativeOption.Update)
                {
                    IGoodsReceiptDTO goodsReceiptDTO = grHelperService.NewGoodsReceiptDTO();

                    goodsReceiptDTO.EntryDate = warehouseAdjustment.EntryDate;
                    goodsReceiptDTO.ShiftID   = 1; // warehouseAdjustment.ShiftID;

                    goodsReceiptDTO.GoodsReceiptTypeID    = (int)GlobalEnums.GoodsReceiptTypeID.WarehouseAdjustments;
                    goodsReceiptDTO.WarehouseAdjustmentID = warehouseAdjustment.WarehouseAdjustmentID;

                    goodsReceiptDTO.Warehouse = new TotalDTO.Commons.WarehouseBaseDTO()
                    {
                        WarehouseID = warehouseAdjustment.WarehouseReceiptID
                    };
                    goodsReceiptDTO.Customer = new TotalDTO.Commons.CustomerBaseDTO()
                    {
                        CustomerID = warehouseAdjustment.CustomerID
                    };

                    goodsReceiptDTO.StorekeeperID    = warehouseAdjustment.StorekeeperID;
                    goodsReceiptDTO.PreparedPersonID = warehouseAdjustment.PreparedPersonID;
                    goodsReceiptDTO.ApproverID       = warehouseAdjustment.PreparedPersonID;

                    goodsReceiptDTO.Purposes    = warehouseAdjustment.AdjustmentJobs;
                    goodsReceiptDTO.Description = warehouseAdjustment.Description;
                    goodsReceiptDTO.Remarks     = warehouseAdjustment.Remarks;

                    goodsReceiptDTO.Approved     = warehouseAdjustment.Approved;
                    goodsReceiptDTO.ApprovedDate = warehouseAdjustment.ApprovedDate;

                    List <PendingWarehouseAdjustmentDetail> pendingWarehouseAdjustmentDetails = goodsReceiptAPIRepository.GetPendingWarehouseAdjustmentDetails(warehouseAdjustment.LocationID, null, goodsReceiptDTO.WarehouseAdjustmentID, goodsReceiptDTO.WarehouseID, null, false);
                    foreach (PendingWarehouseAdjustmentDetail pendingWarehouseAdjustmentDetail in pendingWarehouseAdjustmentDetails)
                    {
                        GoodsReceiptDetailDTO goodsReceiptDetailDTO = new GoodsReceiptDetailDTO()
                        {
                            GoodsReceiptID = goodsReceiptDTO.GoodsReceiptID,

                            WarehouseAdjustmentID        = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentID,
                            WarehouseAdjustmentDetailID  = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentDetailID,
                            WarehouseAdjustmentReference = pendingWarehouseAdjustmentDetail.PrimaryReference,
                            WarehouseAdjustmentEntryDate = pendingWarehouseAdjustmentDetail.PrimaryEntryDate,

                            WarehouseAdjustmentTypeID = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentTypeID,

                            BatchID        = pendingWarehouseAdjustmentDetail.BatchID,
                            BatchCode      = pendingWarehouseAdjustmentDetail.BatchCode,
                            BatchEntryDate = pendingWarehouseAdjustmentDetail.BatchEntryDate,

                            CommodityID   = pendingWarehouseAdjustmentDetail.CommodityID,
                            CommodityCode = pendingWarehouseAdjustmentDetail.CommodityCode,
                            CommodityName = pendingWarehouseAdjustmentDetail.CommodityName,

                            LabID = -1,

                            QuantityRemains = (decimal)pendingWarehouseAdjustmentDetail.QuantityRemains,
                            Quantity        = (decimal)pendingWarehouseAdjustmentDetail.QuantityRemains,
                        };
                        goodsReceiptDTO.ViewDetails.Add(goodsReceiptDetailDTO);
                    }

                    goodsReceiptDTO.TotalQuantity = goodsReceiptDTO.GetTotalQuantity();

                    grHelperService.Save(goodsReceiptDTO);
                }

                if (saveRelativeOption == SaveRelativeOption.Undo)
                {//NOTES: THIS UNDO REQUIRE: JUST SAVE ONLY ONE GoodsReceipt FOR AN WarehouseAdjustment
                    int?goodsReceiptID = goodsReceiptAPIRepository.GetGoodsReceiptID(null, null, null, warehouseAdjustment.WarehouseAdjustmentID);
                    grHelperService.Delete(goodsReceiptID);
                }
            }
        }
        protected override void SaveRelative(WarehouseAdjustment warehouseAdjustment, SaveRelativeOption saveRelativeOption)
        {
            base.SaveRelative(warehouseAdjustment, saveRelativeOption);

            if (warehouseAdjustment.HasPositiveLine)
            {
                IGoodsReceiptAPIRepository goodsReceiptAPIRepository = new GoodsReceiptAPIRepository(this.GenericWithDetailRepository.TotalSmartPortalEntities);
                if (saveRelativeOption == SaveRelativeOption.Update)
                {
                    IGoodsReceiptDTO goodsReceiptDTO = this.NewGoodsReceiptDTO(warehouseAdjustment.NMVNTaskID);

                    goodsReceiptDTO.EntryDate = warehouseAdjustment.EntryDate;
                    goodsReceiptDTO.Warehouse = new TotalDTO.Commons.WarehouseBaseDTO()
                    {
                        WarehouseID = warehouseAdjustment.WarehouseReceiptID
                    };

                    goodsReceiptDTO.WarehouseAdjustmentID = warehouseAdjustment.WarehouseAdjustmentID;

                    goodsReceiptDTO.GoodsReceiptTypeID = (int)GlobalEnums.GoodsReceiptTypeID.WarehouseAdjustments;

                    goodsReceiptDTO.StorekeeperID    = warehouseAdjustment.StorekeeperID;
                    goodsReceiptDTO.PreparedPersonID = warehouseAdjustment.PreparedPersonID;
                    goodsReceiptDTO.ApproverID       = warehouseAdjustment.PreparedPersonID;

                    goodsReceiptDTO.Customer = new TotalDTO.Commons.CustomerBaseDTO()
                    {
                        CustomerID = warehouseAdjustment.CustomerID
                    };

                    goodsReceiptDTO.Purposes    = warehouseAdjustment.AdjustmentJobs;
                    goodsReceiptDTO.Description = warehouseAdjustment.Description;
                    goodsReceiptDTO.Remarks     = warehouseAdjustment.Remarks;

                    goodsReceiptDTO.Approved     = warehouseAdjustment.Approved;
                    goodsReceiptDTO.ApprovedDate = warehouseAdjustment.ApprovedDate;

                    List <PendingWarehouseAdjustmentDetail> pendingWarehouseAdjustmentDetails = goodsReceiptAPIRepository.GetPendingWarehouseAdjustmentDetails(warehouseAdjustment.LocationID, null, warehouseAdjustment.WarehouseAdjustmentID, warehouseAdjustment.WarehouseReceiptID, null, false);
                    foreach (PendingWarehouseAdjustmentDetail pendingWarehouseAdjustmentDetail in pendingWarehouseAdjustmentDetails)
                    {
                        GoodsReceiptDetailDTO goodsReceiptDetailDTO = new GoodsReceiptDetailDTO()
                        {
                            GoodsReceiptID = goodsReceiptDTO.GoodsReceiptID,

                            WarehouseAdjustmentID        = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentID,
                            WarehouseAdjustmentDetailID  = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentDetailID,
                            WarehouseAdjustmentReference = pendingWarehouseAdjustmentDetail.PrimaryReference,
                            WarehouseAdjustmentEntryDate = pendingWarehouseAdjustmentDetail.PrimaryEntryDate,

                            WarehouseAdjustmentTypeID = pendingWarehouseAdjustmentDetail.WarehouseAdjustmentTypeID,

                            BatchID        = pendingWarehouseAdjustmentDetail.BatchID,
                            BatchEntryDate = pendingWarehouseAdjustmentDetail.BatchEntryDate,

                            CommodityID   = pendingWarehouseAdjustmentDetail.CommodityID,
                            CommodityCode = pendingWarehouseAdjustmentDetail.CommodityCode,
                            CommodityName = pendingWarehouseAdjustmentDetail.CommodityName,

                            QuantityRemains = (decimal)pendingWarehouseAdjustmentDetail.QuantityRemains,
                            Quantity        = (decimal)pendingWarehouseAdjustmentDetail.QuantityRemains,
                        };
                        goodsReceiptDTO.ViewDetails.Add(goodsReceiptDetailDTO);
                    }

                    goodsReceiptDTO.TotalQuantity = goodsReceiptDTO.GetTotalQuantity();

                    this.DoSaveOrDeleteGoodsReceipt(warehouseAdjustment.NMVNTaskID, true, goodsReceiptDTO, null);
                }

                if (saveRelativeOption == SaveRelativeOption.Undo)
                {//NOTES: THIS UNDO REQUIRE: JUST SAVE ONLY ONE GoodsReceipt FOR AN WarehouseAdjustment
                    int?goodsReceiptID = goodsReceiptAPIRepository.GetGoodsReceiptIDofWarehouseAdjustment(warehouseAdjustment.WarehouseAdjustmentID);
                    if (goodsReceiptID != null)
                    {
                        this.DoSaveOrDeleteGoodsReceipt(warehouseAdjustment.NMVNTaskID, false, null, goodsReceiptID);
                    }
                    else
                    {
                        throw new Exception("Lỗi không tìm thấy phiếu nhập kho cũ của phiếu điều chỉnh kho này!" + "\r\n" + "\r\n" + "Vui lòng kiểm tra lại dữ liệu trước khi tiếp tục.");
                    }
                }
            }
        }
示例#7
0
        private void buttonAddESC_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender.Equals(this.buttonAdd) || sender.Equals(this.buttonAddExit))
                {
                    FastObjectListView fastPendingList = this.customTabBatch.SelectedIndex == 0 ? this.fastPendingPallets : (this.customTabBatch.SelectedIndex == 1 ? this.fastPendingCartons : null);

                    if (fastPendingList != null)
                    {
                        if (fastPendingList.CheckedObjects.Count > 0)
                        {
                            IEnumerable <IPendingforGoodsReceiptDetail> pendingforGoodsReceiptDetails = fastPendingList.CheckedObjects.Cast <IPendingforGoodsReceiptDetail>();
                            if (pendingforGoodsReceiptDetails.Where(w => w.BinLocationID <= 0).FirstOrDefault() != null)
                            {
                                throw new Exception("Vui lòng chọn Bin Location.");
                            }

                            this.goodsReceiptViewModel.ViewDetails.RaiseListChangedEvents = false;
                            foreach (IPendingforGoodsReceiptDetail pendingforGoodsReceiptDetail in pendingforGoodsReceiptDetails)
                            {
                                GoodsReceiptDetailDTO goodsReceiptDetailDTO = new GoodsReceiptDetailDTO()
                                {
                                    GoodsReceiptID = this.goodsReceiptViewModel.GoodsReceiptID,

                                    PickupID        = pendingforGoodsReceiptDetail.PickupID > 0 ? pendingforGoodsReceiptDetail.PickupID : (int?)null,
                                    PickupDetailID  = pendingforGoodsReceiptDetail.PickupDetailID > 0 ? pendingforGoodsReceiptDetail.PickupDetailID : (int?)null,
                                    PickupReference = pendingforGoodsReceiptDetail.PrimaryReference,
                                    PickupEntryDate = pendingforGoodsReceiptDetail.PickupID > 0 ? pendingforGoodsReceiptDetail.PrimaryEntryDate : (DateTime?)null,

                                    GoodsIssueID = pendingforGoodsReceiptDetail.GoodsIssueID > 0 ? pendingforGoodsReceiptDetail.GoodsIssueID : (int?)null,
                                    GoodsIssueTransferDetailID = pendingforGoodsReceiptDetail.GoodsIssueTransferDetailID > 0 ? pendingforGoodsReceiptDetail.GoodsIssueTransferDetailID : (int?)null,
                                    GoodsIssueReference        = pendingforGoodsReceiptDetail.PrimaryReference,
                                    GoodsIssueEntryDate        = pendingforGoodsReceiptDetail.GoodsIssueID > 0 ? pendingforGoodsReceiptDetail.PrimaryEntryDate : (DateTime?)null,

                                    LocationIssueID  = pendingforGoodsReceiptDetail.LocationIssueID,
                                    WarehouseIssueID = pendingforGoodsReceiptDetail.WarehouseIssueID,

                                    BatchID        = pendingforGoodsReceiptDetail.BatchID,
                                    BatchEntryDate = pendingforGoodsReceiptDetail.BatchEntryDate,

                                    BinLocationID   = pendingforGoodsReceiptDetail.BinLocationID,
                                    BinLocationCode = pendingforGoodsReceiptDetail.BinLocationCode,

                                    CommodityID   = pendingforGoodsReceiptDetail.CommodityID,
                                    CommodityCode = pendingforGoodsReceiptDetail.CommodityCode,
                                    CommodityName = pendingforGoodsReceiptDetail.CommodityName,

                                    Quantity   = (decimal)pendingforGoodsReceiptDetail.QuantityRemains,
                                    LineVolume = (decimal)pendingforGoodsReceiptDetail.LineVolumeRemains,


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

                                    PackCounts   = pendingforGoodsReceiptDetail.PackCounts,
                                    CartonCounts = pendingforGoodsReceiptDetail.CartonCounts,
                                    PalletCounts = pendingforGoodsReceiptDetail.PalletCounts
                                };
                                this.goodsReceiptViewModel.ViewDetails.Add(goodsReceiptDetailDTO);
                            }
                            this.goodsReceiptViewModel.ViewDetails.RaiseListChangedEvents = true;
                            this.goodsReceiptViewModel.ViewDetails.ResetBindings();
                        }
                    }


                    if (sender.Equals(this.buttonAddExit))
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        this.WizardDetail_Load(this, new EventArgs());
                    }
                }

                if (sender.Equals(this.buttonESC))
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }