|
|
@ -1,4 +1,4 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
@ -12,9 +12,12 @@ using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using SettleAccount.Domain.BQ; |
|
|
|
using ShardingCore.Extensions; |
|
|
|
using Shouldly; |
|
|
|
using SqlSugar; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win.Abp.Snowflakes; |
|
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
@ -187,8 +190,26 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var B = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false); |
|
|
|
|
|
|
|
B.OrderBy(p => p.LineCode); |
|
|
|
var BMap = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BJ_DTO>>(B); |
|
|
|
|
|
|
|
List<INVOICE_WAIT_DETAIL_BJ_DTO> BMap = new List<INVOICE_WAIT_DETAIL_BJ_DTO>(); |
|
|
|
foreach (var itm in B) |
|
|
|
{ |
|
|
|
INVOICE_WAIT_DETAIL_BJ_DTO bj = new INVOICE_WAIT_DETAIL_BJ_DTO(); |
|
|
|
bj.LU = itm.LU; |
|
|
|
bj.PartCode = itm.PartCode; |
|
|
|
bj.PRICE = itm.PRICE; |
|
|
|
|
|
|
|
//bj.InvGroupNum = itm.InvGroupNum;
|
|
|
|
//bj.DeliveryNumber= itm.GetProperty("DeliveryNumber", "");//交货号
|
|
|
|
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
|
|
|
|
//bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
|
|
|
|
//bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称
|
|
|
|
//bj.PurchaseOrderNumber = itm.GetProperty("PurchaseOrderNumber", "");//采购订单号
|
|
|
|
//bj.DeliveryIndexNumber = itm.GetProperty("DeliveryIndexNumber", "");//交付索引号
|
|
|
|
//bj.PartName = itm.GetProperty("PartName", "");//零件名称
|
|
|
|
} |
|
|
|
|
|
|
|
//var BMap = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BJ_DTO>>(B);
|
|
|
|
var wquery = from itm in BMap |
|
|
|
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum |
|
|
|
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp |
|
|
@ -207,7 +228,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
PRICE = itm.PRICE, |
|
|
|
Qty = itm.Qty, |
|
|
|
Amt = itm.Amt, |
|
|
|
BussiessType = itm.BussiessType, |
|
|
|
DeliveryNumber = itm.DeliveryNumber , |
|
|
|
VendorCode = itm.VendorCode , |
|
|
|
VendorName = itm.VendorName , |
|
|
|
PurchaseOrderNumber = itm.PurchaseOrderNumber, |
|
|
|
DeliveryIndexNumber =itm.DeliveryIndexNumber , |
|
|
|
Extend1 = itm.Extend1, |
|
|
|
BeginDate = itm.BeginDate, |
|
|
|
EndDate = itm.EndDate, |
|
|
@ -217,7 +242,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount).ConfigureAwait(false); |
|
|
|
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); |
|
|
|
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w); |
|
|
|
var wquery = from itm in wdtos |
|
|
|
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum |
|
|
@ -226,7 +251,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
select |
|
|
|
new INVOICE_WAIT_DETAIL_DTO() |
|
|
|
{ |
|
|
|
|
|
|
|
PartDesc = tm == null ? string.Empty : itm.PartDesc, |
|
|
|
InvDate = itm1.CreationTime, |
|
|
|
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum, |
|
|
@ -304,15 +328,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
SettleGroupNum = p.FirstOrDefault().SettleGroupNum, |
|
|
|
} |
|
|
|
); |
|
|
|
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC) |
|
|
|
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC)//BBAC直供未结
|
|
|
|
{ |
|
|
|
//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 = sdtos |
|
|
|
.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(); |
|
|
|
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) }); |
|
|
|
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); |
|
|
|
} |
|
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO) |
|
|
|
{ |
|
|
|
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
|
|
|
|
} |
|
|
|
|
|
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC) |
|
|
@ -324,7 +352,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
entity.INVOICE_MAP_GROUP = mdtos; |
|
|
|
} |
|
|
|
|
|
|
|
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); |
|
|
|
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList(); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
[HttpPost] |
|
|
@ -386,6 +414,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
var bj = invdetail.INVOICE_WAIT_DETAIL_BJ;//备件明细
|
|
|
|
var unsettle = invdetail.UNSETTLED_DETAIL;//全部未结明细
|
|
|
|
|
|
|
|
|
|
|
|
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; |
|
|
|
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; |
|
|
|
|
|
|
@ -408,7 +437,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
{ |
|
|
|
_excel.Append(m, "发票结算分组对应");//发票分组对应结算号
|
|
|
|
} |
|
|
|
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC) |
|
|
|
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC ) |
|
|
|
{ |
|
|
|
_excel.Append(unsettle, "未结零件结算汇总"); |
|
|
|
} |
|
|
|