Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
d73da8d371
  1. 76
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

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

@ -1,4 +1,6 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -6,8 +8,10 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
@ -52,6 +56,7 @@ namespace SettleAccount.Job.Services.Report
private readonly OutputService _outputService; private readonly OutputService _outputService;
private readonly ErpPartDapperRepository _erpDapper; private readonly ErpPartDapperRepository _erpDapper;
private readonly SettleSparePartDapperReportRepository _sparepartdapper; private readonly SettleSparePartDapperReportRepository _sparepartdapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public UnSettledSumService( public UnSettledSumService(
HQHSettledDetailDapperRepository hqkanbanDapper, HQHSettledDetailDapperRepository hqkanbanDapper,
KanbanUnSettledDapperRepository kanbanDapper, KanbanUnSettledDapperRepository kanbanDapper,
@ -59,7 +64,8 @@ namespace SettleAccount.Job.Services.Report
OutputService outputService, OutputService outputService,
ErpPartDapperRepository erpDapper, ErpPartDapperRepository erpDapper,
WmsDapperRepository wmsDapper, WmsDapperRepository wmsDapper,
SettleSparePartDapperReportRepository sparepartdapper SettleSparePartDapperReportRepository sparepartdapper,
IBlobContainer<MyFileContainer> fileContainer
) )
{ {
_wmsDapper = wmsDapper; _wmsDapper = wmsDapper;
@ -69,15 +75,33 @@ namespace SettleAccount.Job.Services.Report
_outputService = outputService; _outputService = outputService;
_erpDapper = erpDapper; _erpDapper = erpDapper;
_sparepartdapper = sparepartdapper; _sparepartdapper = sparepartdapper;
_fileContainer = fileContainer;
} }
[UnitOfWork(false)] [UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{ {
var _lsExport= GetReport(id,exportName,p_list); var _lsExport= GetReport(id,exportName,p_list);
var _lsleft = GetLeftReport(id, exportName, p_list);
var _first = exportName.FirstOrDefault(); var _first = exportName.FirstOrDefault();
_outputService.Export<UnSettledSum>(id, _first, _lsExport);
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(_lsExport, "汇总核对表1")
.SeparateBySheet()
.Append(_lsleft, "汇总核对表2")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync("结算未结寄售核对表", result.Result, true);
return id.ToString(); return id.ToString();
} }
@ -378,7 +402,7 @@ namespace SettleAccount.Job.Services.Report
var _lst = _wmsDapper.GetSalesStockSum(version); var _lst = _wmsDapper.GetSalesStockSum(version);
var query = from itm in _lst var query = from itm in _lst
join itm1 in _ls join itm1 in _ls
on new { Version = itm.Version, PartCode = itm.PartCode, LocCode= itm.LocCode.ToUpper()} equals new { Version = itm1., PartCode = itm1., LocCode = itm1.} on new { Version = itm.Version, PartCode = itm.PartCode.Trim(), LocCode= itm.LocCode.ToUpper()} equals new { Version = itm1., PartCode = itm1..Trim(), LocCode = itm1.}
into temp into temp
from tm in temp.DefaultIfEmpty() from tm in temp.DefaultIfEmpty()
select new UnSettledSum select new UnSettledSum
@ -401,5 +425,51 @@ into temp
}; };
return query.ToList(); return query.ToList();
} }
public List<UnSettledSum> GetLeftReport(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
List<UnSettledSum> _ls = new List<UnSettledSum>();
_ls.AddRange(GetFisSum(id, exportName, p_list));
_ls.AddRange(GetHQKanbanSum(id, exportName, p_list));
_ls.AddRange(GetKanbanSum(id, exportName, p_list));
_ls.AddRange(GetSparePartSum(id, exportName, p_list));//大众备件未结
var _lst = _wmsDapper.GetSalesStockSum(version);
var query = from itm in _ls
join itm1 in _lst
on new { Version = itm., PartCode = itm..Trim(), LocCode = itm. } equals
new { Version = itm1.Version, PartCode = itm1.PartCode.Trim(), LocCode = itm1.LocCode.ToUpper() }
into temp
from tm in temp.DefaultIfEmpty()
select new UnSettledSum
{
= itm.,
= itm.,
= itm.,
= itm.,
= itm.,
SAS未结明细汇总 = tm == null ? "0" : tm.EndQty.ToString(),
WMS期初库存 = tm == null ? "0" : tm.StartQty.ToString(),
WMS期末库存 = tm == null ? "0" : tm.EndQty.ToString(),
= itm.,
= tm == null ? "0" : tm.OutQty.ToString(),
= tm == null ? "0" : tm.InQty.ToString(),
= (tm.EndQty - decimal.Parse(tm == null ? "0" : itm.SAS未结明细汇总)).ToString()
};
return query.ToList();
}
} }
} }

Loading…
Cancel
Save