private void CopyConsignmentBillEntry(object obj) { if (SelectedConsignmentBill == null) { return; } string ownerName = _consignmentService.GetConsignmentBillLockOwner(SelectedConsignmentBill.BillNo, SelectedConsignmentBill.UserId); if (string.IsNullOrEmpty(ownerName)) { if (SelectedConsignmentBillEntry == null) { return; } ConsignmentBillEntryCopyView add = new ConsignmentBillEntryCopyView(); var cloneData = TransExpV2 <ConsignmentBillEntryModel, ConsignmentBillEntryModel> .Trans(SelectedConsignmentBillEntry); cloneData.IsChecked = true; cloneData.EntryId = ConsignmentBillEntries.Max(m => m.EntryId) + 1; cloneData.IsSystem = false; cloneData.ECurrencyQuantity = 0; (add.DataContext as ConsignmentBillEntryCopyViewModel).WithParam(cloneData, (type, entry) => { add.Close(); if (type == 1) { // 修改字表界面和后台 int id = _consignmentService.AddConsignmentBillEntry(entry, user.ID); entry.ETotalQuantity = entry.ECurrencyQuantity; entry.EUndoQuantity = entry.ECurrencyQuantity; entry.Id = id; ConsignmentBillEntries.Add(entry); // 修改主表界面和后台 SelectedConsignmentBill.CurrencyQuantity += entry.ECurrencyQuantity; SelectedConsignmentBill.UndoQuantity += entry.ECurrencyQuantity; SelectedConsignmentBill.TotalQuantity += entry.ECurrencyQuantity; _consignmentService.UpdateConsignmentBill(SelectedConsignmentBill); } }); add.ShowDialog(); } else { MessageBox.Show($"该记录正在被【{ownerName}】使用,请选择其他数据"); } }
private void ChangeSelectedConsignmentBill(object obj) { if (obj != null) { SelectedConsignmentBill = (ConsignmentBillModel)obj; ConsignmentBillEntries.Clear(); _consignmentService.GetAllConsignmentBillEntryById(SelectedConsignmentBill.InterId).ToList().ForEach(x => ConsignmentBillEntries.Add(x)); } }