|
|
|
@ -651,8 +651,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
DistributionStockupEntity stockupEntity = new DistributionStockupEntity(); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
stockupEntity.setStockupUser(user.getUserName()); |
|
|
|
|
stockupEntity.setStockupArea(stockupAreaName); |
|
|
|
|
stockupEntity.setGoodsAreaId(Long.parseLong(goddsAreaId)); |
|
|
|
|
if (Func.isNotEmpty(goddsAreaId)){ |
|
|
|
|
stockupEntity.setStockupArea(stockupAreaName); |
|
|
|
|
stockupEntity.setGoodsAreaId(Long.parseLong(goddsAreaId)); |
|
|
|
|
} |
|
|
|
|
//编码生成规则 BH+仓库编码+年月日+序号00001
|
|
|
|
|
stockupEntity.setStockupCode(bianMa()); |
|
|
|
|
//设置备货任务指派状态---未指派
|
|
|
|
@ -669,26 +671,38 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
result = distributionStockupService.save(stockupEntity); |
|
|
|
|
Long id = stockupEntity.getId(); |
|
|
|
|
List<Long> reservationIds = Func.toLongList(ids); |
|
|
|
|
for (Long reservationId : reservationIds) { |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(reservationId); |
|
|
|
|
if (Func.isEmpty(reservationEntity) || !reservationEntity.getReservationStatus().equals("20")) { |
|
|
|
|
log.error("reservationEntity参数异常:+{" + reservationEntity + "}"); |
|
|
|
|
return R.fail("预约信息状态异常!!!"); |
|
|
|
|
} |
|
|
|
|
//修改预约备货状态
|
|
|
|
|
reservationEntity.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue()); |
|
|
|
|
result = SqlHelper.retBool(distributionReservationMapper.updateById(reservationEntity)); |
|
|
|
|
//构建中间表信息
|
|
|
|
|
DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity(); |
|
|
|
|
reservationStockupEntity.setStockupId(id); |
|
|
|
|
reservationStockupEntity.setStockUpType(StockupTypeConstant.shipei.getValue()); |
|
|
|
|
reservationStockupEntity.setReservationId(reservationEntity.getId()); |
|
|
|
|
result = distributionStockupInfoService.save(reservationStockupEntity); |
|
|
|
|
if (!result) { |
|
|
|
|
log.error("sql执行异常:+{" + result + "}"); |
|
|
|
|
return R.fail("请稍后再试"); |
|
|
|
|
} |
|
|
|
|
List<DistributionReservationEntity> reservationEntityList = distributionReservationMapper.selectList(Wrappers.<DistributionReservationEntity>query().lambda().in(DistributionReservationEntity::getId, reservationIds)); |
|
|
|
|
if (Func.isNotEmpty(reservationEntityList)){ |
|
|
|
|
reservationEntityList.forEach(r->{ |
|
|
|
|
r.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue()); |
|
|
|
|
distributionReservationMapper.updateById(r); |
|
|
|
|
DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity(); |
|
|
|
|
reservationStockupEntity.setStockupId(id); |
|
|
|
|
reservationStockupEntity.setStockUpType(StockupTypeConstant.shipei.getValue()); |
|
|
|
|
reservationStockupEntity.setReservationId(r.getId()); |
|
|
|
|
distributionStockupInfoService.save(reservationStockupEntity); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// for (Long reservationId : reservationIds) {
|
|
|
|
|
// DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(reservationId);
|
|
|
|
|
// if (Func.isEmpty(reservationEntity) || !reservationEntity.getReservationStatus().equals("20")) {
|
|
|
|
|
// log.error("reservationEntity参数异常:+{" + reservationEntity + "}");
|
|
|
|
|
// return R.fail("预约信息状态异常!!!");
|
|
|
|
|
// }
|
|
|
|
|
// //修改预约备货状态
|
|
|
|
|
// reservationEntity.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue());
|
|
|
|
|
// result = SqlHelper.retBool(distributionReservationMapper.updateById(reservationEntity));
|
|
|
|
|
// //构建中间表信息
|
|
|
|
|
// DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity();
|
|
|
|
|
// reservationStockupEntity.setStockupId(id);
|
|
|
|
|
// reservationStockupEntity.setStockUpType(StockupTypeConstant.shipei.getValue());
|
|
|
|
|
// reservationStockupEntity.setReservationId(reservationEntity.getId());
|
|
|
|
|
// result = distributionStockupInfoService.save(reservationStockupEntity);
|
|
|
|
|
// if (!result) {
|
|
|
|
|
// log.error("sql执行异常:+{" + result + "}");
|
|
|
|
|
// return R.fail("请稍后再试");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|
|
|
|
log.error("执行异常:+{" + e.getMessage() + "}"); |
|
|
|
|