Browse Source

更新代码,买单件、JIS、直供件

master
学 赵 1 year ago
parent
commit
ed302e6d0b
  1. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs
  3. 77
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  4. 47
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  5. 34
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  7. 43
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  8. 55
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  9. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

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

@ -307,8 +307,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "零件号")]
public string LU { set; get; }
[Display(Name = "数量")]
public decimal Qty { set; get; }
}

21
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs

@ -9,7 +9,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid>
{
[Display(Name = "金税发票")]
[ExporterHeader(DisplayName = "金税发票")]
public string RealInvBillNum { get; set; }
///// <summary>
/////作废发票号
@ -19,29 +19,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary>
///发票号
/// </summary>
[Display(Name = "发票号")]
[ExporterHeader(DisplayName = "发票号")]
public string InvBillNum { get; set; }
/// <summary>
/// 下线日期
/// </summary>
[Display(Name = "下线日期")]
[ExporterHeader(DisplayName = "下线日期")]
public DateTime SettleDate { get; set; }
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; }
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "零件号")]
public string LU { get; set; }
[Display(Name = "标识号")]
[ExporterHeader(DisplayName = "标识号")]
public string PN { get; set; }
[Display(Name = "数量")]
[ExporterHeader(DisplayName = "数量")]
public decimal Qty { get; set; }
[Display(Name = "结算分组")]
[ExporterHeader(DisplayName = "结算分组")]
public string GroupNum { get; set; }
[Display(Name = "键值")]
[ExporterHeader(DisplayName = "键值")]
public string KeyCode { get; set; }
[Display(Name = "价格")]
[ExporterHeader(DisplayName = "价格")]
public decimal Price { get; set; }
[ExporterHeader(IsIgnore =false)]
public string PartCode { get; set; }
}
public class PUB_ADJ_DETAIL_EXP_DTO

77
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Castle.Core.Internal;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
@ -25,6 +26,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
@ -121,6 +123,7 @@ namespace Win.Sfs.SettleAccount.Bases
}
return new PagedResultDto<INVOICE_GRP_DTO>(totalCount, dtos);
}
/// <summary>
/// 查询明细明细
/// </summary>
@ -180,7 +183,6 @@ namespace Win.Sfs.SettleAccount.Bases
bj.PRICE = itm.PRICE;
// bj.InvGroupNum = itm.InvGroupNum;
bj.DeliveryNumber = itm.ExtraProperties["DeliveryIndexNumber"].ToSqlValue();
//bj.DeliveryNumber = itm.GetProperty("DeliveryNumber", "");//交货号
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
//bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
@ -257,6 +259,7 @@ namespace Win.Sfs.SettleAccount.Bases
var adjs = await _adjRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);//调整数据
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);//调整数据DTO
var notquery = from itm in sdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
@ -329,8 +332,6 @@ namespace Win.Sfs.SettleAccount.Bases
}
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
//List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
var maiquery = from itm in m
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
@ -500,6 +501,11 @@ namespace Win.Sfs.SettleAccount.Bases
return null;
}
/// <summary>
/// hbpo、jit、备件等
/// </summary>
@ -598,13 +604,64 @@ namespace Win.Sfs.SettleAccount.Bases
return errors;
}
/// <summary>
/// 校验规则
/// </summary>
/// <param name="dto1s"></param>
/// <param name="p_pricelist"></param>
/// <returns></returns>
protected async Task<List<ERR_EXP_DTO>> CheckInvoiceGenerationRules<T>(List<T> dto1s, List<PriceList> p_pricelist, EnumBusinessType p_businessType) where T : SA_CAN_BASE
protected async Task<List<ERR_EXP_DTO>> CheckAdJRules(List<PUB_ADJ_DETAIL> p_dtos,List<MaterialRelationship> p_ship ,EnumBusinessType p_businessType)
{
var query= from dto in p_dtos
join itm1 in p_ship on dto.LU equals itm1.SettleMaterialCode into temp
from tm in temp.DefaultIfEmpty()
where tm == null
select dto;
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
string name = string.Empty;
string keyname = string.Empty;
switch (p_businessType)
{
case EnumBusinessType.MaiDanJianHBPO:
name = "HBPO买单件";
keyname = "生产码";
break;
case EnumBusinessType.ZhiGongJianHBPO:
name = "HBPO直供件";
keyname = "发货单号";
break;
case EnumBusinessType.ZhiGongJianBBAC:
name = "BBAC直供件";
keyname = "发货单号";
break;
case EnumBusinessType.YinDuJian:
name = "HBPO印度件";
keyname = "发货单号";
break;
case EnumBusinessType.JisBBAC:
name = "BBAC-JIS";
keyname = "生产码";
break;
case EnumBusinessType.JisHBPO:
name = "HBPO-JIS";
keyname = "生产码";
break;
case EnumBusinessType.BeiJian:
name = "备件";
keyname = "交付识别号";
break;
}
foreach (var error in query.ToList())
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU}{keyname}:{error.PN},客户零件关系表没有对应厂内物料号!" });
}
return errorList;
}
/// <summary>
/// 校验规则
/// </summary>
/// <param name="dto1s"></param>
/// <param name="p_pricelist"></param>
/// <returns></returns>
protected async Task<List<ERR_EXP_DTO>> CheckInvoiceGenerationRules<T>(List<T> dto1s, List<PriceList> p_pricelist, EnumBusinessType p_businessType) where T : SA_CAN_BASE
{
var first = dto1s.Where(p=>!string.IsNullOrEmpty(p.Site)).FirstOrDefault();

47
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -20,6 +20,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@ -32,6 +33,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationRepository;
private readonly ADJ_SERVICE _adjservice;
public BBAC_BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -42,6 +46,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
INormalEfCoreRepository<MaterialRelationship, Guid> relationRepository,
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
PUB_CAN_SA_MNG pubMng,
@ -66,6 +73,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
service,
baseservice)
{
_relationRepository = relationRepository;
_priceRepository = priceRepository;
_adjservice = adjservice;
}
@ -77,13 +85,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
public override async Task<IActionResult> ReissueInvoice([FromBody] string p_invbillnum)
{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum).ConfigureAwait(false);
var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{p_invbillnum}对应的可结算单不在请检查!", "400");
@ -203,6 +211,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
public virtual async Task<IActionResult> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var errorlist = await CheckRepeat(p_list).ConfigureAwait(false);//是否录入数据重复
if (errorlist.Count > 0)
{
@ -237,6 +246,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList =_relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist= relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
@ -245,7 +260,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
@ -257,7 +272,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
@ -331,6 +346,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var result = await _adjservice.CheckImport(p_list).ConfigureAwait(false);
if (result != "OK")
{
@ -372,6 +388,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList=await CheckAdJRules(adjlist, relist.ToList(),inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
@ -392,7 +417,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
@ -501,6 +526,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
@ -521,7 +554,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}

34
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -19,6 +19,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -27,7 +28,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/[controller]/[action]")]
public class HBPO_BA_SERVICE : BA_SERVICE
{
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly ADJ_SERVICE _adjservice;
@ -37,12 +38,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
ADJ_SERVICE adjservice
ADJ_SERVICE adjservice,
INormalEfCoreRepository<MaterialRelationship, Guid> relationRepository
)
: base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service, baseservice)
{
_priceRepository = priceRepository;
_adjservice = adjservice;
_relationRepository = relationRepository;
}
/// <summary>
/// 发票重开
@ -208,6 +211,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errors = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errors.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
hbpolist.Add(new HBPO_CAN_SA_DETAIL(
@ -226,7 +237,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
@ -335,6 +346,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
foreach (var itm in adjlist)
{
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
@ -354,7 +367,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
@ -481,6 +494,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
@ -501,7 +525,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}

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

@ -386,7 +386,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
entity.MAIDAN_HBPO_INVOICE_MAP_GROUP = maiquery.ToList();
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>();
foreach (var itm in notquery.ToList())
foreach (var itm in sdtos)
{
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() {
GroupNum=itm.InvGroupNum,

43
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -19,6 +19,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -30,20 +31,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
private readonly ADJ_SERVICE _adjservice;
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationRepository;
public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository,
ADJ_SERVICE adjservice
ADJ_SERVICE adjservice,
INormalEfCoreRepository<MaterialRelationship, Guid> relationRepository
) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service, baseservice)
{
_priceRepository = priceRepository;
_pricebjRepository = pricebjRepository;
_adjservice = adjservice;
_relationRepository = relationRepository;
}
/// <summary>
@ -96,6 +99,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errors = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errors.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
publist.Add(new PUB_CAN_SA_DETAIL(
@ -114,7 +127,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
));
}
@ -360,6 +373,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
@ -380,7 +403,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
));
}
@ -528,6 +551,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
@ -546,7 +579,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
));
}

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

@ -1616,32 +1616,47 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
groupList.AddRange(mapList);
}
var notsettle= _nothbpoRepository.Where(p => p.SettleBillNum == p_InvGroupNum);//一次开票时查找不可结数据,追加需求
if (notsettle != null && notsettle.Count() > 0)
if (p_first == true)
{
var innotls = new List<INVOICE_NOT_SETTLE>();
foreach (var nitm in notsettle)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum,
lU: nitm.LU,
lU1: nitm.LU,
extend1: "不可结算",
extend2: string.Empty,
qty: nitm.Qty,
p_invbillnum: string.Empty
));
}
if (innotls.Count > 0)
var mng = await _hbpoMng.GetMainAsync(p_InvGroupNum);
var notsettle = _nothbpoRepository.Where(p => p.SettleBillNum == mng.SettleBillNum);//一次开票时查找不可结数据,追加需求
if (notsettle != null && notsettle.Count() > 0)
{
notDetialList.AddRange(innotls);
var innotls = new List<INVOICE_NOT_SETTLE>();
foreach (var nitm in notsettle)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum,
lU: nitm.LU,
lU1: nitm.LU,
extend1: nitm.PN,
extend2: string.Empty,
qty: nitm.Qty,
p_invbillnum: string.Empty
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
}
}
//invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
}

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

@ -589,6 +589,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
}
List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号
List<string> List = new List<string>();
decimal sum = itm.Value;//初始分组合计金额

Loading…
Cancel
Save