Пример #1
0
        private void OnAddOrderLine(object obj)
        {
            SelAircraftPurchaseOrderLineDTO = new AircraftPurchaseOrderLineDTO
            {
                Id = RandomHelper.Next(),
                Amount = 1,
                EstimateDeliveryDate = DateTime.Now,
                ContractAircraftId = RandomHelper.Next(),
            };

            SelAircraftPurchaseOrderDTO.AircraftPurchaseOrderLines.Add(SelAircraftPurchaseOrderLineDTO);
        }
Пример #2
0
 private void OnAddOrder(object obj)
 {
     if (SelAircraftPurchaseOrderDTO == null)
     {
         SelAircraftPurchaseOrderDTO = new AircraftPurchaseOrderDTO
         {
             Id = RandomHelper.Next(),
             OrderDate = DateTime.Now,
             TradeId = _selTradeDTO.Id,
             SourceGuid = Guid.NewGuid(),
             SupplierId = _selTradeDTO.SupplierId,
             OperatorName = StatusData.curUser
         };
         var currency = Currencies.FirstOrDefault();
         if (currency != null)
             SelAircraftPurchaseOrderDTO.CurrencyId = currency.Id;
         ViewAircraftPurchaseOrderDTO.AddNew(SelAircraftPurchaseOrderDTO);
         SelTradeDTO.Status = (int) TradeStatus.进行中;
     }
     else
     {
         var order =
             ViewAircraftPurchaseOrderDTO.Where(o => o.TradeId == _selTradeDTO.Id)
                 .OrderBy(o => o.Version)
                 .LastOrDefault();
         if (order == null) return;
         SelAircraftPurchaseOrderDTO = new AircraftPurchaseOrderDTO
         {
             Id = RandomHelper.Next(),
             OrderDate = DateTime.Now,
             TradeId = order.TradeId,
             Name = order.Name,
             CurrencyId = order.CurrencyId,
             LinkmanId = order.LinkmanId,
             SourceGuid = Guid.NewGuid(),
             SupplierId = order.SupplierId,
             OperatorName = StatusData.curUser
         };
         var currency = Currencies.FirstOrDefault();
         if (currency != null)
             SelAircraftPurchaseOrderDTO.CurrencyId = currency.Id;
         ViewAircraftPurchaseOrderDTO.AddNew(SelAircraftPurchaseOrderDTO);
         order.AircraftPurchaseOrderLines.ToList().ForEach(line =>
         {
             var newLine = new AircraftPurchaseOrderLineDTO
             {
                 Id = RandomHelper.Next(),
                 UnitPrice = line.UnitPrice,
                 Amount = line.Amount,
                 Discount = line.Discount,
                 AirframePrice = line.AirframePrice,
                 RefitCost = line.RefitCost,
                 EnginePrice = line.EnginePrice,
                 EstimateDeliveryDate = line.EstimateDeliveryDate,
                 Note = line.Note,
                 ContractAircraftId = line.ContractAircraftId,
                 AircraftMaterialId = line.AircraftMaterialId,
                 RankNumber = line.RankNumber,
                 CSCNumber = line.CSCNumber,
                 SerialNumber = line.SerialNumber,
                 Status = line.Status
             };
             SelAircraftPurchaseOrderDTO.AircraftPurchaseOrderLines.Add(newLine);
         });
     }
     RefreshCommandState();
 }