|
@ -25,6 +25,7 @@ using Win.Sfs.SettleAccount.Constant; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.Prices; |
|
|
using Win.Sfs.SettleAccount.Entities.TaskJobs; |
|
|
using Win.Sfs.SettleAccount.Entities.TaskJobs; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
@ -73,6 +74,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
IExporter _excel = new ExcelExporter(); |
|
|
IExporter _excel = new ExcelExporter(); |
|
|
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); |
|
|
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dtoDetails = ObjectMapper.Map<List<BBAC_NOT_SA_DETAIL>, List<BBAC_NOT_SA_DETAIL_EXP_DTO>>(entities); |
|
|
var dtoDetails = ObjectMapper.Map<List<BBAC_NOT_SA_DETAIL>, List<BBAC_NOT_SA_DETAIL_EXP_DTO>>(entities); |
|
|
|
|
|
|
|
|
var inner = from d in entities |
|
|
var inner = from d in entities |
|
@ -148,22 +162,65 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
input.Filters.Remove(first); |
|
|
input.Filters.Remove(first); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//_detailRepository.DbContext.Set<BBAC_NOT_SA_DETAIL>().Where(p=>p.)
|
|
|
var _dbcontext = await _detailRepository.GetDbContextAsync().ConfigureAwait(false); |
|
|
var flag= await _bbacNotMng.IsCompleted().ConfigureAwait(false); |
|
|
var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == "1040" && p.IsCancel == false).ToList(); |
|
|
if (flag == false) |
|
|
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
var query = from d in entities |
|
|
|
|
|
join p in pricelist |
|
|
|
|
|
on d.LU equals p.LU |
|
|
|
|
|
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == "1040" |
|
|
|
|
|
select new |
|
|
|
|
|
{ |
|
|
|
|
|
a = |
|
|
|
|
|
new BBAC_CAN_SA_DETAIL() |
|
|
|
|
|
{ |
|
|
|
|
|
ContractDocID = d.ContractDocID, |
|
|
|
|
|
IsMaiDan = d.IsMaiDan, |
|
|
|
|
|
Version = d.Version, |
|
|
|
|
|
KeyCode = d.KeyCode, |
|
|
|
|
|
Site = "1040", |
|
|
|
|
|
BusinessType = d.BusinessType, |
|
|
|
|
|
ErpLoc = d.ErpLoc, |
|
|
|
|
|
CreationTime = d.CreationTime, |
|
|
|
|
|
GroupNum = d.GroupNum, |
|
|
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
|
|
|
LU = d.LU, |
|
|
|
|
|
PN = d.PN, |
|
|
|
|
|
SettleBillNum = d.SettleBillNum, |
|
|
|
|
|
Price = p.Price, |
|
|
|
|
|
SettleDate = d.SettleDate, |
|
|
|
|
|
RealPartCode = d.RealPartCode, |
|
|
|
|
|
PartCode = d.PartCode, |
|
|
|
|
|
Qty = d.Qty |
|
|
|
|
|
}, |
|
|
|
|
|
b = d |
|
|
|
|
|
}; |
|
|
|
|
|
var bbac_can_list = query.Select(p => p.a).ToList(); |
|
|
|
|
|
var bbac_not_list = query.Select(p => p.b).ToList(); |
|
|
|
|
|
if (bbac_can_list.Count > 0) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException("任务生成中请等待...", "400"); |
|
|
|
|
|
|
|
|
var flag = await _bbacNotMng.IsCompleted().ConfigureAwait(false); |
|
|
|
|
|
if (flag == false) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException("任务生成中请等待...", "400"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
var filters = JsonSerializer.Serialize(input.Filters); |
|
|
|
|
|
List<CustomCondition> customConditionList = new List<CustomCondition>(); |
|
|
|
|
|
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters }); |
|
|
|
|
|
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisBBAC.ToString() }); |
|
|
|
|
|
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisBBAC.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) => |
|
|
|
|
|
{ }).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
return new JsonResult(new { Code = 200, Message = "正在生成" }); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
var filters = JsonSerializer.Serialize(input.Filters); |
|
|
return new JsonResult(new { Code = 400, Message = "筛选的数据都没有价格!" }); |
|
|
List<CustomCondition> customConditionList = new List<CustomCondition>(); |
|
|
|
|
|
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters }); |
|
|
|
|
|
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisBBAC.ToString() }); |
|
|
|
|
|
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisBBAC.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) => |
|
|
|
|
|
{ }).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
} |
|
|
return new JsonResult(new { Code = 200, Message = "正在生成" }); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|