|
@ -100,80 +100,80 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) }); |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<CustomCondition> customConditionList = new List<CustomCondition>(); |
|
|
//List<CustomCondition> customConditionList = new List<CustomCondition>();
|
|
|
customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = invbillNum }); |
|
|
//customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = invbillNum });
|
|
|
customConditionList.Add(new CustomCondition() { Name = "BussinessType", Value = main.BusinessType.ToString() }); |
|
|
//customConditionList.Add(new CustomCondition() { Name = "BussinessType", Value = main.BusinessType.ToString() });
|
|
|
|
|
|
|
|
|
//main.State = SettleBillState.发票生成中;
|
|
|
|
|
|
await _bbacMng.SetWaitingState(invbillNum); |
|
|
|
|
|
var _taskid = await _service.ExportEnqueueAsync("生成发票任务", ExportExtentsion.Excel, string.Empty, string.Empty, CurrentUser, typeof(GenerateJisInvoiceService), customConditionList, (rs) => |
|
|
|
|
|
{ |
|
|
|
|
|
}).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (await _bbacMng.SetForwardState(main, SettleBillState.已开票).ConfigureAwait(false))
|
|
|
//await _bbacMng.SetWaitingState(invbillNum);
|
|
|
|
|
|
//var _taskid = await _service.ExportEnqueueAsync("生成发票任务", ExportExtentsion.Excel, string.Empty, string.Empty, CurrentUser, typeof(GenerateJisInvoiceService), customConditionList, (rs) =>
|
|
|
//{
|
|
|
//{
|
|
|
// var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
|
|
|
//}).ConfigureAwait(false);
|
|
|
// var notQuery = await _notRepository.Where(p => p.SettleBillNum == main.SettleBillNum).ToListAsync().ConfigureAwait(false);
|
|
|
|
|
|
// var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
|
|
|
|
|
|
// var q = from d in dto1s
|
|
|
|
|
|
// join p in priceList on d.LU equals p.LU
|
|
|
if (await _bbacMng.SetForwardState(main, SettleBillState.已开票).ConfigureAwait(false)) |
|
|
// where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site
|
|
|
{ |
|
|
// select new TEMP_CAN_SA_DETAIL
|
|
|
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); |
|
|
// {
|
|
|
var notQuery = await _notRepository.Where(p => p.SettleBillNum == main.SettleBillNum).ToListAsync().ConfigureAwait(false); |
|
|
// SettleBillNum = d.SettleBillNum,
|
|
|
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys); |
|
|
// Site = d.Site,
|
|
|
var q = from d in dto1s |
|
|
// Version = d.Version,
|
|
|
join p in priceList on d.LU equals p.LU |
|
|
// Price = p.Price,
|
|
|
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site |
|
|
// BillNum = d.BillNum,
|
|
|
select new TEMP_CAN_SA_DETAIL |
|
|
// SettleDate = d.SettleDate,
|
|
|
{ |
|
|
// InvGroupNum = d.InvGroupNum,
|
|
|
SettleBillNum = d.SettleBillNum, |
|
|
// LU = d.LU,
|
|
|
Site = d.Site, |
|
|
// MaterialDesc = d.MaterialDesc,
|
|
|
Version = d.Version, |
|
|
// PN = d.PN,
|
|
|
Price = p.Price, |
|
|
// Qty = d.Qty,
|
|
|
BillNum = d.BillNum, |
|
|
// GroupNum = d.GroupNum,
|
|
|
SettleDate = d.SettleDate, |
|
|
// Amt = Math.Round(d.Qty * p.Price, 2),
|
|
|
InvGroupNum = d.InvGroupNum, |
|
|
// ContractDocID = d.ContractDocID,
|
|
|
LU = d.LU, |
|
|
// BeginDate = p.BeginTime,
|
|
|
MaterialDesc = d.MaterialDesc, |
|
|
// EndDate = p.EndTime,
|
|
|
PN = d.PN, |
|
|
// PartCode = d.PartCode
|
|
|
Qty = d.Qty, |
|
|
// };
|
|
|
GroupNum = d.GroupNum, |
|
|
// var dtos = q.ToList();
|
|
|
Amt = Math.Round(d.Qty * p.Price, 2), |
|
|
|
|
|
ContractDocID = d.ContractDocID, |
|
|
// if (dtos != null && dtos.Count > 0)
|
|
|
BeginDate = p.BeginTime, |
|
|
// {
|
|
|
EndDate = p.EndTime, |
|
|
// if (invbillNum.Substring(0, 1) == "C")//一次开票
|
|
|
PartCode = d.PartCode |
|
|
// {
|
|
|
}; |
|
|
// var notlist = notQuery.Select(p => new TEMP_NOT_SA_DETAIL
|
|
|
var dtos = q.ToList(); |
|
|
// {
|
|
|
|
|
|
// KeyCode = p.KeyCode,
|
|
|
if (dtos != null && dtos.Count > 0) |
|
|
// Version = p.Version,
|
|
|
{ |
|
|
// SettleBillNum = p.SettleBillNum,
|
|
|
if (invbillNum.Substring(0, 1) == "C")//一次开票
|
|
|
// LU = p.LU,
|
|
|
{ |
|
|
// PN = p.PN,
|
|
|
var notlist = notQuery.Select(p => new TEMP_NOT_SA_DETAIL |
|
|
// Site = p.Site,
|
|
|
{ |
|
|
// Qty = p.Qty,
|
|
|
KeyCode = p.KeyCode, |
|
|
// Price = p.Price,
|
|
|
Version = p.Version, |
|
|
// BusinessType = p.BusinessType,
|
|
|
SettleBillNum = p.SettleBillNum, |
|
|
// IsReturn = "",
|
|
|
LU = p.LU, |
|
|
// InvGroupNum = p.InvGroupNum,
|
|
|
PN = p.PN, |
|
|
// SettleDate = p.SettleDate,
|
|
|
Site = p.Site, |
|
|
// GroupNum = p.GroupNum,
|
|
|
Qty = p.Qty, |
|
|
// ContractDocID = string.Empty,
|
|
|
Price = p.Price, |
|
|
// PartCode = p.PartCode
|
|
|
BusinessType = p.BusinessType, |
|
|
|
|
|
IsReturn = "", |
|
|
// }).ToList();//不能结算
|
|
|
InvGroupNum = p.InvGroupNum, |
|
|
// await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, notlist, main.Version, main.InvGroupNum, string.Empty, main.BusinessType).ConfigureAwait(false);
|
|
|
SettleDate = p.SettleDate, |
|
|
// }
|
|
|
GroupNum = p.GroupNum, |
|
|
// else//二次开票
|
|
|
ContractDocID = string.Empty, |
|
|
// {
|
|
|
PartCode = p.PartCode |
|
|
// await SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType).ConfigureAwait(false);
|
|
|
|
|
|
// }
|
|
|
}).ToList();//不能结算
|
|
|
// }
|
|
|
await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, notlist, main.Version, main.InvGroupNum, string.Empty, main.BusinessType).ConfigureAwait(false); |
|
|
//}
|
|
|
} |
|
|
|
|
|
else//二次开票
|
|
|
|
|
|
{ |
|
|
|
|
|
await SecInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|