/// <summary> /// 从页面数据生成批次对象,供保存用 /// </summary> /// <returns></returns> private VATInvoiceRequestLine SetLineByPage() { var currentLine = new VATInvoiceRequestLine(); if (ObjectId == 0) { int id = GetVATId(); currentLine.Id = id; currentLine.ApproveStatus = 0; } else { currentLine.Id = ObjectId; using ( var lineService = SvcClientManager.GetSvcClient<VATInvoicedRequestLineServiceClient>( SvcType.VATInvoiceRequestLineSvc)) { VATInvoiceRequestLine line = lineService.GetById(ObjectId); if (line != null) { currentLine.ApproveStatus = line.ApproveStatus; } } } currentLine.QuotaId = QuotaId; Quota quota; using (var quotaService = SvcClientManager.GetSvcClient<QuotaServiceClient>(SvcType.QuotaSvc)) { quota = quotaService.FetchById(QuotaId, new List<string> {"Deliveries", "WarehouseOuts"}); if (quota != null) { FilterDeleted(quota.Deliveries); FilterDeleted(quota.WarehouseOuts); quota.IsVatRequestFinished = IsVatRequestFinished; } } if (QuotaList.Count > 0) { List<Quota> quotaList = QuotaList.Where(c => c.Id == QuotaId).ToList(); if (quotaList.Count > 0) { Quota oldQuota = quotaList[0]; QuotaList.Remove(oldQuota); } } QuotaList.Add(quota); currentLine.Quota = quota; currentLine.RequestQuantity = RequestQuantity; currentLine.RequestAmount = RequestAmount; currentLine.RequestPrice = RequestPrice; currentLine.Comment = Comment; currentLine.UnOpenedQuantity = UnOpenedQuantity; currentLine.VATInvoiceRequestId = VATInvoiceRequestId; return currentLine; }
/// <summary> /// 新增批次 /// </summary> /// <param name="line"> </param> public void AddLine(VATInvoiceRequestLine line) { if (ShowVATInvoiceRequestLines == null) ShowVATInvoiceRequestLines = new List<VATInvoiceRequestLine>(); int no = GetLineId(); line.Id = -no; ShowVATInvoiceRequestLines.Add(line); if (AddVATInvoiceRequestLines == null) { AddVATInvoiceRequestLines = new List<VATInvoiceRequestLine>(); } AddVATInvoiceRequestLines.Add(line); }
public VATInvoiceRequestLineDetailVM(int id, List<VATInvoiceRequestLine> lines, List<VATInvoiceRequestLine> addedLines, List<VATInvoiceRequestLine> updatedLines, List<Quota> quotaList) { ObjectId = id; ShowVATInvoiceRequestLines = lines; AddVATInvoiceRequestLines = addedLines; UpdateVATInvoiceRequestLines = updatedLines; QuotaList = quotaList; CurrentLine = GetLineFromList(id, lines); PropertyChanged += VATInvoiceLineDetailVMPropertyChanged; Initialize(); }