44673626 2 years ago
parent
commit
fbd569a2c4
  1. 39
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs
  2. 29
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  3. 53
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
  4. 18
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs
  5. 24
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

39
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs

@ -44,7 +44,7 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
/// <summary>
/// 物料主数据应用服务
/// </summary>
// [Authorize(SettleAccountPermissions.ErrorBills.Default)]
// [Authorize(SettleAccountPermissions.ErrorBills.Default)]
//[AllowAnonymous]
[Route("api/settleaccount/ErrorBill")]
public class ErrorBillAppService : SettleAccountApplicationBase<ErrorBill>
@ -71,11 +71,11 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
ISettleAccountBranchEfCoreRepository<Bom, Guid> bomRepository,
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> bomversionRepository,
TaskJobService service,
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> bomversionRepository,
TaskJobService service,
//ISettleAccountBranchEfCoreRepository<ErrorBillRelationship, Guid> relationshipRepository,
ISettleAccountBranchEfCoreRepository<PriceList, Guid> priceRepository,
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> priceversionRepository,
ISettleAccountBranchEfCoreRepository<PriceList, Guid> priceRepository,
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> priceversionRepository,
IDistributedCache<ErrorBill> cache,
IExcelImportAppService excelImportService,
@ -92,7 +92,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
//_relationshipRepository = relationshipRepository;
_mapRepository = mapRepository;
_bomversionRepository = bomversionRepository;
}
@ -143,7 +142,7 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
var checkList = new List<ErrorExportDto>();
foreach (var itm in _ls)
{
var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.MaterialCode==itm.MaterialCode && p.WmsBillNum==itm.WmsBillNum);
var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.CustomerMaterialCode==itm.CustomerMaterialCode && p.WmsBillNum==itm.WmsBillNum);
if (_first == null)
{
var entity = new ErrorBill(
@ -194,10 +193,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
}
///// <summary>
/// <summary>
/// 根据筛选条件获取实体列表
/// </summary>
@ -248,18 +243,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
}
/// <summary>
/// 新增实体
/// </summary>
/// <param name="input">新增实体DTO</param>
/// <returns>实体DTO</returns>
/// <summary>
/// 删除实体
/// </summary>
@ -302,16 +285,11 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
string _fileName = string.Format("错误单据输出_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd"));
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true);
var dtoDetails = ObjectMapper.Map<List<ErrorBill>, List<ErrorBillExportDto>>(entities);
//声明导出容器
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtoDetails);
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
@ -322,10 +300,5 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
);
return _fileName;
}
}
}

29
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -58,6 +58,24 @@ namespace SettleAccount.Job.Services
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
var _checkList = _errorListRepository.ToList();
var query = from itm in _ls
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_ls = query.ToList();
var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => p.FirstOrDefault()).ToList();
@ -191,17 +209,10 @@ namespace SettleAccount.Job.Services
}
var _checkList = _errorListRepository.ToList();
var query = from itm in _ls
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode,WmsBillNum=itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_outputService.Export<InvoiceSettledDetailDiff>(id, _filename, query.ToList());
_outputService.Export<InvoiceSettledDetailDiff>(id, _filename, _ls.ToList());
return id.ToString();
}

53
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs

@ -11,7 +11,9 @@ using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.UnSettle;
using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
@ -51,12 +53,13 @@ namespace SettleAccount.Job.Services.Report
private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly UnSettledDetailDapperRepository _dapper1;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> _errorListRepository;
public UnSettleDiffExportService(UnSettleDiffDapperRepository dapper, OutputService outputService,
UnSettledDetailDapperRepository dapper1,
ErpPartDapperRepository erpdapperRepository,
IBlobContainer<MyFileContainer> fileContainer,
UnSettledDetailDapperRepository dapper2
UnSettledDetailDapperRepository dapper2,
ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> errorListRepository
)
{
_erpdapperRepository = erpdapperRepository;
@ -65,6 +68,7 @@ namespace SettleAccount.Job.Services.Report
_dapper1 = dapper1;
_fileContainer = fileContainer;
_dapper2 = dapper2;
_errorListRepository = errorListRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
@ -83,6 +87,21 @@ namespace SettleAccount.Job.Services.Report
var _ls = new List<UnSettleDiff>();
_ls = _dapper.GetDiffReport1(0,begin,end, materialCode,kenncode,chassisNumber,version);
var _checkList = _errorListRepository.ToList();
var q = from itm in _ls
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_ls = q.ToList();
//foreach (var itm in _ls)
//{
// if (itm.KENNCode.Length > 8)
@ -331,20 +350,15 @@ namespace SettleAccount.Job.Services.Report
//foreach (var itm in _list)
//{
// if (itm.UnSettleQty > 0)
// {
// itm.UnSettleQty = 1;
// }
// itm.DiffQty = itm.Qty - itm.UnSettleQty;
// if (itm.DiffQty == 0)
// {
// itm.DiffAMT = 0;
// }
//}
var _checkList = _errorListRepository.ToList();
var q= from itm in _list
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_list = q.ToList();
var _ls = _list.Where(p => p.Flag != "L" ).Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).Where(p => !p.ParentSapMaterialCode.Contains(",")).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _compareLs = _ls.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode });
@ -378,14 +392,7 @@ namespace SettleAccount.Job.Services.Report
rangeList = query.ToList();
//_lst.ForEach(p =>
//{
// p.Qty = 1;
// p.DiffAMT = 0;
// p.DiffQty = 1;
//}
//);
_list.AddRange(rangeList);
if (!string.IsNullOrEmpty(materialGroup))
{

18
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -135,6 +135,15 @@ namespace SettleAccount.Job.Services.Report
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, datetime, "", version, materailCode, materialGroup, "");
var _checkList = _errorListRepository.ToList();
var query = from itm in _list
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_list = query.ToList();
var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst = _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p =>
@ -193,15 +202,6 @@ namespace SettleAccount.Job.Services.Report
}
var _checkList = _errorListRepository.ToList();
var query = from itm in _list
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_list = query.ToList();

24
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -56,6 +56,20 @@ namespace SettleAccount.Job.Services.Report
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version,materailCode,materialGroup,sapcode);
var _checkList = _errorListRepository.ToList();
var query = from itm in _list
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_list = query.ToList();
var _ls = _list.Where(p => p.Flag != "L" ).Where(p=>p.ParentSapMaterialCode!=p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst= _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p =>
@ -110,16 +124,6 @@ namespace SettleAccount.Job.Services.Report
var _checkList = _errorListRepository.ToList();
var query = from itm in _ls
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
from tm1 in temp1.DefaultIfEmpty()
where tm1 == null
select itm;
_list = query.ToList();
// var removeList= _dapper.GetRemoveDetail();

Loading…
Cancel
Save