|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
|
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.Uow; |
|
|
using Volo.Abp.Uow; |
|
|
using Win.Abp.Snowflakes; |
|
|
using Win.Abp.Snowflakes; |
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
@ -300,18 +301,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
if (adjlist != null && adjlist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList(); |
|
|
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList(); |
|
|
|
|
|
|
|
|
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()); |
|
|
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()); |
|
|
|
|
|
|
|
|
var errors = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType); |
|
|
var errors = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType); |
|
|
if (errors.Count > 0) |
|
|
if (errors.Count > 0) |
|
|
{ |
|
|
{ |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) }); |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) }); |
|
|
} |
|
|
} |
|
|
|
|
|
if (inv.BusinessType == EnumBusinessType.BeiJian) |
|
|
|
|
|
{ |
|
|
|
|
|
var dfirst = publist.FirstOrDefault(); |
|
|
foreach (var itm in adjlist) |
|
|
foreach (var itm in adjlist) |
|
|
{ |
|
|
{ |
|
|
publist.Add(new PUB_CAN_SA_DETAIL( |
|
|
|
|
|
|
|
|
//{ "ContractDocID":"2200674763",
|
|
|
|
|
|
// "DeliveryNumber":"180054628",
|
|
|
|
|
|
// "VendorCode":"15663496",
|
|
|
|
|
|
// "VendorName":"",
|
|
|
|
|
|
// "PO":"4500028814",
|
|
|
|
|
|
// "DeliveryIndexNumber":
|
|
|
|
|
|
// "5600153638",
|
|
|
|
|
|
// "PartName":"\u9970\u4EF6",
|
|
|
|
|
|
// "PartGroup":"EXT",
|
|
|
|
|
|
// "PN":"15663496_231237",
|
|
|
|
|
|
// "SettleDate":"06/01/2023 00:00:00"
|
|
|
|
|
|
// }
|
|
|
|
|
|
var entity = new PUB_CAN_SA_DETAIL( |
|
|
guid: GuidGenerator.Create(), |
|
|
guid: GuidGenerator.Create(), |
|
|
keyCode: itm.KeyCode, |
|
|
keyCode: itm.KeyCode, |
|
|
version: itm.Version, |
|
|
version: itm.Version, |
|
@ -322,14 +336,56 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
site: itm.Site, |
|
|
site: itm.Site, |
|
|
qty: itm.Qty, |
|
|
qty: itm.Qty, |
|
|
price: itm.Price, |
|
|
price: itm.Price, |
|
|
businessType: itm.BusinessType, |
|
|
businessType: dfirst.BusinessType, |
|
|
settleDate: itm.SettleDate, |
|
|
settleDate: itm.SettleDate, |
|
|
groupNum: itm.GroupNum, |
|
|
groupNum: itm.GroupNum, |
|
|
invGroupNum: inv.InvGroupNum, |
|
|
invGroupNum: inv.InvGroupNum, |
|
|
invbillnum: string.Empty, |
|
|
invbillnum: string.Empty, |
|
|
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode, |
|
|
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode, |
|
|
pobillnum: string.Empty |
|
|
pobillnum: string.Empty |
|
|
)); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
entity.SetProperty("DeliveryNumber", ""); |
|
|
|
|
|
entity.SetProperty("VendorCode", dfirst.GetProperty("VendorCode", string.Empty)); |
|
|
|
|
|
entity.SetProperty("VendorName", ""); |
|
|
|
|
|
entity.SetProperty("PO", ""); |
|
|
|
|
|
entity.SetProperty("DeliveryIndexNumber", ""); |
|
|
|
|
|
entity.SetProperty("PartName", ""); |
|
|
|
|
|
entity.SetProperty("PartGroup", "EXT"); |
|
|
|
|
|
entity.SetProperty("PN", ""); |
|
|
|
|
|
entity.SetProperty("SettleDate", itm.SettleDate); |
|
|
|
|
|
publist.Add(entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
var dfirst = publist.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var itm in adjlist) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = new PUB_CAN_SA_DETAIL( |
|
|
|
|
|
guid: GuidGenerator.Create(), |
|
|
|
|
|
keyCode: itm.KeyCode, |
|
|
|
|
|
version: itm.Version, |
|
|
|
|
|
billNum: itm.InvGroupNum, |
|
|
|
|
|
settleBillNum: itm.SettleBillNum, |
|
|
|
|
|
lU: itm.LU, |
|
|
|
|
|
pN: itm.PN, |
|
|
|
|
|
site: dfirst.Site, |
|
|
|
|
|
qty: itm.Qty, |
|
|
|
|
|
price: itm.Price, |
|
|
|
|
|
businessType:dfirst.BusinessType, |
|
|
|
|
|
settleDate: itm.SettleDate, |
|
|
|
|
|
groupNum: itm.GroupNum, |
|
|
|
|
|
invGroupNum: inv.InvGroupNum, |
|
|
|
|
|
invbillnum: string.Empty, |
|
|
|
|
|
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode, |
|
|
|
|
|
pobillnum: string.Empty |
|
|
|
|
|
); |
|
|
|
|
|
publist.Add(entity); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var entitys = publist;//合并库存调整单和就发票可结算明细数据
|
|
|
var entitys = publist;//合并库存调整单和就发票可结算明细数据
|
|
@ -397,6 +453,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
|
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum).ConfigureAwait(false); |
|
|
await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
else//二次开票
|
|
|
else//二次开票
|
|
|