|
|
@ -3317,9 +3317,84 @@ public class OpenOrderServiceImpl implements IOpenOrderService { |
|
|
|
public R createOrderPackage(AdvanceDTO advanceDTO) { |
|
|
|
public R createOrderPackage(AdvanceDTO advanceDTO) { |
|
|
|
Long advanceId = advanceDTO.getAdvanceId(); |
|
|
|
Long advanceId = advanceDTO.getAdvanceId(); |
|
|
|
Long warehouseId = advanceDTO.getWarehouseId(); |
|
|
|
Long warehouseId = advanceDTO.getWarehouseId(); |
|
|
|
|
|
|
|
Integer enterNum = advanceDTO.getEnterNum(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
|
|
|
if(Objects.isNull(warehouseEntity)){ |
|
|
|
|
|
|
|
log.warn("##########createOrderPackage: 仓库信息不存在 warehouseId={}",warehouseId); |
|
|
|
|
|
|
|
return R.fail(405,"仓库信息不存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String warehouseName = warehouseEntity.getName(); |
|
|
|
|
|
|
|
String warehouseCode = warehouseEntity.getWarehouseCode(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TrunklineAdvanceEntity advanceEntity = advanceService.getById(advanceId); |
|
|
|
|
|
|
|
Integer totalNum = advanceEntity.getTotalNum(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceDetailVO> advanceDetailList = advanceDetailService.findList(advanceId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(totalNum > 0 || CollUtil.isNotEmpty(advanceDetailList)){ |
|
|
|
|
|
|
|
log.warn("##########createOrderPackage: 订单已有包件数据 advanceId={}",advanceId); |
|
|
|
|
|
|
|
return R.fail(405,"订单已有包件数据"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(enterNum == null || enterNum <= 0){ |
|
|
|
|
|
|
|
log.warn("##########createOrderPackage: 输入的数量不正确 enterNum={}",enterNum); |
|
|
|
|
|
|
|
return R.fail(405,"输入的数量不正确"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); |
|
|
|
|
|
|
|
advanceDetailModel.setWarehouseId(warehouseId); |
|
|
|
|
|
|
|
advanceDetailModel.setWarehouseName(warehouseName); |
|
|
|
|
|
|
|
advanceDetailModel.setAdvanceId(advanceId); |
|
|
|
|
|
|
|
advanceDetailModel.setOrderCode(advanceEntity.getOrderCode()); |
|
|
|
|
|
|
|
advanceDetailModel.setBrand(advanceEntity.getBrand()); |
|
|
|
|
|
|
|
advanceDetailModel.setSystemType("线上"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// advanceDetailModel.setFirstPackName(firsts);
|
|
|
|
|
|
|
|
// String sencods = importOrderNoPackageExcelDTO.getSeconds();
|
|
|
|
|
|
|
|
// if (StringUtil.isBlank(sencods)) {
|
|
|
|
|
|
|
|
// advanceDetailModel.setSecondPackName(firsts);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// advanceDetailModel.setSecondPackName(sencods);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// String thirds = importOrderNoPackageExcelDTO.getThirds();
|
|
|
|
|
|
|
|
// if (StringUtil.isBlank(thirds)) {
|
|
|
|
|
|
|
|
// advanceDetailModel.setThirdPackName(firsts);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// advanceDetailModel.setThirdPackName(thirds);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
advanceDetailModel.setQuantity(1); |
|
|
|
|
|
|
|
advanceDetailModel.setServiceNum(advanceEntity.getServiceNum()); |
|
|
|
|
|
|
|
// advanceDetailModel.setMaterialCode(importOrderNoPackageExcelDTO.getMaterialCode());
|
|
|
|
|
|
|
|
// advanceDetailModel.setMaterialName(importOrderNoPackageExcelDTO.getMaterialName());
|
|
|
|
|
|
|
|
// String volume = importOrderNoPackageExcelDTO.getVolume();
|
|
|
|
|
|
|
|
// if (StringUtil.isBlank(volume)){
|
|
|
|
|
|
|
|
// advanceDetailModel.setVolume(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// advanceDetailModel.setVolume(new BigDecimal(volume));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// String weight = importOrderNoPackageExcelDTO.getWeight();
|
|
|
|
|
|
|
|
// if (StringUtil.isBlank(weight)){
|
|
|
|
|
|
|
|
// advanceDetailModel.setWeight(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// advanceDetailModel.setWeight(new BigDecimal(weight));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
advanceDetailModel.setPackageStatus("0"); |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
List<String> orderPackageCodes = basicdataCodeClient.getBatchPackageCodeByType(warehouseCode, advanceEntity.getOrderCode(), totalNum); |
|
|
|
|
|
|
|
orderPackageCodes.forEach(orderPackageCode -> { |
|
|
|
|
|
|
|
TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); |
|
|
|
|
|
|
|
BeanUtil.copy(advanceDetailModel, advanceDetailEntity); |
|
|
|
|
|
|
|
advanceDetailEntity.setOrderPackageCode(orderPackageCode); |
|
|
|
|
|
|
|
advanceDetailEntities.add(advanceDetailEntity); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
advanceDetailService.saveBatch(advanceDetailEntities); |
|
|
|
|
|
|
|
advanceEntity.setTotalNum(enterNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
advanceService.updateById(advanceEntity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.success("添加成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<EditOrderMsgVO> verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { |
|
|
|
private List<EditOrderMsgVO> verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { |
|
|
|