|
@ -113,18 +113,19 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA> |
|
|
{ |
|
|
{ |
|
|
#region 导入数据转换、数据校验
|
|
|
#region 导入数据转换、数据校验
|
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
var result = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); |
|
|
var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); |
|
|
var importHBOPSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(result); |
|
|
|
|
|
|
|
|
|
|
|
//Site包含CN1 亦庄
|
|
|
//买单件BBAC
|
|
|
//Site包含CN5 顺义
|
|
|
var importMaiDanJianHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0")); |
|
|
var importCN1HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN1")); |
|
|
//JisBBAC
|
|
|
var importCN5HBOPSaDetails = importHBOPSaDetails.FindAll(t => t.Site.Contains("CN5")); |
|
|
var importHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0") == false); |
|
|
|
|
|
|
|
|
|
|
|
var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importHBOPDtos); |
|
|
|
|
|
|
|
|
//数据校验
|
|
|
//数据校验
|
|
|
var checkList = new List<ErrorExportDto>(); |
|
|
var checkList = new List<ErrorExportDto>(); |
|
|
//结算分组号
|
|
|
//结算分组号
|
|
|
var bbacSaGroupNums = importHBOPSaDetails.Select(t => t.GroupNum).Distinct(); |
|
|
var bbacSaGroupNums = importBBACSaDetails.Select(t => t.GroupNum).Distinct(); |
|
|
//已存在的结算分组号
|
|
|
//已存在的结算分组号
|
|
|
var havBBACSaGroupNums = (await _bbacSaDetailRepository.GetListAsync(t => bbacSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct(); |
|
|
var havBBACSaGroupNums = (await _bbacSaDetailRepository.GetListAsync(t => bbacSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct(); |
|
|
if (havBBACSaGroupNums.Any() == true) |
|
|
if (havBBACSaGroupNums.Any() == true) |
|
@ -141,13 +142,9 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA> |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
if (importCN1HBOPSaDetails.Any()) |
|
|
if (importBBACSaDetails.Any()) |
|
|
{ |
|
|
|
|
|
await SaDataHandleAsync(importCN1HBOPSaDetails, "CN1"); |
|
|
|
|
|
} |
|
|
|
|
|
if (importCN5HBOPSaDetails.Any()) |
|
|
|
|
|
{ |
|
|
{ |
|
|
await SaDataHandleAsync(importCN5HBOPSaDetails, "CN5"); |
|
|
//await SaDataHandleAsync(importBBACSaDetails);
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ApplicationConsts.SuccessStr; |
|
|
return ApplicationConsts.SuccessStr; |
|
@ -287,7 +284,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA> |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 结算数据处理
|
|
|
/// 结算数据处理
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails, string site) |
|
|
private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails) |
|
|
{ |
|
|
{ |
|
|
//结算单号
|
|
|
//结算单号
|
|
|
var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); |
|
|
var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); |
|
@ -296,7 +293,6 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA> |
|
|
{ |
|
|
{ |
|
|
BillNum = bbacSaBillNum, |
|
|
BillNum = bbacSaBillNum, |
|
|
State = "1", |
|
|
State = "1", |
|
|
Site = site, |
|
|
|
|
|
}; |
|
|
}; |
|
|
//可结算单号
|
|
|
//可结算单号
|
|
|
var bbacCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); |
|
|
var bbacCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); |
|
@ -306,8 +302,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA> |
|
|
BillNum = bbacCanSaBillNum, |
|
|
BillNum = bbacCanSaBillNum, |
|
|
SettleBillNum = bbacSaBillNum, |
|
|
SettleBillNum = bbacSaBillNum, |
|
|
State = SettleBillState.未结状态, |
|
|
State = SettleBillState.未结状态, |
|
|
BusinessType = _businessType, |
|
|
BusinessType = _businessType |
|
|
Site = site, |
|
|
|
|
|
}; |
|
|
}; |
|
|
//可结算明细
|
|
|
//可结算明细
|
|
|
var bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>(); |
|
|
var bbacCanSaDetails = new List<BBAC_CAN_SA_DETAIL>(); |
|
|