コード例 #1
0
ファイル: DispatchViewModel.cs プロジェクト: ndrmc/cats-hub
        /// <summary>
        /// Generates the dispatch model.
        /// </summary>
        /// <param name="dispatch">The dispatch.</param>
        /// <param name="Repository">The repository.</param>
        /// <returns></returns>
        public static Models.DispatchModel GenerateDispatchModel(BLL.Dispatch dispatch, Transaction transactionObj)
        {
            DispatchModel model = new DispatchModel();

            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
            BLL.Transaction transaction = transactionObj;// Repository.Dispatch.GetDispatchTransaction(dispatch.DispatchID);
            if (transaction != null)
            {
                if (transaction.Stack != null)
                {
                    model.StackNumber = transaction.Stack.Value;
                }
                model.StoreID         = transaction.StoreID;
                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);
        }
コード例 #2
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);
        }
コード例 #3
0
 /// <summary>
 /// Gets the positive 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 GetPositiveHUBTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
 {
     Transaction transaction2 = new Transaction();
     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 = Ledger.Constants.GOODS_DISPATCHED;
     transaction2.QuantityInMT = +detail.DispatchedQuantityMT.Value;
     transaction2.QuantityInUnit = +detail.DispatchedQuantity.Value;
     transaction2.ShippingInstructionID = _shippingInstructionService.GetShipingInstructionId(dispatchModel.SINumber);
     //TODO:After Implmenting ProjectCodeService Return here
     //transaction2.ProjectCodeID = _projectCodeService.GetProjectCodeId(dispatchModel.ProjectNumber);
     transaction2.Stack = dispatchModel.StackNumber;
     transaction2.StoreID = dispatchModel.StoreID;
     transaction2.TransactionDate = DateTime.Now;
     transaction2.UnitID = detail.Unit;
     return transaction2;
 }
コード例 #4
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 GetNegativeHUBTransaction(DispatchModel dispatchModel, Dispatch dispatch, DispatchDetailModel detail)
 {
     Transaction transaction = new Transaction();
     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 = Ledger.Constants.GOODS_ON_HAND_UNCOMMITED;
     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;
 }
コード例 #5
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 BLL.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;
            }
        }
コード例 #6
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;
        }