Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
102b9ccde1
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  2. 28
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
  3. 242
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

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

@ -430,8 +430,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
};
var dtos = q.ToList();
var testls = dtos.Where(p => string.IsNullOrEmpty(p.LU)).ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开

28
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs

@ -31,34 +31,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BBAC_PD_DETAIL_REQ_DTO, BBAC_PD_DETAIL_EXP_DTO>
{
//[HttpPost]
//public virtual async Task<string> RejectAsync(List<string> p_list)
//{
// var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
// customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisBBAC.ToString() });
// customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
// var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
// var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
// if (lst.Count() > 0)
// {
// throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交", "400");
// }
// foreach (var item in ls)
// {
// item.State = SettleBillState.已提交扣减;
// }
// await _repository.DbContext.BulkUpdateAsync(ls);
// var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
// {
// });
// return _taskid;
//}
public BBAC_PD_SERVICE(INormalEfCoreRepository<BBAC_SEC_DETAIL, Guid> bbacSecRepository, INormalEfCoreRepository<HBPO_SEC_DETAIL, Guid> hbpoSecRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSecRepository, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<BBAC_PD, Guid> repository, VmiAppService vimservice, INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> detailRepository, TaskJobService service) : base(bbacSecRepository, hbpoSecRepository, pubSecRepository, excelImportService, snowflakeIdGenerator, commonManager, repository, vimservice, detailRepository, service)
{
}

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

@ -11,6 +11,7 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Writers;
using SettleAccount.Domain.BQ;
using ShardingCore.Extensions;
using Shouldly;
@ -199,11 +200,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
bj.PartCode = itm.PartCode;
bj.PRICE = itm.PRICE;
//bj.InvGroupNum = itm.InvGroupNum;
//bj.DeliveryNumber= itm.GetProperty("DeliveryNumber", "");//交货号
//bj.InvbillNum = itm.GetProperty("InvoiceNumber", "");//发票号
//bj.VendorCode = itm.GetProperty("VendorCode", "");//供应商代码
//bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称
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", "");//供应商代码
//bj.VendorName = itm.GetProperty("VendorName", "");//供应商名称
//bj.PurchaseOrderNumber = itm.GetProperty("PurchaseOrderNumber", "");//采购订单号
//bj.DeliveryIndexNumber = itm.GetProperty("DeliveryIndexNumber", "");//交付索引号
//bj.PartName = itm.GetProperty("PartName", "");//零件名称
@ -338,10 +340,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) });
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList();
}
if (first.BusinessType == EnumBusinessType.JisHBPO)
{
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
}
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC)
{
@ -349,7 +348,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
entity.INVOICE_MAP_GROUP = mdtos;
List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
foreach (var itm in m)
{
maidan.Add(new MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO() {
Extend1=itm.Extend1,
InvGroupNum=itm.InvGroupNum,
SettleGroupNum=itm.SettleGroupNum
});
}
entity.MAIDAN_HBPO_INVOICE_MAP_GROUP = maidan;
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>();
foreach (var itm in notquery.ToList())
{
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() {
GroupNum=itm.InvGroupNum,
LU=itm.LU,
PN=itm.Extend1,
});
}
}
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList();
@ -413,132 +432,148 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbac = invdetail.INVOICE_WAIT_DETAIL_BBAC;//BBACJIS明细
var bj = invdetail.INVOICE_WAIT_DETAIL_BJ;//备件明细
var unsettle = invdetail.UNSETTLED_DETAIL;//全部未结明细
var hbpom = invdetail.MAIDAN_HBPO_INVOICE_MAP_GROUP;//买单HBPO分组对应
var hbpounsettle = invdetail.MAIDAN_HBPO_UNSETTLED_DETAIL;//买单HBPO未结
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
//发票明细
#region 发票明细
if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
{
_excel.Append(bbac, "发票明细");
}
else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
_excel.Append(bj, "发票明细");
}
else
{
_excel.Append(detail, "发票明细");
}
#endregion
// 发票分组
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{
_excel.Append(m, "发票结算分组对应");//发票分组对应结算号
}
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC )
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
_excel.Append(unsettle, "未结零件结算汇总");
if (hbpom != null)
{
_excel.Append(hbpom, "发票结算分组对应");
}
if (unsettle != null)
{
_excel.Append(unsettle, "未结零件汇总");
}
}
if (first.BusinessType == EnumBusinessType.JisHBPO)
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC)
{
_excel.Append(unsettle, "未结零件列表");
_excel.Append(unsettle, "未结零件结算汇总");
}
foreach (var itm in entities)
//jis业务,发票分组对应关系,未结数据,调整数据
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
{
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 == "可结算")
.GroupBy(p => new
foreach (var itm in entities)
{
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 == "可结算")
.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>();
for (int i = 0; i < 10000; i++)
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO()
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);
}
var entity = nolist.FirstOrDefault();
var disList = mgroup.Select(p => p.SettleGroupNum).Distinct().ToList();
for (int i = 0; i < lineC; i++)//更新可结信息
{
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>();
for (int i = 0; i < 10000; i++)
{
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);
}
var entity = nolist.FirstOrDefault();
var disList = mgroup.Select(p => p.SettleGroupNum).Distinct().ToList();
for (int i = 0; i < lineC; 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].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
}
for (int i = 0; i < lineN; 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();
}
for (int i = 0; i < disList.Count; 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].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
}
for (int i = 0; i < lineN; 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();
}
for (int i = 0; i < disList.Count; i++)//更新结算分组
{
ls[i].SettleGroupNum = disList[i];
}
_excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
}
else//其他业务发票调整数据
{
foreach (var itm in entities)
{
_excel.Append(ls, "结算分组零件" + itm.InvbillNum);
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
}
var result = _excel.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
@ -622,7 +657,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
inv.RealnvBillNum = newinv.RealnvBillNum;
// inv.RealAmt = newinv.RealAmt;
inv.TaxDiff = newinv.PreTaxDiff;
// inv.ClientCode = newinv.ClientCode;
}
foreach (var detail in invdetail)

Loading…
Cancel
Save