|
|
|
@ -101,8 +101,30 @@ public class PlateGoodsRecordServiceImpl extends BaseServiceImpl<PlateGoodsRecor |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean save(PlateGoodsRecord entity, List<PlateGoodsRecordDetail> detailList) { |
|
|
|
public boolean save(PlateGoodsRecord entity, List<PlateGoodsRecordDetail> detailList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String goodsCode = entity.getGoodsCode(); |
|
|
|
|
|
|
|
BigDecimal silverPotassium = entity.getSilverPotassium(); |
|
|
|
|
|
|
|
BigDecimal coefficient = entity.getCoefficient(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal sunGoodsDemand = entity.getGoodsDemand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (goodsCode.equals(PlateGoodsConst.SILVER_PLATE) && silverPotassium.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
|
|
BigDecimal silverPotassiumProduct = silverPotassium.multiply(coefficient); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sunGoodsDemand.subtract(silverPotassiumProduct).compareTo(BigDecimal.ZERO) >= 0) { |
|
|
|
|
|
|
|
sunGoodsDemand = sunGoodsDemand.subtract(silverPotassiumProduct); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
throw new ServiceException("上报银钾转换后大于银板需求数,请减小上报银钾数"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.setSilverPotassium(silverPotassium); |
|
|
|
|
|
|
|
entity.setSilverPotassiumResidue(silverPotassium.doubleValue()); |
|
|
|
|
|
|
|
entity.setCoefficient(coefficient); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.setGoodsDemand(sunGoodsDemand); |
|
|
|
|
|
|
|
entity.setSurplus(sunGoodsDemand); |
|
|
|
entity.setDemandCode(generateCode()); |
|
|
|
entity.setDemandCode(generateCode()); |
|
|
|
entity.setSurplus(entity.getGoodsDemand()); |
|
|
|
|
|
|
|
entity.setStatus(PlateGoodsEnum.STATUS_WAITING.getCode()); |
|
|
|
entity.setStatus(PlateGoodsEnum.STATUS_WAITING.getCode()); |
|
|
|
entity.setApprovalStatus(PlateGoodsEnum.STATUS_WAITING.getCode()); |
|
|
|
entity.setApprovalStatus(PlateGoodsEnum.STATUS_WAITING.getCode()); |
|
|
|
if (StringUtils.isEmpty(entity.getGoodsName())) { |
|
|
|
if (StringUtils.isEmpty(entity.getGoodsName())) { |
|
|
|
@ -492,6 +514,20 @@ public class PlateGoodsRecordServiceImpl extends BaseServiceImpl<PlateGoodsRecor |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
plateGoodsRecord.setGoodsBoId(goodsBoId); |
|
|
|
plateGoodsRecord.setGoodsBoId(goodsBoId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判定银钾有值一起单独申报
|
|
|
|
|
|
|
|
if (plateGoodsRecord.getSilverPotassium() != null && plateGoodsRecord.getSilverPotassium().compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long CoefficientBoId = wmsTaskClient.buyOrderApply( |
|
|
|
|
|
|
|
PlateGoodsConst.SILVER_POTASSIUM, |
|
|
|
|
|
|
|
plateGoodsRecord.getSilverPotassium().doubleValue(), |
|
|
|
|
|
|
|
plateGoodsRecord.getCreateUser(), |
|
|
|
|
|
|
|
plateGoodsRecord.getCreateTime(), |
|
|
|
|
|
|
|
user.getUserId(), |
|
|
|
|
|
|
|
plateGoodsRecord.getUpdateTime() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
plateGoodsRecord.setCoefficientBoId(CoefficientBoId); |
|
|
|
|
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("调用ERP失败,id:{}", id, e); |
|
|
|
log.error("调用ERP失败,id:{}", id, e); |
|
|
|
throw new ServiceException("调用ERP接口失败:" + e.getMessage()); |
|
|
|
throw new ServiceException("调用ERP接口失败:" + e.getMessage()); |
|
|
|
|