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; }
[Display(Name = "数量")]
public string Qty { get; set; }
public decimal? Qty { get; set; }
/// <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
{
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
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 groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().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());

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 = "已创建发票不能重复创建" });
}
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 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 groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().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);
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 = "已创建发票不能重复创建" });
}
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);//校验生成规则
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 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 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 adjp = adj.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 lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList();
// var r = (from t1 in lsC
// join t2 in lsN on new { t1.LU, t1.SettleGroupNum }
// equals new { t2.LU, t2.SettleGroupNum }
// into temp
// from tm in temp.DefaultIfEmpty()
// select new INVOICE_NOT_SETTLE_EXT_DTO
// {
// RealInvBillNum = t1.RealInvBillNum,
// InvDate = t1.InvDate,
// InvBillNum = t1.InvBillNum,
// InvGroupNum = t1.InvGroupNum,
// SettleGroupNum = t1.SettleGroupNum,
// SettleLU = t1.LU,
// NotSettleLU = tm == null ? string.Empty : tm.LU,
// Qty = tm == null ? string.Empty : tm.Qty
// }
// )
//.Union
//(from t2 in lsN
// join t1 in lsC
// on new { t2.LU, t2.SettleGroupNum }
// equals new { t1.LU, t1.SettleGroupNum }
// into temp
// from tm in temp.DefaultIfEmpty()
// where tm == null
// select new INVOICE_NOT_SETTLE_EXT_DTO
// {
// RealInvBillNum = t2.RealInvBillNum,
// InvDate = t2.InvDate,
// InvBillNum = t2.InvBillNum,
// InvGroupNum = t2.InvGroupNum,
// SettleGroupNum = t2.SettleGroupNum,
// SettleLU = string.Empty,
// NotSettleLU = t2.LU,
// Qty = t2.Qty
// }
// );
//_excel.Append(r.OrderBy(p=>p.SettleGroupNum).ToList(), "结算分组零件" + itm.InvbillNum);
var lsC = nolist.Where(p => p.Extend1 == "可结算")
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO() {
LU =p.Key.LU,
RealInvBillNum =p.Key.RealInvBillNum,
InvDate =p.Key.InvDate,
InvBillNum =p.Key.InvBillNum,
InvGroupNum =p.Key.InvGroupNum,
Qty=p.Sum(itm=>itm.Qty)
}).ToList();
var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList()
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO()
{
LU = p.Key.LU,
RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate,
InvBillNum = p.Key.InvBillNum,
InvGroupNum = p.Key.InvGroupNum,
Qty = p.Sum(itm => itm.Qty)
}).ToList();
var lineC = lsC.Count;
var lineN = lsN.Count;
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++)
{
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;
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);
}
}
INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO();
invnot.RealInvBillNum = string.Empty;
invnot.InvDate = null;
invnot.InvBillNum = string.Empty;
invnot.InvGroupNum = string.Empty;
invnot.SettleGroupNum = string.Empty;
invnot.SettleLU = string.Empty;
invnot.SettleQty = null;
invnot.NotSettleLU = string.Empty;
invnot.Qty = string.Empty;
ls.Add(invnot);
}
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++)
{
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);
}
}
ls[i].SettleGroupNum = disList[i];
}
var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
foreach (var de in ls)
for (int i = 0; i < lineC; i++)
{
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(mgroup, "发票结算分组对应" + 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 groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().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);
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>();
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var priceListbj = _pricebjRepository.ToList();//价格单
var priceListbj = _pricebjRepository.Where(p => p.IsCancel == false).ToList(); //价格单
foreach (var itm in priceListbj)
{
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
{
priceList = _priceRepository.ToList();//价格单
priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
}
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)

Loading…
Cancel
Save