Administrator
3 years ago
13 changed files with 506 additions and 52 deletions
@ -0,0 +1,111 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using TaskJob.EventArgs; |
|||
using TaskJob.Interfaces; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
|
|||
namespace SettleAccount.Job.Services.Report |
|||
{ |
|||
public class SettleKBWithOutCodeExportService : ITransientDependency, IExportJob |
|||
{ |
|||
private readonly KanbanUnSettledDapperRepository _dapper; |
|||
private readonly OutputService _outputService; |
|||
private readonly ErpPartDapperRepository _erpdapperRepository; |
|||
|
|||
public SettleKBWithOutCodeExportService(KanbanUnSettledDapperRepository dapper, |
|||
OutputService outputService, |
|||
ErpPartDapperRepository erpdapperRepository) |
|||
{ |
|||
_dapper = dapper; |
|||
_outputService = outputService; |
|||
_erpdapperRepository = erpdapperRepository; |
|||
} |
|||
|
|||
|
|||
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) |
|||
{ |
|||
|
|||
var _filename = exportName.FirstOrDefault(); |
|||
var sapMaterialCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value; |
|||
|
|||
|
|||
var customerPartCode = p_list.Where(p => p.Name == "CustomerPartCode").FirstOrDefault().Value; |
|||
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|||
var materialGroup = p_list.Where(p => p.Name == "EstimateTypeDesc").FirstOrDefault().Value; |
|||
var kanban = p_list.Where(p => p.Name == "Kanban").FirstOrDefault().Value; |
|||
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value; |
|||
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; |
|||
|
|||
|
|||
var _list = _dapper.GetNoKanbanSettleDetail(version, beginTime, endTime); |
|||
//var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
|
|||
//if (diffList != null)
|
|||
//{
|
|||
// foreach (var itm in diffList)
|
|||
// {
|
|||
// var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
|
|||
// _first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
|
|||
// _first.InvoiceMoney = _first.InvoiceDiffQty * _first.InvoicePrice;//开票总金额(开票数量*开票单价)
|
|||
// _first.SumDiffMoney = (_first.SettleNumber * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
|
|||
// }
|
|||
//}
|
|||
if (!string.IsNullOrEmpty(materialGroup)) |
|||
{ |
|||
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); |
|||
if (_groupList.Count() > 0) |
|||
{ |
|||
_list = _list.Where(p => _groupList.Contains(p.SapMaterialGroup)).ToList(); |
|||
} |
|||
} |
|||
|
|||
if (!string.IsNullOrEmpty(sapMaterialCode)) |
|||
{ |
|||
var _groupList = sapMaterialCode.Split(new char[] { '\n' }).Distinct().ToList(); |
|||
if (_groupList.Count() > 0) |
|||
{ |
|||
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); |
|||
} |
|||
} |
|||
|
|||
if (!string.IsNullOrEmpty(customerPartCode)) |
|||
{ |
|||
var _groupList = customerPartCode.Split(new char[] { '\n' }).Distinct().ToList(); |
|||
if (_groupList.Count() > 0) |
|||
{ |
|||
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); |
|||
} |
|||
} |
|||
|
|||
//if (!string.IsNullOrEmpty(beginTime))
|
|||
//{
|
|||
// _list = _list.Where(p => DateTime.Parse(beginTime)<=p.ActualGoodsDate).ToList();
|
|||
//}
|
|||
//if (!string.IsNullOrEmpty(endTime))
|
|||
//{
|
|||
// _list = _list.Where(p => DateTime.Parse(endTime) >= p.ActualGoodsDate).ToList();
|
|||
//}
|
|||
|
|||
//if (!string.IsNullOrEmpty(kanban))
|
|||
//{
|
|||
// var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _list = _list.Where(p => _groupList.Contains(p.Kanban)).ToList();
|
|||
// }
|
|||
//}
|
|||
|
|||
|
|||
|
|||
|
|||
_outputService.Export<SettleKBWithOutCode>(id,_filename , _list); |
|||
|
|||
return id.ToString(); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue