private void UnSelectedAllConsignmentBill(object obj) { if (ConsignmentBills.Count == 0) { return; } if (ConsignmentBills.Where(m => m.SelectedStatus > 0).Count() > 0)// 反选 { var bills = ConsignmentBills.Where(m => m.SelectedStatus > 0); if (bills.Count() > 0) { StringBuilder sb = new StringBuilder(); foreach (var item in bills) { SelectedConsignmentBillLists.Remove(SelectedConsignmentBillLists.FirstOrDefault(x => x.InterId == item.InterId)); sb.Append(",'" + item.BillNo + "'"); } _consignmentService.RemoveUserCurrencyOperation(sb.ToString().Substring(1)); SelectedConsignmentSum = SelectedConsignmentBillLists.Where(m => m.SelectedStatus > 0).Sum(m => m.CurrencyQuantity); QuerySignmentBill(null); } } }
private void SelectedAllConsignmentBill(object obj) { if (ConsignmentBills.Count == 0) { return; } if (ConsignmentBills.Where(m => m.SelectedStatus == 0).Count() > 0) { // 查询有没有被锁定的数据 string billNos = "'" + string.Join("','", ConsignmentBills.Select(m => m.BillNo)) + "'"; string lockstring = _consignmentService.GetConsignmentBillLockOwner(user.ID, billNos); bool r = ConsignmentBills.Where(m => m.CurrencyQuantity == 0).Count() > 0; StringBuilder sb = new StringBuilder(); if (string.IsNullOrEmpty(lockstring) || r) { foreach (var item in ConsignmentBills) { if (SelectedConsignmentBillLists.Where(x => x.InterId == item.InterId).Count() == 0) { item.SelectedStatus = item.TotalQuantity == item.CurrencyQuantity ? 2 : 1; SelectedConsignmentBillLists.Add(item); sb.Append(",'" + item.BillNo + "'"); } } _consignmentService.AddUserCurrencyOperation(user.ID, sb.ToString().Substring(1)); SelectedConsignmentSum = SelectedConsignmentBillLists.Where(m => m.SelectedStatus > 0).Sum(m => m.CurrencyQuantity); QuerySignmentBill(null); } else { MessageBox.Show(lockstring + "!\r\n 或者已选数据的当前数量不能为0 ,不能批量选择"); } } }