|
@ -1,9 +1,14 @@ |
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.Collections; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
|
|
using System.DirectoryServices.ActiveDirectory; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
|
|
|
using System.Security.Policy; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using DocumentFormat.OpenXml.Drawing; |
|
|
|
|
|
using DocumentFormat.OpenXml.Wordprocessing; |
|
|
using EFCore.BulkExtensions; |
|
|
using EFCore.BulkExtensions; |
|
|
using Magicodes.ExporterAndImporter.Core; |
|
|
using Magicodes.ExporterAndImporter.Core; |
|
|
using Magicodes.ExporterAndImporter.Csv; |
|
|
using Magicodes.ExporterAndImporter.Csv; |
|
@ -11,6 +16,7 @@ using Magicodes.ExporterAndImporter.Excel; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Http; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Microsoft.CodeAnalysis.Operations; |
|
|
using Microsoft.OpenApi.Writers; |
|
|
using Microsoft.OpenApi.Writers; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using ShardingCore.Extensions; |
|
|
using ShardingCore.Extensions; |
|
@ -27,11 +33,20 @@ using Win.Sfs.SettleAccount.Bases; |
|
|
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|
|
using Win.Sfs.SettleAccount.Bases.DomainServices; |
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Customers; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Temp; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.Invoices; |
|
|
|
|
|
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Suppliers; |
|
|
|
|
|
using Win.Sfs.Shared; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
using static Dm.parser.LVal; |
|
|
|
|
|
using static LinqToDB.Sql; |
|
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
@ -39,6 +54,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
[Route("api/settleaccount/[controller]/[action]")]
|
|
|
[Route("api/settleaccount/[controller]/[action]")]
|
|
|
public class INVOICE_SERVICE : BASE_SERVICE |
|
|
public class INVOICE_SERVICE : BASE_SERVICE |
|
|
{ |
|
|
{ |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据上下文
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly SettleAccountDbContext _settleAccountDbContext; |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// WMS数据上下文
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据中心S数据上下文
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly ExChangeCenterDbContext _exChangeCenterDbContext; |
|
|
|
|
|
|
|
|
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; |
|
|
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; |
|
|
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; |
|
|
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; |
|
|
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; |
|
|
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; |
|
@ -49,7 +77,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
private readonly HBPO_CAN_SA_MNG _hbpoMng; |
|
|
private readonly HBPO_CAN_SA_MNG _hbpoMng; |
|
|
private readonly INV_MNG _invMng; |
|
|
private readonly INV_MNG _invMng; |
|
|
private readonly BaseDomainService _baseservice; |
|
|
private readonly BaseDomainService _baseservice; |
|
|
public INVOICE_SERVICE(IExcelImportAppService excelImportService, |
|
|
public INVOICE_SERVICE( |
|
|
|
|
|
SettleAccountDbContext settleAccountDbContext, |
|
|
|
|
|
WMSBJBMPTDbContext wmsBJBMPTContext, |
|
|
|
|
|
ExChangeCenterDbContext exChangeCenterDbContext, |
|
|
|
|
|
IExcelImportAppService excelImportService, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
ICommonManager commonManager, |
|
|
ICommonManager commonManager, |
|
|
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|
|
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|
@ -65,6 +97,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
) : base(excelImportService, snowflakeIdGenerator, commonManager) |
|
|
) : base(excelImportService, snowflakeIdGenerator, commonManager) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_settleAccountDbContext = settleAccountDbContext; |
|
|
|
|
|
_wmsBJBMPTContext = wmsBJBMPTContext; |
|
|
|
|
|
_exChangeCenterDbContext = exChangeCenterDbContext; |
|
|
_baseservice = baseservice; |
|
|
_baseservice = baseservice; |
|
|
_repository = repository; |
|
|
_repository = repository; |
|
|
_wRepository = wRepository; |
|
|
_wRepository = wRepository; |
|
@ -77,6 +112,116 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
_invMng = invMng; |
|
|
_invMng = invMng; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 提交到QAD
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 已扣减发票提交到QAD
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
[HttpPost] |
|
|
|
|
|
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums) |
|
|
|
|
|
{ |
|
|
|
|
|
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>() |
|
|
|
|
|
.Where(t => invbillNums.Contains(t.InvbillNum)) |
|
|
|
|
|
.Where(t => t.State == SettleBillState.已扣减) |
|
|
|
|
|
.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
invbillNums = invoiceGrps.Select(t => t.InvbillNum).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var invoiceGrpDetails = _settleAccountDbContext.Set<INVOICE_WAIT_DETAIL>() |
|
|
|
|
|
.Where(t => invbillNums.Contains(t.InvbillNum)) |
|
|
|
|
|
.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var taskId = GuidGenerator.Create(); |
|
|
|
|
|
var teaTaskSub = new TEA_TASK_SUB() |
|
|
|
|
|
{ |
|
|
|
|
|
GUID = taskId, |
|
|
|
|
|
TaskState = 0, |
|
|
|
|
|
TaskID = taskId, |
|
|
|
|
|
TableName = "TED_SA_INV", |
|
|
|
|
|
Creator = "SAS", |
|
|
|
|
|
Subscriber = "QAD", |
|
|
|
|
|
Domain = "BJBMPT", |
|
|
|
|
|
Site = "BJ02", |
|
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
|
UpdateTime = DateTime.Now, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var tedSaInvs = invoiceGrpDetails.Join(invoiceGrps, x => x.InvbillNum, y => y.InvbillNum, (x, y) => |
|
|
|
|
|
{ |
|
|
|
|
|
return new TED_SA_INV() |
|
|
|
|
|
{ |
|
|
|
|
|
GUID = GuidGenerator.Create(), |
|
|
|
|
|
TaskID = taskId, |
|
|
|
|
|
InvoiceNumber = y.RealnvBillNum, |
|
|
|
|
|
SASInvoiceNumber = y.InvbillNum, |
|
|
|
|
|
Customer = y.ClientCode, |
|
|
|
|
|
BillTo = y.ClientCode, |
|
|
|
|
|
InvoiceDate = y.CreationTime, |
|
|
|
|
|
Site = "BJ02", |
|
|
|
|
|
TYPE = default, |
|
|
|
|
|
PartNumber = x.LU, |
|
|
|
|
|
InvoiceQuatity = x.Qty, |
|
|
|
|
|
Price = x.PRICE, |
|
|
|
|
|
Supplier = default, |
|
|
|
|
|
Remark = default, |
|
|
|
|
|
InvoiceNetAmount = x.Amt, |
|
|
|
|
|
InvoiceTaxAmount = x.Amt * 0.13m, |
|
|
|
|
|
TaxRate = 0.13m, |
|
|
|
|
|
Location = $"C{y.ClientCode}", |
|
|
|
|
|
InvoiceNet = default, |
|
|
|
|
|
InvoiceTax = default, |
|
|
|
|
|
begintime = x.BeginDate, |
|
|
|
|
|
endtime = x.EndDate, |
|
|
|
|
|
Domain = "BJBMPT" |
|
|
|
|
|
}; |
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var invoiceGrpTedSaInvs = invoiceGrps.Select(t => |
|
|
|
|
|
{ |
|
|
|
|
|
return new TED_SA_INV() |
|
|
|
|
|
{ |
|
|
|
|
|
GUID = GuidGenerator.Create(), |
|
|
|
|
|
TaskID = taskId, |
|
|
|
|
|
UID = default, |
|
|
|
|
|
InvoiceNumber = t.RealnvBillNum, |
|
|
|
|
|
SASInvoiceNumber = t.InvbillNum, |
|
|
|
|
|
Customer = t.ClientCode, |
|
|
|
|
|
BillTo = t.ClientCode, |
|
|
|
|
|
InvoiceDate = t.CreationTime, |
|
|
|
|
|
Site = "BJ02", |
|
|
|
|
|
TYPE = default, |
|
|
|
|
|
PartNumber = default, |
|
|
|
|
|
InvoiceQuatity = default, |
|
|
|
|
|
Price = default, |
|
|
|
|
|
Supplier = default, |
|
|
|
|
|
Remark = default, |
|
|
|
|
|
InvoiceNetAmount = default, |
|
|
|
|
|
InvoiceTaxAmount = default, |
|
|
|
|
|
TaxRate = 0.13m, |
|
|
|
|
|
Location = $"C{t.ClientCode}", |
|
|
|
|
|
InvoiceNet = t.Amt, |
|
|
|
|
|
InvoiceTax = default, |
|
|
|
|
|
begintime = default, |
|
|
|
|
|
endtime = default, |
|
|
|
|
|
Domain = "BJBMPT" |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
tedSaInvs.AddRange(invoiceGrpTedSaInvs); |
|
|
|
|
|
if (tedSaInvs.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
await _exChangeCenterDbContext.Set<TEA_TASK_SUB>().AddAsync(teaTaskSub).ConfigureAwait(false); |
|
|
|
|
|
await _exChangeCenterDbContext.Set<TED_SA_INV>().AddRangeAsync(tedSaInvs).ConfigureAwait(false); |
|
|
|
|
|
await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
|
|
|
invoiceGrps.ForEach(t => t.State = SettleBillState.已提交QAD); |
|
|
|
|
|
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
|
|
return new OkResult(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 通过审核
|
|
|
/// 通过审核
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
@ -196,24 +341,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
INVOICE_WAIT_DETAIL_BJ_DTO bj = new INVOICE_WAIT_DETAIL_BJ_DTO(); |
|
|
INVOICE_WAIT_DETAIL_BJ_DTO bj = new INVOICE_WAIT_DETAIL_BJ_DTO(); |
|
|
bj.LU = itm.LU; |
|
|
bj.LU = itm.LU; |
|
|
bj.InvbillNum=itm.InvbillNum; |
|
|
bj.InvbillNum = itm.InvbillNum; |
|
|
bj.PRICE = itm.PRICE; |
|
|
bj.PRICE = itm.PRICE; |
|
|
// bj.InvGroupNum = itm.InvGroupNum;
|
|
|
// bj.InvGroupNum = itm.InvGroupNum;
|
|
|
bj.DeliveryIndexNumber =itm.GetProperty("DeliveryIndexNumber",""); |
|
|
bj.DeliveryIndexNumber = itm.GetProperty("DeliveryIndexNumber", ""); |
|
|
bj.Qty = itm.Qty; |
|
|
bj.Qty = itm.Qty; |
|
|
bj.PRICE = itm.PRICE; |
|
|
bj.PRICE = itm.PRICE; |
|
|
bj.Amt = Math.Round(itm.PRICE * itm.Qty, 2); |
|
|
bj.Amt = Math.Round(itm.PRICE * itm.Qty, 2); |
|
|
bj.RealAmt = Math.Round(Math.Round(itm.PRICE * itm.Qty, 2) * 0.13m, 2); |
|
|
bj.RealAmt = Math.Round(Math.Round(itm.PRICE * itm.Qty, 2) * 0.13m, 2); |
|
|
bj.TaxAmt = Math.Round(itm.PRICE * itm.Qty, 2) + Math.Round(Math.Round(itm.PRICE * itm.Qty, 2) * 0.13m, 2); |
|
|
bj.TaxAmt = Math.Round(itm.PRICE * itm.Qty, 2) + Math.Round(Math.Round(itm.PRICE * itm.Qty, 2) * 0.13m, 2); |
|
|
bj.Extend1=itm.Extend1;//合同号
|
|
|
bj.Extend1 = itm.Extend1;//合同号
|
|
|
bj.VendorCode = itm.GetProperty("VendorCode","");//供应商代码
|
|
|
bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
|
|
|
bj.VendorName = itm.GetProperty("VendorName","");//供应商名称
|
|
|
bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称
|
|
|
bj.DeliveryNumber = itm.GetProperty("DeliveryNumber","");//交货号;
|
|
|
bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号;
|
|
|
bj.PN = itm.GetProperty("PN","");//
|
|
|
bj.PN = itm.GetProperty("PN", "");//
|
|
|
bj.PO= itm.GetProperty("PO",""); |
|
|
bj.PO = itm.GetProperty("PO", ""); |
|
|
bj.ProductionGroup = itm.GetProperty("PartGroup",""); |
|
|
bj.ProductionGroup = itm.GetProperty("PartGroup", ""); |
|
|
bj.LineCode = itm.LineCode; |
|
|
bj.LineCode = itm.LineCode; |
|
|
bj.BeginDate=itm.BeginDate; |
|
|
bj.BeginDate = itm.BeginDate; |
|
|
bj.EndDate = itm.EndDate; |
|
|
bj.EndDate = itm.EndDate; |
|
|
//bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号
|
|
|
//bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号
|
|
|
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
|
|
|
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
|
|
@ -242,8 +387,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
//InvGroupNum = itm.InvGroupNum,
|
|
|
//InvGroupNum = itm.InvGroupNum,
|
|
|
LU = itm.LU, |
|
|
LU = itm.LU, |
|
|
//PartCode = itm.PartCode,
|
|
|
//PartCode = itm.PartCode,
|
|
|
PO=itm.PO, |
|
|
PO = itm.PO, |
|
|
PN=itm.PN, |
|
|
PN = itm.PN, |
|
|
PRICE = itm.PRICE, |
|
|
PRICE = itm.PRICE, |
|
|
Qty = itm.Qty, |
|
|
Qty = itm.Qty, |
|
|
Amt = itm.Amt, |
|
|
Amt = itm.Amt, |
|
@ -251,18 +396,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
VendorCode = itm.VendorCode, |
|
|
VendorCode = itm.VendorCode, |
|
|
VendorName = itm.VendorName, |
|
|
VendorName = itm.VendorName, |
|
|
// PurchaseOrderNumber = itm.PurchaseOrderNumber,
|
|
|
// PurchaseOrderNumber = itm.PurchaseOrderNumber,
|
|
|
DeliveryIndexNumber = itm.DeliveryIndexNumber , |
|
|
DeliveryIndexNumber = itm.DeliveryIndexNumber, |
|
|
Extend1 = itm.Extend1, |
|
|
Extend1 = itm.Extend1, |
|
|
BeginDate = itm.BeginDate, |
|
|
BeginDate = itm.BeginDate, |
|
|
EndDate = itm.EndDate, |
|
|
EndDate = itm.EndDate, |
|
|
RealAmt=itm.RealAmt, |
|
|
RealAmt = itm.RealAmt, |
|
|
TaxAmt=itm.TaxAmt, |
|
|
TaxAmt = itm.TaxAmt, |
|
|
SettleDate = itm.SettleDate, |
|
|
SettleDate = itm.SettleDate, |
|
|
ProductionGroup=itm.ProductionGroup, |
|
|
ProductionGroup = itm.ProductionGroup, |
|
|
LineCode=itm.LineCode |
|
|
LineCode = itm.LineCode |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
entity.INVOICE_WAIT_DETAIL_BJ = bjquery.OrderBy(p=>p.LineCode).ToList(); |
|
|
entity.INVOICE_WAIT_DETAIL_BJ = bjquery.OrderBy(p => p.LineCode).ToList(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -364,41 +509,42 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) }); |
|
|
.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(); |
|
|
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList(); |
|
|
} |
|
|
} |
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO) |
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
{ |
|
|
{ |
|
|
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
|
|
|
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
|
|
|
} |
|
|
} |
|
|
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO ) |
|
|
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO) |
|
|
{ |
|
|
{ |
|
|
//List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
|
|
|
//List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
|
|
|
|
|
|
|
|
|
var maiquery = from itm in m |
|
|
var maiquery = from itm in m |
|
|
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum |
|
|
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum |
|
|
select |
|
|
select |
|
|
new MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO() |
|
|
new MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO() |
|
|
{ |
|
|
{ |
|
|
Extend1 = itm.Extend1, |
|
|
Extend1 = itm.Extend1, |
|
|
InvGroupNum = itm.InvGroupNum, |
|
|
InvGroupNum = itm.InvGroupNum, |
|
|
SettleGroupNum = itm.SettleGroupNum, |
|
|
SettleGroupNum = itm.SettleGroupNum, |
|
|
InvbillNum = itm.InvbillNum, |
|
|
InvbillNum = itm.InvbillNum, |
|
|
RealInvBillNum = itm1.RealnvBillNum |
|
|
RealInvBillNum = itm1.RealnvBillNum |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
entity.MAIDAN_HBPO_INVOICE_MAP_GROUP = maiquery.ToList(); |
|
|
entity.MAIDAN_HBPO_INVOICE_MAP_GROUP = maiquery.ToList(); |
|
|
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>(); |
|
|
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>(); |
|
|
foreach (var itm in sdtos) |
|
|
foreach (var itm in sdtos) |
|
|
{ |
|
|
{ |
|
|
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() { |
|
|
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() |
|
|
GroupNum=itm.SettleGroupNum, |
|
|
{ |
|
|
LU=itm.LU, |
|
|
GroupNum = itm.SettleGroupNum, |
|
|
PN=itm.Extend1, |
|
|
LU = itm.LU, |
|
|
|
|
|
PN = itm.Extend1, |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
entity.MAIDAN_HBPO_UNSETTLED_DETAIL = unsettle; |
|
|
entity.MAIDAN_HBPO_UNSETTLED_DETAIL = unsettle; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
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; |
|
|
return entity; |
|
|
} |
|
|
} |
|
|
[HttpPost] |
|
|
[HttpPost] |
|
@ -482,7 +628,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
// 发票分组
|
|
|
// 发票分组
|
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO) |
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
{ |
|
|
{ |
|
|
if (m != null) |
|
|
if (m != null) |
|
|
{ |
|
|
{ |
|
@ -512,12 +658,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//jis业务,发票分组对应关系,未结数据,调整数据
|
|
|
//jis业务,发票分组对应关系,未结数据,调整数据
|
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO) |
|
|
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO) |
|
|
{ |
|
|
{ |
|
|
foreach (var itm in entities) |
|
|
foreach (var itm in entities) |
|
|
{ |
|
|
{ |
|
|
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList(); |
|
|
var mgroup = m.Where(p => p.InvbillNum == itm.InvbillNum).ToList(); |
|
|
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); |
|
|
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); |
|
|
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); |
|
|
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList(); |
|
|
var lsC = nolist.Where(p => p.Extend1 == "可结算") |
|
|
var lsC = nolist.Where(p => p.Extend1 == "可结算") |
|
|
.GroupBy(p => new |
|
|
.GroupBy(p => new |
|
|