Exemplo n.º 1
0
        /// <summary>
        ///     插入新订单行
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="dto">订单DTO</param>
        /// <param name="line">订单行DTO</param>
        /// <param name="importType">引进方式</param>
        /// <param name="supplierId">供应商ID</param>
        private void InsertOrderLine(EnginePurchaseOrder order, EnginePurchaseOrderDTO dto,
            EnginePurchaseOrderLineDTO line, ActionCategory importType, int supplierId)
        {
            // 获取飞机物料机型
            var material =
                _materialRepository.GetFiltered(m => m.Id == line.EngineMaterialId)
                    .OfType<EngineMaterial>()
                    .FirstOrDefault();
            var pnReg = _pnRegRepository.GetFiltered(p => p.Pn == material.Pn).FirstOrDefault();
            if (material == null)
            {
                throw new ArgumentException("未能获取飞机物料!");
            }

            // 添加订单行
            var orderLine = order.AddNewEnginePurchaseOrderLine(line.UnitPrice, line.Amount,
                line.Discount,
                line.EstimateDeliveryDate);
            orderLine.SetEngineMaterial(line.EngineMaterialId);

            // 创建或引用合同发动机
            var persist = _contractEngineRepository.Get(line.ContractEngineId) as PurchaseContractEngine;
            var contractEngine = ContractEngineFactory.CreatePurchaseContractEngine(dto.Name,
                line.RankNumber);
            contractEngine.ChangeCurrentIdentity(line.ContractEngineId);
            contractEngine.SetImportCategory(importType);
            contractEngine.SetSerialNumber(line.SerialNumber);
            contractEngine.SetSupplier(supplierId);
            contractEngine.SetPart(pnReg);
            if (persist == null)
            {
                orderLine.SetContractEngine(contractEngine);
            }
            else
            {
                orderLine.SetContractEngine(persist);
                _contractEngineRepository.Merge(persist, contractEngine);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     插入新订单行
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="dto">订单DTO</param>
        /// <param name="line">订单行DTO</param>
        /// <param name="importType">引进方式</param>
        /// <param name="supplierId">供应商ID</param>
        private void InsertOrderLine(AircraftPurchaseOrder order, AircraftPurchaseOrderDTO dto,
            AircraftPurchaseOrderLineDTO line, ActionCategory importType, int supplierId)
        {
            // 获取飞机物料机型
            var material =
                _materialRepository.GetFiltered(m => m.Id == line.AircraftMaterialId)
                    .OfType<AircraftMaterial>()
                    .FirstOrDefault();
            if (material == null)
            {
                throw new ArgumentException("未能获取飞机物料!");
            }
            var aircraftTypeId = material.AircraftTypeId;

            // 添加订单行
            var orderLine = order.AddNewAircraftPurchaseOrderLine(line.UnitPrice, line.Amount,
                line.Discount,
                line.EstimateDeliveryDate);
            orderLine.SetCost(line.AirframePrice, line.RefitCost, line.EnginePrice);
            orderLine.SetAircraftMaterial(line.AircraftMaterialId);

            // 创建或引用合同飞机
            var persist = _contractAircraftRepository.Get(line.ContractAircraftId) as PurchaseContractAircraft;
            var contractAircraft = ContractAircraftFactory.CreatePurchaseContractAircraft(dto.Name, line.RankNumber);
            contractAircraft.ChangeCurrentIdentity(line.ContractAircraftId);
            contractAircraft.SetAircraftType(aircraftTypeId);
            contractAircraft.SetImportCategory(importType);
            contractAircraft.SetCSCNumber(line.CSCNumber);
            contractAircraft.SetSerialNumber(line.SerialNumber);
            contractAircraft.SetSupplier(supplierId);
            contractAircraft.SetPlanAircraft(line.PlanAircraftID);
            if (persist == null)
            {
                orderLine.SetContractAircraft(contractAircraft);
            }
            else
            {
                orderLine.SetContractAircraft(persist);
                _contractAircraftRepository.Merge(persist, contractAircraft);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     插入新订单行
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="dto">订单DTO</param>
        /// <param name="line">订单行DTO</param>
        /// <param name="importType">引进方式</param>
        /// <param name="supplierId">供应商ID</param>
        private void InsertOrderLine(BFEPurchaseOrder order, BFEPurchaseOrderDTO dto,
            BFEPurchaseOrderLineDTO line, ActionCategory importType, int supplierId)
        {
            // 获取飞机物料机型
            var material =
                _materialRepository.GetFiltered(m => m.Id == line.BFEMaterialId)
                    .OfType<BFEMaterial>()
                    .FirstOrDefault();
            if (material == null)
            {
                throw new ArgumentException("未能获取飞机物料!");
            }

            // 添加订单行
            var orderLine = order.AddNewBFEPurchaseOrderLine(line.UnitPrice, line.Amount, line.Discount,
                line.EstimateDeliveryDate);
            orderLine.SetBFEMaterial(line.BFEMaterialId);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     设置引进方式
        /// </summary>
        /// <param name="importCategory">引进方式</param>
        public void SetImportCategory(ActionCategory importCategory)
        {
            if (importCategory == null || importCategory.IsTransient())
            {
                throw new ArgumentException("引进方式参数为空!");
            }

            ImportCategory = importCategory;
            ImportCategoryId = importCategory.Id;
        }