Exemplo n.º 1
0
        private static DispatchDetailModel GenerateReceiveDetailModel(DispatchDetail dispatchDetail)
        {
            DispatchDetailModel model = new DispatchDetailModel();

            model.Id         = dispatchDetail.DispatchDetailID;
            model.DispatchID = dispatchDetail.DispatchID;

            model.CommodityID          = dispatchDetail.CommodityID;
            model.Description          = dispatchDetail.Description;
            model.Unit                 = dispatchDetail.UnitID;
            model.RequestedQuantity    = dispatchDetail.RequestedQunatityInUnit;
            model.RequestedQuantityMT  = dispatchDetail.RequestedQuantityInMT;
            model.DispatchedQuantity   = dispatchDetail.DispatchedQuantityInUnit;
            model.DispatchedQuantityMT = dispatchDetail.DispatchedQuantityInMT;

            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates the dispatch model.
        /// </summary>
        /// <param name="dispatch">The dispatch.</param>
        /// <param name="Repository">The repository.</param>
        /// <returns></returns>
        public static DispatchModel GenerateDispatchModel(Dispatch dispatch, Transaction transactionObj,
                                                          List <Commodity> commodities,
                                                          List <Transporter> transporters,
                                                          List <Unit> units,
                                                          List <FDP> fdps,
                                                          List <Program> programs,
                                                          List <AdminUnit> regions,
                                                          List <AdminUnit> zones,
                                                          List <Store> stores)
        {
            DispatchModel model = new DispatchModel(commodities,
                                                    transporters,
                                                    units,
                                                    fdps,
                                                    programs,
                                                    regions,
                                                    zones,
                                                    stores);

            model.BidNumber            = dispatch.BidNumber;
            model.DispatchDate         = dispatch.DispatchDate;
            model.DispatchID           = dispatch.DispatchID;
            model.DriverName           = dispatch.DriverName;
            model.DispatchedByStoreMan = dispatch.DispatchedByStoreMan;
            model.FDPID           = dispatch.FDPID;
            model.GIN             = dispatch.GIN;
            model.Month           = dispatch.PeriodMonth;
            model.Year            = dispatch.PeriodYear;
            model.PlateNo_Prime   = dispatch.PlateNo_Prime;
            model.PlateNo_Trailer = dispatch.PlateNo_Trailer;
            model.RequisitionNo   = dispatch.RequisitionNo;
            model.Type            = dispatch.Type;
            //model.StackNumber = dispatch.StackNumber;
            //model.StoreID = dispatch.StoreID;
            model.TransporterID = dispatch.TransporterID;
            model.WarehouseID   = dispatch.HubID;
            //model.ProgramID = dispatch.ProgramID;
            model.WeighBridgeTicketNumber = dispatch.WeighBridgeTicketNumber;
            model.Remark = dispatch.Remark;

            model.OtherDispatchAllocationID = dispatch.OtherDispatchAllocationID;
            model.DispatchAllocationID      = dispatch.DispatchAllocationID;

            // model.ProjectNumber = dispatch.ProjectNumber;
            //model.SINumber = dispatch.SINumber;
            //TODO:Check modification have any impact
            Transaction transaction = transactionObj;// Repository.Dispatch.GetDispatchTransaction(dispatch.DispatchID);

            if (transaction != null)
            {
                if (transaction.Stack != null)
                {
                    model.StackNumber = transaction.Stack.Value;
                }
                if (transaction.StoreID.HasValue)
                {
                    model.StoreID = transaction.StoreID.Value;
                }
                model.ProgramID = transaction.ProgramID;
                //model.ProjectNumber = transaction.ProjectCode.Value;
                model.SINumber        = transaction.ShippingInstruction.Value;
                model.CommodityTypeID = transaction.Commodity.CommodityTypeID;
            }
            model.DispatchDetails = DispatchDetailModel.GenerateDispatchDetailModels(dispatch.DispatchDetails);
            return(model);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the negative HUB Transaction.
 /// </summary>
 /// <param name="dispatchModel">The dispatch model.</param>
 /// <param name="dispatch">The dispatch.</param>
 /// <param name="detail">The detail.</param>
 /// <returns></returns>
 private Transaction GetStatisticsHUBTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
 {
     Transaction transaction = new Transaction();
     transaction.TransactionID = Guid.NewGuid();
     transaction.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, dispatch.HubID);
     transaction.ProgramID = dispatchModel.ProgramID;
     transaction.ParentCommodityID = detail.CommodityID;
     transaction.CommodityID = detail.CommodityID;
     transaction.HubID = dispatch.HubID;
     transaction.HubOwnerID = _unitOfWork.HubRepository.FindById(dispatch.HubID).HubOwnerID;
     transaction.LedgerID = Cats.Models.Ledger.Constants.STATISTICS_FREE_STOCK;
     transaction.QuantityInMT = -detail.DispatchedQuantityMT.Value;
     transaction.QuantityInUnit = -detail.DispatchedQuantity.Value;
     transaction.ShippingInstructionID = _shippingInstructionService.GetShipingInstructionId(dispatchModel.SINumber);
     //transaction.ProjectCodeID = _projectCodeService.GetProjectCodeId(dispatchModel.ProjectNumber);
     transaction.Stack = dispatchModel.StackNumber;
     transaction.StoreID = dispatchModel.StoreID;
     transaction.TransactionDate = DateTime.Now;
     transaction.UnitID = detail.Unit;
     return transaction;
 }
Exemplo n.º 4
0
        private Transaction GetGoodsOnHandHUBTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
        {
            Transaction transaction2 = new Transaction();
            transaction2.TransactionID = Guid.NewGuid();
            transaction2.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, dispatchModel.ToHubID.Value);
            transaction2.ProgramID = dispatchModel.ProgramID;
            transaction2.ParentCommodityID = detail.CommodityID;
            transaction2.CommodityID = detail.CommodityID;
            transaction2.HubID = dispatch.HubID;
            transaction2.HubOwnerID = _unitOfWork.HubRepository.FindById(dispatch.HubID).HubOwnerID;
            transaction2.LedgerID = Cats.Models.Ledger.Constants.GOODS_ON_HAND; //Previously GOODS_ON_HAND_UNCOMMITED
            transaction2.QuantityInMT = -detail.DispatchedQuantityMT.Value;
            transaction2.QuantityInUnit = -detail.DispatchedQuantity.Value;
            transaction2.ShippingInstructionID = _shippingInstructionService.GetShipingInstructionId(dispatchModel.SINumber);

            transaction2.ProjectCodeID = _projectCodeService.GetProjectCodeId(dispatchModel.ProjectNumber);
            transaction2.Stack = dispatchModel.StackNumber;
            transaction2.StoreID = dispatchModel.StoreID;
            transaction2.TransactionDate = DateTime.Now;
            transaction2.UnitID = detail.Unit;
            return transaction2;
        }
Exemplo n.º 5
0
 private Transaction GetCommitedToFDPTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
 {
     Transaction transaction = new Transaction();
     transaction.TransactionID = Guid.NewGuid();
     transaction.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.FDP, dispatch.FDPID.Value);
     transaction.ProgramID = dispatchModel.ProgramID;
     transaction.ParentCommodityID = detail.CommodityID;
     transaction.CommodityID = detail.CommodityID;
     transaction.HubID = dispatch.HubID;
     transaction.HubOwnerID = _unitOfWork.HubRepository.FindById(dispatch.HubID).HubOwnerID;
     transaction.LedgerID = Cats.Models.Ledger.Constants.COMMITED_TO_FDP;
     transaction.QuantityInMT = +detail.DispatchedQuantityMT.Value;
     transaction.QuantityInUnit = +detail.DispatchedQuantity.Value;
     transaction.ShippingInstructionID = _shippingInstructionService.GetShipingInstructionId(dispatchModel.SINumber);
     transaction.ProjectCodeID = _projectCodeService.GetProjectCodeId(dispatchModel.ProjectNumber);
     transaction.Stack = dispatchModel.StackNumber;
     transaction.StoreID = dispatchModel.StoreID;
     transaction.TransactionDate = DateTime.Now;
     transaction.UnitID = detail.Unit;
     return transaction;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Generates the dispatch detail.
        /// </summary>
        /// <param name="c">The c.</param>
        /// <returns></returns>
        private DispatchDetail GenerateDispatchDetail(DispatchDetailModel c)
        {
            if (c != null)
            {
                DispatchDetail dispatchDetail = new DispatchDetail()
                {
                    CommodityID = c.CommodityID,
                    Description = c.Description,
                    // DispatchDetailID = c.Id,
                    RequestedQuantityInMT = c.RequestedQuantityMT.Value,
                    //DispatchedQuantityInMT = c.DispatchedQuantityMT,
                    //DispatchedQuantityInUnit = c.DispatchedQuantity,
                    RequestedQunatityInUnit = c.RequestedQuantity.Value,
                    UnitID = c.Unit
                };
                if (c.Id.HasValue)
                {
                    dispatchDetail.DispatchDetailID = c.Id.Value;
                }

                return dispatchDetail;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 7
0
 //TODO: this section has to be cleaned
 /// <summary>
 /// Gets the positive FDP transaction.
 /// </summary>
 /// <param name="dispatchModel">The dispatch model.</param>
 /// <param name="dispatch">The dispatch.</param>
 /// <param name="detail">The detail.</param>
 /// <returns></returns>
 private Transaction GetGoodsInTransitFDPTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
 {
     Transaction transaction2 = new Transaction();
     transaction2.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.FDP, dispatchModel.FDPID.Value);
     transaction2.ProgramID = dispatchModel.ProgramID;
     transaction2.ParentCommodityID = detail.CommodityID;
     transaction2.CommodityID = detail.CommodityID;
     transaction2.HubID = dispatch.HubID;
     transaction2.HubOwnerID = _unitOfWork.HubRepository.FindById(dispatch.HubID).HubOwnerID;
     transaction2.LedgerID = Ledger.Constants.GOODS_IN_TRANSIT;
     transaction2.QuantityInMT = +detail.DispatchedQuantityMT.Value;
     transaction2.QuantityInUnit = +detail.DispatchedQuantity.Value;
     transaction2.ShippingInstructionID = _shippingInstructionService.GetShipingInstructionId(dispatchModel.SINumber);
     transaction2.ProjectCodeID = _projectCodeService.GetProjectCodeId(dispatchModel.ProjectNumber);
     transaction2.Stack = dispatchModel.StackNumber;
     transaction2.StoreID = dispatchModel.StoreID;
     transaction2.TransactionDate = DateTime.Now;
     transaction2.UnitID = detail.Unit;
     return transaction2;
 }
Exemplo n.º 8
0
        private static DispatchDetailModel GenerateReceiveDetailModel(DispatchDetail dispatchDetail)
        {
            DispatchDetailModel model = new DispatchDetailModel();
            model.Id = dispatchDetail.DispatchDetailID;
            model.DispatchID = dispatchDetail.DispatchID;

            model.CommodityID = dispatchDetail.CommodityID;
            model.Description = dispatchDetail.Description;
            model.Unit = dispatchDetail.UnitID;
            model.RequestedQuantity = dispatchDetail.RequestedQunatityInUnit;
            model.RequestedQuantityMT = dispatchDetail.RequestedQuantityInMT;
            model.DispatchedQuantity = dispatchDetail.DispatchedQuantityInUnit;
            model.DispatchedQuantityMT = dispatchDetail.DispatchedQuantityInMT;

            return model;
        }