Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
41fcd25c30
  1. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
  3. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs
  5. 85
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

6
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -288,7 +288,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class INVOICE_WAIT_DETAIL_BJ_DTO
{
///// <summary>
/////期间
///// </summary>
//[Display(Name = "行号")]
//public int LineCode { get; set; }
/// <summary>
///期间
/// </summary>

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs

@ -164,12 +164,12 @@ namespace Win.Sfs.SettleAccount.Bases
{
return ApplicationConsts.SuccessStr;
}
public virtual async Task<TEntity> GetMainAsync([FromBody] string billNum)
protected virtual async Task<TEntity> GetMainAsync([FromBody] string billNum)
{
return await _repository.Where(p=>p.InvGroupNum == billNum).FirstOrDefaultAsync();
}
public virtual async Task<List<TEntityDetail>> GetDetailAsync([FromBody] string billNum)
protected virtual async Task<List<TEntityDetail>> GetDetailAsync([FromBody] string billNum)
{
return await _detailRepository.Where(p => p.InvGroupNum == billNum).ToListAsync();
}

15
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -316,17 +316,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
SettleGroupNum = p.FirstOrDefault().SettleGroupNum,
}
);
var all= entity.INVOICE_NOT_SETTLE.Select(p => p.SettleGroupNum).Distinct().ToList();//全部分组号
var part = mquery.ToList().Select(p => p.SettleGroupNum).Distinct().ToList();//发票对应分组号
var unsettled= all.Where(p => !part.Contains(p));//排除发票对应分组号,都为不可结
var unsettledList= entity.INVOICE_NOT_SETTLE.Where(p => unsettled.Contains(p.SettleGroupNum))
.GroupBy(p => new { p.LU, p.SettleGroupNum })
.Select(p => new UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) });
entity.UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList();
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList();
return entity;
@ -336,7 +332,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities);
foreach (var itm in dtoDetails)
@ -404,6 +399,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
_excel.Append(bj, "发票明细");
}
else
@ -413,8 +409,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_excel.Append(m, "发票结算分组对应");//发票分组对应结算号
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO)
{
_excel.Append(unsettle, "未结零件分组汇总");
_excel.Append(unsettle, "未结零件结算汇总");
}
foreach (var itm in entities)
{
var mgroup =m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
@ -428,7 +428,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO() {
LU =p.Key.LU,
RealInvBillNum =p.Key.RealInvBillNum,
@ -505,8 +504,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_excel.Append(ls, "结算分组零件" + itm.InvbillNum);
}
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs

@ -51,6 +51,8 @@ public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot<Guid>
public DateTime BeginDate { get; set; }
[Display(Name = "价格结束日期")]
public DateTime EndDate { get; set; }
[Display(Name = "行号")]
public int LineCode { get; set; }

85
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -773,7 +773,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var involdList = invList.Where(p => oldinvs.Contains(p.ParentInvbillNum)).ToList();
var involdname = involdList.Select(p => p.InvbillNum);
var adjlist = _adjRepository.Where(p => involdname.Contains(p.InvBillNum));
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
@ -799,7 +798,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
);
detail.RealPartCode = itm.RealPartCode;//厂内替换零件号
detail.ErpLoc = itm.ErpLoc;//ERP库位
entityList.Add(detail);
}
}
@ -877,8 +875,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
extend2: string.Empty,
extend3: string.Empty,
extend4: itm.PartCode
);
entity.RELU =string.IsNullOrEmpty(itm.RealPartCode)?itm.PartCode:itm.RealPartCode;//厂内替换零件号
entity.Extend2 = itm.ErpLoc;//ERP库位
@ -1353,8 +1350,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
List<string> lsby = new List<string>();
var grouplist = p_list.Select(p => p.GroupNum).Distinct().ToList();//可结分组
lsby.AddRange(grouplist);
@ -1578,7 +1573,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
@ -1590,12 +1585,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param>
public async Task<List<string>> MakeInvoice<TDetail>(List<TDetail> details,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, bool p_first) where TDetail : SA_CAN_BASE
public async Task<List<string>> MakeInvoice<TDetail>(List<TDetail> details, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, bool p_first) where TDetail : SA_CAN_BASE
{
List<string> _invls = new List<string>();
var groups1 = dtos.GroupBy(p => new { p.PartCode,p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
var groups1 = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
{
PartCode=p.Key.PartCode,
PartCode = p.Key.PartCode,
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
@ -1604,9 +1599,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
BeginDate = p.Key.BeginDate,
EndDate = p.Key.EndDate
}).ToList();//汇总记录不出现重复值
var groups = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
var groups = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
{
PartCode=p.Key.PartCode,
PartCode = p.Key.PartCode,
LU = p.Key.LU,
Amt = p.Sum(itm => itm.Amt),
Qty = p.Sum(itm => itm.Qty),
@ -1619,7 +1614,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var group in groups)
{
int i = groups1.Count(p => p.LU == group.LU
&& p.PartCode==group.PartCode
&& p.PartCode == group.PartCode
&& p.BeginDate == group.BeginDate
&& p.EndDate == group.EndDate
&& p.ContractDocID == group.ContractDocID
@ -1644,7 +1639,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
&& group.BeginDate == group1.BeginDate
&& group.EndDate == group1.EndDate
&& group1.ContractDocID == group.ContractDocID
&& group1.PartCode== group1.PartCode
&& group1.PartCode == group1.PartCode
)
{
tempList.Add(group1);
@ -1666,13 +1661,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invoiceMap.Add(invoiceBillNum, tempList);//每张发票的明细记录
var query = from itm in groups1
join itm1 in tempList
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID ,itm.PartCode}
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID,itm1.PartCode } into temp
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID, itm.PartCode }
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID, itm1.PartCode } into temp
from tm in temp
where tm == null
select new TMEP_INV
{
PartCode= itm.PartCode,
PartCode = itm.PartCode,
LU = itm.LU,
Amt = itm.Amt,
Qty = itm.Qty,
@ -1695,23 +1690,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
var key = group.Key;//发票票号
var ls = group.Value;//发票明细
//更新结算记录更新
var query = from itm in dtos
join itm1 in ls
on new { LU=itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate }
join itm2 in details on new { itm.LU,itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.LU,itm2.PartCode,itm2.PN,itm2.SettleDate }
select itm2;
foreach (var itm in query)
{
itm.InvbillNum = key;
salist.Add(itm);
}
//更新结算记录更新
var query = from itm in dtos
join itm1 in ls
on new { LU = itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate }
join itm2 in details on new { itm.LU, itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.LU, itm2.PartCode, itm2.PN, itm2.SettleDate }
select itm2;
foreach (var itm in query)
{
itm.InvbillNum = key;
salist.Add(itm);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))//发票作废开票
{
var query1 = from itm in dtos
join itm1 in ls
on new {LU= itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate }
on new { LU = itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate }
join itm2 in p_adjlist on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate }
select itm2;
@ -1721,7 +1716,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
adjlist.Add(itm);
}
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in ls)
{
@ -1740,8 +1734,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode:detail.PartCode
partcode: detail.PartCode
));
}
if (_entityDetailList.Count > 0)
@ -1766,10 +1759,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: p_parentInvBillNum,
preTaxDiff:0,
taxDiff:0,
clientCode:string.Empty,
realAmt:0
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
realAmt: 0
);
invbill.Site = dtos.FirstOrDefault().Site;
@ -1954,10 +1947,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
detailList.AddRange(_entityDetailList);
}
string site = dtos.FirstOrDefault().Site;
string clientCode = string.Empty;
switch (site)
{
case "1040":
@ -1993,32 +1984,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
if(salist.Count>0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
if(adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
if (p_notlist.Count > 0)
if(p_notlist.Count > 0)
{
var innotls = new List<INVOICE_NOT_SETTLE>();
var notls = p_notlist.GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) });
foreach (var nitm in notls)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum,
lU: string.Empty,
lU: nitm.LU,
lU1: nitm.LU,
extend1: string.Empty,
extend2: string.Empty,
@ -2031,7 +2020,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
_invls = invlist.Select(p => p.InvbillNum).ToList();
}
return _invls;
}
@ -2099,9 +2087,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
return false;
}
_repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv });
return true;
}
@ -2198,7 +2183,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
adjdetails.Add(detail);
}
}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID })
.Select(itm => new
{
@ -2213,7 +2197,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
EndDate = itm.Key.EndDate
})
.ToList();
var query = from inv1 in invdetails
join dto1 in dtos on
new { inv1.LU,inv1.PartCode, inv1.PN,inv1.Id } equals new { dto1.LU,dto1.PartCode, dto1.PN ,dto1.Id

Loading…
Cancel
Save