Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
16dd3c6acf
  1. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
  2. 52
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  3. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  4. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  5. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  6. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  7. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  8. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  9. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  11. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
  12. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  13. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  14. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  15. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
  16. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  17. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  18. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  19. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
  20. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

20
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

@ -133,7 +133,7 @@ public class ADJ_SERVICE : BASE_SERVICE
errorList.Add( errorList.Add(
new ErrorExportDto() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" }); new ErrorExportDto() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
} }
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList); var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,"1040");
if (errorEntitylist.Count > 0) if (errorEntitylist.Count > 0)
{ {
foreach (var itm in errorEntitylist) foreach (var itm in errorEntitylist)
@ -193,10 +193,14 @@ public class ADJ_SERVICE : BASE_SERVICE
int flag = 0; int flag = 0;
var keylist = p_list.Select(p => p.KeyCode).Distinct(); var keylist = p_list.Select(p => p.KeyCode).Distinct();
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>(); List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
//var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
var first = p_list.FirstOrDefault(); var first = p_list.FirstOrDefault();
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
if (first != null) if (first != null)
{ {
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
string keyname = string.Empty; string keyname = string.Empty;
List<PUB_ADJ_DETAIL> adjlist = new List<PUB_ADJ_DETAIL>(); List<PUB_ADJ_DETAIL> adjlist = new List<PUB_ADJ_DETAIL>();
@ -257,6 +261,10 @@ public class ADJ_SERVICE : BASE_SERVICE
} }
} }
var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list); var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
var codelist = entityList.Select(p => p.LU).ToList(); var codelist = entityList.Select(p => p.LU).ToList();
var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true }); var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true });
@ -265,7 +273,7 @@ public class ADJ_SERVICE : BASE_SERVICE
errorList.Add( errorList.Add(
new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" }); new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
} }
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList); var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,inv.Site);
if (errorEntitylist.Count > 0) if (errorEntitylist.Count > 0)
{ {
foreach (var itm in errorEntitylist) foreach (var itm in errorEntitylist)
@ -275,7 +283,7 @@ public class ADJ_SERVICE : BASE_SERVICE
} }
if (errorList.Count > 0) if (errorList.Count > 0)
{ {
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message= "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
} }
List<PUB_ADJ_DETAIL_DTO> ls = new List<PUB_ADJ_DETAIL_DTO>(); List<PUB_ADJ_DETAIL_DTO> ls = new List<PUB_ADJ_DETAIL_DTO>();
@ -287,7 +295,7 @@ public class ADJ_SERVICE : BASE_SERVICE
var inner = from d in p_list var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU join p in pricebjlist on d.LU equals p.LU
where where
d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate
select select
new PUB_ADJ_DETAIL_DTO() new PUB_ADJ_DETAIL_DTO()
{ {
@ -310,7 +318,7 @@ public class ADJ_SERVICE : BASE_SERVICE
var inner = from d in p_list var inner = from d in p_list
join p in pricelist on d.LU equals p.LU join p in pricelist on d.LU equals p.LU
where where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode== inv.Site
select new PUB_ADJ_DETAIL_DTO() select new PUB_ADJ_DETAIL_DTO()
{ {
InvBillNum = d.InvBillNum, InvBillNum = d.InvBillNum,

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

@ -164,28 +164,28 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in AMap var wquery = from itm in AMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty() from tm in temp.DefaultIfEmpty()
select select
new INVOICE_WAIT_DETAIL_BBAC_DTO() new INVOICE_WAIT_DETAIL_BBAC_DTO()
{ {
PartDesc=tm==null?string.Empty:itm.PartDesc, PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime, InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum, RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version, Version = itm.Version,
InvbillNum = itm.InvbillNum, InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum, InvGroupNum = itm.InvGroupNum,
LU = itm.LU, LU = itm.LU,
PartCode = itm.PartCode, PartCode = itm.PartCode,
PRICE = itm.PRICE, PRICE = itm.PRICE,
Qty = itm.Qty, Qty = itm.Qty,
Amt = itm.Amt, Amt = itm.Amt,
BussiessType = itm.BussiessType, BussiessType = itm.BussiessType,
Extend1 = itm.Extend1, Extend1 = itm.Extend1,
BeginDate = itm.BeginDate, BeginDate = itm.BeginDate,
EndDate = itm.EndDate, EndDate = itm.EndDate,
}; };
entity.INVOICE_WAIT_DETAIL_BBAC = AMap; entity.INVOICE_WAIT_DETAIL_BBAC = wquery.ToList();
} }
else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian) else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{ {
@ -195,7 +195,7 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in BMap var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty() from tm in temp.DefaultIfEmpty()
select select
new INVOICE_WAIT_DETAIL_BJ_DTO() new INVOICE_WAIT_DETAIL_BJ_DTO()
{ {
@ -215,7 +215,7 @@ namespace Win.Sfs.SettleAccount.Bases
BeginDate = itm.BeginDate, BeginDate = itm.BeginDate,
EndDate = itm.EndDate, EndDate = itm.EndDate,
}; };
entity.INVOICE_WAIT_DETAIL_BJ = BMap; entity.INVOICE_WAIT_DETAIL_BJ = wquery.ToList();
} }
else else
{ {
@ -224,7 +224,7 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in wdtos var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty() from tm in temp.DefaultIfEmpty()
select select
new INVOICE_WAIT_DETAIL_DTO() new INVOICE_WAIT_DETAIL_DTO()
{ {
@ -550,7 +550,7 @@ namespace Win.Sfs.SettleAccount.Bases
var inner = from d in dto1s var inner = from d in dto1s
join p in p_pricelist on d.LU equals p.LU join p in p_pricelist on d.LU equals p.LU
where where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel==false
select d; select d;
var left = from d in dto1s var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -256,17 +256,17 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="dto1s"></param> /// <param name="dto1s"></param>
/// <param name="p_pricelist"></param> /// <param name="p_pricelist"></param>
/// <returns></returns> /// <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>> CheckInvoiceGenerationRules<T>(List<T> dto1s,string p_site, List<PriceList> p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE
{ {
//var maxDate = p_pricelist.Max(p => p.Date); //var maxDate = p_pricelist.Max(p => p.Date);
var prices = p_pricelist.Where(p => p.IsCancel == false).ToList(); var prices = p_pricelist.Where(p =>p.ClientCode==p_site && p.IsCancel == false).ToList();
var inner = from d in dto1s var inner = from d in dto1s
join p in prices on d.LU equals p.LU join p in prices on d.LU equals p.LU
where where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==d.Site && p.IsCancel == false
select d; select d;
var ls = inner.ToList(); var ls = inner.ToList();
var left = from d in dto1s var left = from d in dto1s

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

@ -164,7 +164,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id = d.Id, Id = d.Id,
@ -291,8 +291,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==inv.Site && p.IsCancel==false//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id=d.Id, Id=d.Id,
@ -413,7 +413,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); //var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0) //if (errorList.Count() > 0)
@ -423,7 +422,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id = d.Id, Id = d.Id,

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -94,11 +94,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" }); return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
} }
var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算 var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();
var datetime = priceList.Select(p => p.Date).Max(); var datetime = priceList.Select(p => p.Date).Max();
var prices = priceList.Where(p => p.Date == datetime).ToList(); var prices = priceList.Where(p => p.Date == datetime).ToList();
;//价格单 ;//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, prices, main.BusinessType);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,prices, main.BusinessType);//校验生成规则
if (errorList.Count() > 0) if (errorList.Count() > 0)
{ {
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
@ -111,7 +112,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in prices on d.LU equals p.LU join p in prices on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode ==main.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,

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

@ -248,7 +248,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys); // var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys var q = from d in entitys
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel==false && p.ClientCode==inv.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,
@ -381,7 +381,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id = d.Id, Id = d.Id,

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -89,7 +89,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum); var entitys = await _hbpoMng.GetDetalListAsync(invbillnum);
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单 var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0) if (errorList.Count() > 0)
{ {
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
@ -103,7 +103,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,

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

@ -2,6 +2,7 @@ using CodeArts.Db;
using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Diagrams; using DocumentFormat.OpenXml.Drawing.Diagrams;
using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Spreadsheet;
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;
@ -32,6 +33,7 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
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.Prices;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -337,6 +339,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
); );
return _fileName; return _fileName;
} }
/// <summary> /// <summary>
/// 导出发票组明细 /// 导出发票组明细
/// </summary> /// </summary>
@ -354,6 +360,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var first=entities.FirstOrDefault();
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities); var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities);
var invdetail= await DetailQueryAsync(input); var invdetail= await DetailQueryAsync(input);
var m = invdetail.INVOICE_MAP_GROUP; var m = invdetail.INVOICE_MAP_GROUP;

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

@ -152,7 +152,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys); // var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys var q = from d in entitys
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,
@ -280,7 +280,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys); // var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys var q = from d in entitys
join p in priceList on d.PartCode equals p.LU join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
SettleBillNum = d.SettleBillNum, SettleBillNum = d.SettleBillNum,
@ -413,7 +413,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id = d.Id, Id = d.Id,

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -91,19 +91,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单 priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
} }
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0) if (errorList.Count() > 0)
{ {
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
} }
if (await _pubMng.SetForwardState(main, SettleBillState.)) if (await _pubMng.SetForwardState(main, SettleBillState.))
{ {
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys); var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s var q = from d in dto1s
join p in priceList on d.LU equals p.LU join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site
select new TEMP_CAN_SA_DETAIL select new TEMP_CAN_SA_DETAIL
{ {
Id = d.Id, Id = d.Id,

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -200,7 +201,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
return errorList; return errorList;
} }
public async Task<List<TEntity>> CheckPriceList<TEntity>(List<TEntity> p_list,bool isBj=false) public async Task<List<TEntity>> CheckPriceList<TEntity>(List<TEntity> p_list,string p_site,bool isBj=false)
where TEntity : ISA_BASE,new() where TEntity : ISA_BASE,new()
{ {
List<TEntity> errorList = new List<TEntity>(); List<TEntity> errorList = new List<TEntity>();
@ -225,7 +226,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
} }
else else
{ {
var pricebjlist = _priceRepository.ToList(); var pricebjlist = _priceRepository.Where(p=>p.ClientCode==p_site).ToList();
var inner = from d in p_list var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU join p in pricebjlist on d.LU equals p.LU
@ -244,8 +245,8 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
return errorList; return errorList;
} }
} }
} }

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -399,6 +399,10 @@ namespace SettleAccount.Bases
/// 匹配类型 /// 匹配类型
/// </summary> /// </summary>
public EnumMappingType MappingType { get; set; } public EnumMappingType MappingType { get; set; }
} }
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
@ -461,6 +465,9 @@ namespace SettleAccount.Bases
public string PartCode { get; set; } public string PartCode { get; set; }
public string RealPartCode { get; set; } public string RealPartCode { get; set; }
public string Site { get; set; }
//public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum) //public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{ //{
// Version = version; // Version = version;

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -88,8 +88,8 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
/// <summary> /// <summary>
/// 选择工厂导入 /// 选择工厂导入
/// </summary> /// </summary>
[Display(Name = "工厂地点")] //[Display(Name = "工厂地点")]
public string Site { get; set; } = null!; //public string Site { get; set; } = null!;
/// <summary> /// <summary>
/// 对应字段Quantity /// 对应字段Quantity

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs

@ -90,8 +90,8 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE
/// <summary> /// <summary>
/// 对应字段filename 区分 cn1、cn5 /// 对应字段filename 区分 cn1、cn5
/// </summary> /// </summary>
[Display(Name = "工厂地点")] //[Display(Name = "工厂地点")]
public string Site { get; set; } = null!; //public string Site { get; set; } = null!;
///// <summary> ///// <summary>
///// 对应字段Qty ///// 对应字段Qty

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

@ -56,6 +56,9 @@ public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
public decimal RealAmt { get; set; } public decimal RealAmt { get; set; }
[Display(Name = "地点")]
public string Site { get; set; }

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -47,9 +47,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<List<string>> GenerateSettlementOrder(List<BBAC_NOT_SA_DETAIL> p_list) public virtual async Task<List<string>> GenerateSettlementOrder(List<BBAC_NOT_SA_DETAIL> p_list)
{ {
var first = p_list.FirstOrDefault();
List<string> errors = new List<string>(); List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list); var priceErrors = await _service.CheckPriceList(p_list,first.Site);
if (priceErrors.Count > 0) if (priceErrors.Count > 0)
{ {
foreach (var itm in priceErrors) foreach (var itm in priceErrors)
@ -70,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.Version = int.Parse(DateTime.Now.ToString("yyyyMM")); _entity.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
_entity.State = SettleBillState.; _entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty; _entity.SettleBillNum = string.Empty;
_entity.Site = first.Site;
_entity.BusinessType = EnumBusinessType.JisBBAC; _entity.BusinessType = EnumBusinessType.JisBBAC;
var _entityList = new List<BBAC_CAN_SA_DETAIL>(); var _entityList = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm in p_list) foreach (var itm in p_list)

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

@ -29,7 +29,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository; private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository; private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository;
private readonly BaseDomainService _service; private readonly BaseDomainService _service;
public HBPO_NOT_SA_MNG() public HBPO_NOT_SA_MNG()
{ {
} }
@ -51,7 +50,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{ {
var first=p_list.FirstOrDefault(); var first=p_list.FirstOrDefault();
List<string> errors = new List<string>(); List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list); var priceErrors = await _service.CheckPriceList(p_list,first.Site);
if (priceErrors.Count > 0) if (priceErrors.Count > 0)
{ {
foreach (var itm in priceErrors) foreach (var itm in priceErrors)
@ -83,6 +82,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.SettleBillNum = string.Empty; _entity.SettleBillNum = string.Empty;
_entity.BusinessType = p_list.FirstOrDefault().BusinessType; _entity.BusinessType = p_list.FirstOrDefault().BusinessType;
_entity.SetId(Guid.NewGuid()); _entity.SetId(Guid.NewGuid());
_entity.Site = first.Site;
var _entityList = new List<HBPO_CAN_SA_DETAIL>(); var _entityList = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm in p_list) foreach (var itm in p_list)
{ {

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

@ -1,6 +1,7 @@
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using EmptyFiles; using EmptyFiles;
using Hangfire; using Hangfire;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -40,6 +41,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository; private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository; private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
protected readonly INormalEfCoreRepository<CodeSetting, Guid> _codesetRepository; protected readonly INormalEfCoreRepository<CodeSetting, Guid> _codesetRepository;
@ -369,7 +372,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <summary>
/// 获得发票主表
/// </summary>
/// <param name="p_billNum"></param>
/// <returns></returns>
/// <summary> /// <summary>
@ -1246,7 +1254,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
taxDiff: 0, taxDiff: 0,
clientCode: string.Empty, clientCode: string.Empty,
realAmt: readAmt realAmt: readAmt
); );
invbill.Site = dtos.FirstOrDefault().Site;
invlist.Add(invbill); invlist.Add(invbill);
} }
await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(invlist);
@ -1478,6 +1490,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty, clientCode: string.Empty,
realAmt: realAmt realAmt: realAmt
); );
invbill.Site= dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now; invbill.CreationTime = DateTime.Now;
invlist.Add(invbill); invlist.Add(invbill);
} }
@ -1747,6 +1761,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
realAmt:0 realAmt:0
); );
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now; invbill.CreationTime = DateTime.Now;
invlist.Add(invbill); invlist.Add(invbill);
} }
@ -1973,6 +1988,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty, clientCode: string.Empty,
realAmt: realAmt realAmt: realAmt
); );
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now; invbill.CreationTime = DateTime.Now;
invlist.Add(invbill); invlist.Add(invbill);
} }
@ -2401,5 +2417,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
return false; return false;
} }
} }
} }

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

@ -76,11 +76,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
if (first.BusinessType == EnumBusinessType.BeiJian) if (first.BusinessType == EnumBusinessType.BeiJian)
{ {
name = "备件"; name = "备件";
priceErrors = await _service.CheckPriceList(notlist,true); priceErrors = await _service.CheckPriceList(notlist,first.Site,true);
} }
else else
{ {
priceErrors = await _service.CheckPriceList(notlist); priceErrors = await _service.CheckPriceList(notlist,first.Site);
} }
if (priceErrors.Count > 0) if (priceErrors.Count > 0)
{ {
@ -102,6 +102,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.State = SettleBillState.; _entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty; _entity.SettleBillNum = string.Empty;
_entity.BusinessType = first.BusinessType; _entity.BusinessType = first.BusinessType;
_entity.Site = first.Site;
var _entityList = new List<PUB_CAN_SA_DETAIL>(); var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in notlist) foreach (var itm in notlist)
{ {

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

@ -82,8 +82,8 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE
/// <summary> /// <summary>
/// 对应字段filename 区分 cn1、cn5 /// 对应字段filename 区分 cn1、cn5
/// </summary> /// </summary>
[Display(Name = "工厂地点")] //[Display(Name = "工厂地点")]
public string Site { get; set; } = null!; //public string Site { get; set; } = null!;
/// <summary> /// <summary>
/// 对应字段Qty /// 对应字段Qty

Loading…
Cancel
Save