|
|
@ -1,4 +1,6 @@ |
|
|
|
using Magicodes.ExporterAndImporter.Core; |
|
|
|
using Magicodes.ExporterAndImporter.Excel; |
|
|
|
using Shouldly; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
@ -6,8 +8,10 @@ using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using TaskJob.EventArgs; |
|
|
|
using TaskJob.Interfaces; |
|
|
|
using Volo.Abp.BlobStoring; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
|
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|
|
|
|
|
|
|
namespace SettleAccount.Job.Services.Report |
|
|
@ -52,6 +56,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
private readonly OutputService _outputService; |
|
|
|
private readonly ErpPartDapperRepository _erpDapper; |
|
|
|
private readonly SettleSparePartDapperReportRepository _sparepartdapper; |
|
|
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
|
|
public UnSettledSumService( |
|
|
|
HQHSettledDetailDapperRepository hqkanbanDapper, |
|
|
|
KanbanUnSettledDapperRepository kanbanDapper, |
|
|
@ -59,7 +64,8 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
OutputService outputService, |
|
|
|
ErpPartDapperRepository erpDapper, |
|
|
|
WmsDapperRepository wmsDapper, |
|
|
|
SettleSparePartDapperReportRepository sparepartdapper |
|
|
|
SettleSparePartDapperReportRepository sparepartdapper, |
|
|
|
IBlobContainer<MyFileContainer> fileContainer |
|
|
|
) |
|
|
|
{ |
|
|
|
_wmsDapper = wmsDapper; |
|
|
@ -69,15 +75,33 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
_outputService = outputService; |
|
|
|
_erpDapper = erpDapper; |
|
|
|
_sparepartdapper = sparepartdapper; |
|
|
|
_fileContainer = fileContainer; |
|
|
|
} |
|
|
|
[UnitOfWork(false)] |
|
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) |
|
|
|
{ |
|
|
|
|
|
|
|
var _lsExport= GetReport(id,exportName,p_list); |
|
|
|
var _lsleft = GetLeftReport(id, exportName, p_list); |
|
|
|
|
|
|
|
var _first = exportName.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
ExcelExporter _exporter = new ExcelExporter();//导出Excel
|
|
|
|
var result = _exporter.Append(_lsExport, "汇总核对表1") |
|
|
|
.SeparateBySheet() |
|
|
|
.Append(_lsleft, "汇总核对表2") |
|
|
|
.ExportAppendDataAsByteArray(); |
|
|
|
result.ShouldNotBeNull(); |
|
|
|
_fileContainer.SaveAsync("结算未结寄售核对表", result.Result, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _first = exportName.FirstOrDefault(); |
|
|
|
_outputService.Export<UnSettledSum>(id, _first, _lsExport); |
|
|
|
return id.ToString(); |
|
|
|
|
|
|
|
} |
|
|
@ -378,7 +402,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
var _lst = _wmsDapper.GetSalesStockSum(version); |
|
|
|
var query = from itm in _lst |
|
|
|
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 |
|
|
|
from tm in temp.DefaultIfEmpty() |
|
|
|
select new UnSettledSum |
|
|
@ -401,5 +425,51 @@ into temp |
|
|
|
}; |
|
|
|
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(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|