Browse Source

更新

master
学 赵 1 year ago
parent
commit
6650ac5aa0
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  3. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  7. 276
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  9. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

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

@ -657,7 +657,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string LU { get; set; } public string LU { get; set; }
[Display(Name = "数量")] [Display(Name = "数量")]
public string Qty { get; set; } public decimal? Qty { get; set; }
/// <summary> /// <summary>
///不可结算零件号 ///不可结算零件号
/// </summary> /// </summary>

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

@ -259,9 +259,9 @@ namespace Win.Sfs.SettleAccount.Bases
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, 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.Date == maxDate).ToList(); var prices = p_pricelist.Where(p => 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

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

@ -150,7 +150,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.Where(p=>p.IsCancel==false).ToList();//价格单
// priceList.GroupBy(p => new { p.BeginTime, p.EndTime }).Select(p => p.First()); // priceList.GroupBy(p => new { p.BeginTime, p.EndTime }).Select(p => p.First());

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

@ -94,7 +94,7 @@ 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.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();
;//价格单 ;//价格单

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

@ -239,7 +239,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.Where(p=>p.IsCancel==false).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)
{ {

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

@ -88,7 +88,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" }); return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
} }
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum); var entitys = await _hbpoMng.GetDetalListAsync(invbillnum);
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0) if (errorList.Count() > 0)
{ {

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

@ -350,6 +350,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var materialList = await _baseservice.GetMaterialList(); var materialList = await _baseservice.GetMaterialList();
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 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);
@ -379,139 +382,172 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
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 == "可结算").ToList(); var lsC = nolist.Where(p => p.Extend1 == "可结算")
var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList(); .GroupBy(p => new
// var r = (from t1 in lsC {
// join t2 in lsN on new { t1.LU, t1.SettleGroupNum } p.LU,
// equals new { t2.LU, t2.SettleGroupNum } p.RealInvBillNum,
p.InvDate,
// into temp p.InvBillNum,
// from tm in temp.DefaultIfEmpty() p.InvGroupNum,
// select new INVOICE_NOT_SETTLE_EXT_DTO
// { }).Select(p => new INVOICE_NOT_SETTLE_DTO() {
// RealInvBillNum = t1.RealInvBillNum, LU =p.Key.LU,
// InvDate = t1.InvDate, RealInvBillNum =p.Key.RealInvBillNum,
// InvBillNum = t1.InvBillNum, InvDate =p.Key.InvDate,
// InvGroupNum = t1.InvGroupNum, InvBillNum =p.Key.InvBillNum,
// SettleGroupNum = t1.SettleGroupNum, InvGroupNum =p.Key.InvGroupNum,
// SettleLU = t1.LU, Qty=p.Sum(itm=>itm.Qty)
// NotSettleLU = tm == null ? string.Empty : tm.LU,
// Qty = tm == null ? string.Empty : tm.Qty }).ToList();
// } var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList()
// ) .GroupBy(p => new
//.Union {
//(from t2 in lsN p.LU,
// join t1 in lsC p.RealInvBillNum,
// on new { t2.LU, t2.SettleGroupNum } p.InvDate,
// equals new { t1.LU, t1.SettleGroupNum } p.InvBillNum,
// into temp p.InvGroupNum,
// from tm in temp.DefaultIfEmpty()
// where tm == null }).Select(p => new INVOICE_NOT_SETTLE_DTO()
// select new INVOICE_NOT_SETTLE_EXT_DTO {
// { LU = p.Key.LU,
// RealInvBillNum = t2.RealInvBillNum, RealInvBillNum = p.Key.RealInvBillNum,
// InvDate = t2.InvDate, InvDate = p.Key.InvDate,
// InvBillNum = t2.InvBillNum, InvBillNum = p.Key.InvBillNum,
// InvGroupNum = t2.InvGroupNum, InvGroupNum = p.Key.InvGroupNum,
// SettleGroupNum = t2.SettleGroupNum, Qty = p.Sum(itm => itm.Qty)
// SettleLU = string.Empty, }).ToList();
// NotSettleLU = t2.LU,
// Qty = t2.Qty
// }
// );
//_excel.Append(r.OrderBy(p=>p.SettleGroupNum).ToList(), "结算分组零件" + itm.InvbillNum);
var lineC = lsC.Count; var lineC = lsC.Count;
var lineN = lsN.Count; var lineN = lsN.Count;
List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>(); List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
if (lineC > lineN)//可结大于不可结行数时
for (int i = 0; i < 10000; i++)
{ {
for (int number = 0; number < lineC; number++) INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO();
{ invnot.RealInvBillNum = string.Empty;
if (number + 1 > lineN) invnot.InvDate = null;
{ invnot.InvBillNum = string.Empty;
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO(); invnot.InvGroupNum = string.Empty;
invnot.SettleGroupNum = string.Empty;
invnot.SettleLU = string.Empty;
entity.RealInvBillNum = lsC[number].RealInvBillNum; invnot.SettleQty = null;
entity.InvDate = lsC[number].InvDate; invnot.NotSettleLU = string.Empty;
entity.InvBillNum = lsC[number].InvBillNum; invnot.Qty = string.Empty;
entity.InvGroupNum = lsC[number].InvGroupNum; ls.Add(invnot);
entity.SettleGroupNum = lsC[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.SettleQty = lsC[number].Qty;
entity.NotSettleLU = string.Empty;
entity.Qty = string.Empty;
ls.Add(entity);
}
else
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsC[number].RealInvBillNum;
entity.InvDate = lsC[number].InvDate;
entity.InvBillNum = lsC[number].InvBillNum;
entity.InvGroupNum = lsC[number].InvGroupNum;
entity.SettleGroupNum = lsC[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.SettleQty= lsC[number].Qty;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
ls.Add(entity);
}
}
} }
else var entity= nolist.FirstOrDefault();
var disList = lsC.Select(p => p.SettleGroupNum).Distinct().ToList();
for (int i = 0; i < disList.Count; i++)
{ {
for (int number = 0; number < lineN; number++) ls[i].SettleGroupNum = disList[i];
{
if (number + 1 > lineC)//不可结大于可结行数时
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsN[number].RealInvBillNum;
entity.InvDate = lsN[number].InvDate;
entity.InvBillNum = lsN[number].InvBillNum;
entity.InvGroupNum = lsN[number].InvGroupNum;
entity.SettleGroupNum = lsN[number].SettleGroupNum;
entity.SettleLU = string.Empty;
entity.SettleQty = string.Empty;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
ls.Add(entity);
}
else
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsN[number].RealInvBillNum;
entity.InvDate = lsN[number].InvDate;
entity.InvBillNum = lsN[number].InvBillNum;
entity.InvGroupNum = lsN[number].InvGroupNum;
entity.SettleGroupNum = lsN[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
entity.SettleQty = lsC[number].Qty;
ls.Add(entity);
}
}
} }
for (int i = 0; i < lineC; i++)
var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
foreach (var de in ls)
{ {
de.SettleGroupNum = string.Empty; ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
} }
for (int i = 0; i < disList.Count; i++) for (int i = 0; i < lineN; i++)
{ {
ls[i].SettleGroupNum = disList[i]; ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].NotSettleLU = lsN[i].LU;
ls[i].Qty = lsN[i].Qty == null ? string.Empty : lsN[i].Qty.ToString();
} }
//if (lineC > lineN)//可结大于不可结行数时
//{
// for (int number = 0; number < lineC; number++)
// {
// if (number + 1 > lineN)
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsC[number].RealInvBillNum;
// entity.InvDate = lsC[number].InvDate;
// entity.InvBillNum = lsC[number].InvBillNum;
// entity.InvGroupNum = lsC[number].InvGroupNum;
// entity.SettleGroupNum = lsC[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.SettleQty = lsC[number].Qty == null ? string.Empty : lsC[number].Qty.ToString();
// entity.NotSettleLU = string.Empty;
// entity.Qty = string.Empty;
// ls.Add(entity);
// }
// else
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsC[number].RealInvBillNum;
// entity.InvDate = lsC[number].InvDate;
// entity.InvBillNum = lsC[number].InvBillNum;
// entity.InvGroupNum = lsC[number].InvGroupNum;
// entity.SettleGroupNum = lsC[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.SettleQty= lsC[number].Qty==null?string.Empty:lsC[number].Qty.ToString();
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsC[number].Qty.ToString();
// ls.Add(entity);
// }
// }
//}
//else
//{
// for (int number = 0; number < lineN; number++)
// {
// if (number + 1 > lineC)//不可结大于可结行数时
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsN[number].RealInvBillNum;
// entity.InvDate = lsN[number].InvDate;
// entity.InvBillNum = lsN[number].InvBillNum;
// entity.InvGroupNum = lsN[number].InvGroupNum;
// entity.SettleGroupNum = lsN[number].SettleGroupNum;
// entity.SettleLU = string.Empty;
// entity.SettleQty = string.Empty;
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsN[number].Qty.ToString();
// ls.Add(entity);
// }
// else
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsN[number].RealInvBillNum;
// entity.InvDate = lsN[number].InvDate;
// entity.InvBillNum = lsN[number].InvBillNum;
// entity.InvGroupNum = lsN[number].InvGroupNum;
// entity.SettleGroupNum = lsN[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsN[number].Qty.ToString(); ;
// entity.SettleQty = lsC[number].Qty == null ? string.Empty : lsC[number].Qty.ToString(); ;
// ls.Add(entity);
// }
// }
//}
//var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
//foreach (var de in ls)
//{
// de.SettleGroupNum = string.Empty;
//}
//for (int i = 0; i < disList.Count; i++)
//{
// ls[i].SettleGroupNum = disList[i];
//}
_excel.Append(ls, "结算分组零件" + itm.InvbillNum); _excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet(); _excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet(); _excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();

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

@ -271,7 +271,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.Where(p=>p.IsCancel==false).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)
{ {

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

@ -81,7 +81,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
List<PriceList> priceList = new List<PriceList>(); List<PriceList> priceList = new List<PriceList>();
if (main.BusinessType == EnumBusinessType.BeiJian) if (main.BusinessType == EnumBusinessType.BeiJian)
{ {
var priceListbj = _pricebjRepository.ToList();//价格单 var priceListbj = _pricebjRepository.Where(p => p.IsCancel == false).ToList(); //价格单
foreach (var itm in priceListbj) foreach (var itm in priceListbj)
{ {
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price }); priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price });
@ -89,7 +89,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
else else
{ {
priceList = _priceRepository.ToList();//价格单 priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
} }
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0) if (errorList.Count() > 0)

Loading…
Cancel
Save