|
|
|
@ -376,25 +376,45 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
|
|
|
|
|
factoryOrderService.save(factoryOrder); |
|
|
|
|
|
|
|
|
|
List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES(); |
|
|
|
|
List<PanPackageInfo> panPackageInfos = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<PanPackageListDTO> order_attributes_line = new ArrayList<>(); |
|
|
|
|
for (PanPackageInfoDTO dto:packageInfos){ |
|
|
|
|
PanPackageInfo packageInfo = new PanPackageInfo(); |
|
|
|
|
BeanUtil.copyProperties(dto,packageInfo); |
|
|
|
|
packageInfo.setOrderId(factoryOrder.getId()); |
|
|
|
|
panPackageInfos.add(packageInfo); |
|
|
|
|
//保存包件信息数据
|
|
|
|
|
//因为需要先保存包件明细需要包件的id
|
|
|
|
|
packageInfoService.save(packageInfo); |
|
|
|
|
|
|
|
|
|
//再存入包件明细
|
|
|
|
|
List<PanPackageList> PanPackagelist = new ArrayList<>(); |
|
|
|
|
List<PanPackageListDTO> order_attributes_line = dto.getORDER_ATTRIBUTES_LINE(); |
|
|
|
|
for (PanPackageListDTO panPackageListDTO:order_attributes_line){ |
|
|
|
|
PanPackageList panPackageList = new PanPackageList(); |
|
|
|
|
BeanUtil.copyProperties(panPackageListDTO,panPackageList); |
|
|
|
|
panPackageList.setPackageId(packageInfo.getId()); |
|
|
|
|
PanPackagelist.add(panPackageList); |
|
|
|
|
// packageInfoService.save(packageInfo);
|
|
|
|
|
order_attributes_line.addAll(dto.getORDER_ATTRIBUTES_LINE()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
packageInfoService.saveBatch(panPackageInfos); |
|
|
|
|
|
|
|
|
|
//再存入包件明细
|
|
|
|
|
List<PanPackageList> panPackagelist = new ArrayList<>(); |
|
|
|
|
for (PanPackageListDTO panPackageListDTO:order_attributes_line){ |
|
|
|
|
PanPackageList panPackageList = new PanPackageList(); |
|
|
|
|
BeanUtil.copyProperties(panPackageListDTO,panPackageList); |
|
|
|
|
checkListunitNo(panPackageList,panPackageInfos); |
|
|
|
|
panPackagelist.add(panPackageList); |
|
|
|
|
} |
|
|
|
|
// int size = panPackagelist.size();
|
|
|
|
|
// int i = size % 500;
|
|
|
|
|
// panPackagelist=panPackagelist.subList(0,500);
|
|
|
|
|
|
|
|
|
|
packageListService.saveBatch(panPackagelist); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkListunitNo(PanPackageList packages, List<PanPackageInfo> panPackageInfos) { |
|
|
|
|
|
|
|
|
|
for (PanPackageInfo panPackageInfo:panPackageInfos){ |
|
|
|
|
if(packages.getUnitNo().equals(panPackageInfo.getUnitNo())){ |
|
|
|
|
packages.setPackageId(panPackageInfo.getId()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
packageListService.saveBatch(PanPackagelist); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|