|
@ -4,6 +4,7 @@ using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using EFCore.BulkExtensions; |
|
|
using EFCore.BulkExtensions; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
using SettleAccount.Bases; |
|
|
using SettleAccount.Bases; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
@ -1192,8 +1193,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
{ |
|
|
{ |
|
|
dic.Add(itm.GroupNum, itm.Amt); |
|
|
dic.Add(itm.GroupNum, itm.Amt); |
|
|
copyDic.Add(itm.GroupNum, itm.Amt); |
|
|
copyDic.Add(itm.GroupNum, itm.Amt); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, List<string>> invoiceMap = new Dictionary<string, List<string>>(); |
|
|
Dictionary<string, List<string>> invoiceMap = new Dictionary<string, List<string>>(); |
|
|
|
|
|
var first=p_list.FirstOrDefault(); |
|
|
foreach (var itm in dic) |
|
|
foreach (var itm in dic) |
|
|
{ |
|
|
{ |
|
|
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); |
|
|
string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); |
|
@ -1203,31 +1210,71 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
// List<string> luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
|
|
|
// List<string> luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
|
|
|
if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组
|
|
|
if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组
|
|
|
{ |
|
|
{ |
|
|
foreach (var _itm1 in copyDic) |
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
{ |
|
|
{ |
|
|
if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化
|
|
|
foreach (var _itm1 in copyDic) |
|
|
{ |
|
|
{ |
|
|
invoiceGroupNumList.Add(itm.Key); |
|
|
if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化
|
|
|
continue; |
|
|
{ |
|
|
|
|
|
invoiceGroupNumList.Add(itm.Key); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
//var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
|
|
|
|
|
|
//luList.AddRange(grouplist);
|
|
|
|
|
|
//luList = luList.Distinct().ToList();
|
|
|
|
|
|
//if (luList.Count > 20)//累加零件不超过20种
|
|
|
|
|
|
//{
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
//}
|
|
|
|
|
|
sum += _itm1.Value; |
|
|
|
|
|
if (sum > 10000000) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
|
|
|
} |
|
|
} |
|
|
//var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
|
|
|
invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系
|
|
|
//luList.AddRange(grouplist);
|
|
|
foreach (var rem in invoiceGroupNumList)//移除
|
|
|
//luList = luList.Distinct().ToList();
|
|
|
|
|
|
//if (luList.Count > 20)//累加零件不超过20种
|
|
|
|
|
|
//{
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
//}
|
|
|
|
|
|
sum += _itm1.Value; |
|
|
|
|
|
if (sum > 10000000) |
|
|
|
|
|
{ |
|
|
{ |
|
|
break; |
|
|
copyDic.Remove(rem); |
|
|
} |
|
|
} |
|
|
invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
|
|
|
|
|
|
} |
|
|
} |
|
|
invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系
|
|
|
else |
|
|
foreach (var rem in invoiceGroupNumList)//移除
|
|
|
|
|
|
{ |
|
|
{ |
|
|
copyDic.Remove(rem); |
|
|
int count = 1; |
|
|
|
|
|
foreach (var _itm1 in copyDic) |
|
|
|
|
|
{ |
|
|
|
|
|
if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化
|
|
|
|
|
|
{ |
|
|
|
|
|
invoiceGroupNumList.Add(itm.Key); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (count > 14) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
//var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
|
|
|
|
|
|
//luList.AddRange(grouplist);
|
|
|
|
|
|
//luList = luList.Distinct().ToList();
|
|
|
|
|
|
//if (luList.Count > 20)//累加零件不超过20种
|
|
|
|
|
|
//{
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
//}
|
|
|
|
|
|
sum += _itm1.Value; |
|
|
|
|
|
if (sum > 10000000) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
|
|
|
|
|
|
count++; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系
|
|
|
|
|
|
foreach (var rem in invoiceGroupNumList)//移除
|
|
|
|
|
|
{ |
|
|
|
|
|
copyDic.Remove(rem); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -1452,8 +1499,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
//}
|
|
|
//}
|
|
|
_invls = invlist.Select(p => p.InvbillNum).ToList(); |
|
|
_invls = invlist.Select(p => p.InvbillNum).ToList(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return _invls; |
|
|
return _invls; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|