商品耗材取消订单/退菜/退单红冲库存
This commit is contained in:
parent
2f2eaf7edf
commit
9b10ef0f5f
|
|
@ -34,6 +34,10 @@ public class ProductModifyStockParam implements Serializable {
|
|||
@Min(value = 0, message = "库存数量不能小于0", groups = DefaultGroup.class)
|
||||
@Max(value = Integer.MAX_VALUE, message = "库存数量不能大于" + Integer.MAX_VALUE, groups = DefaultGroup.class)
|
||||
private Integer stockNumber;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class ConsStockFlowServiceImpl extends ServiceImpl<ConsStockFlowMapper, C
|
|||
throw new CzgException(StrUtil.format("耗材{}报损数量不能大于当前库存{}", entity.getConName(), consInfo.getStockNumber()));
|
||||
}
|
||||
entity.setBeforeNumber(consInfo.getStockNumber());
|
||||
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, balance));
|
||||
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, param.getNumber()));
|
||||
entity.setAfterNumber(balance);
|
||||
entity.setInOutType(InOutTypeEnum.OUT.value());
|
||||
entity.setInOutItem(InOutItemEnum.DAMAGE_OUT.value());
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||
if (entity.getIsStock() == YesNoEnum.NO.value()) {
|
||||
return;
|
||||
}
|
||||
if(!entity.getShopId().equals(param.getShopId())) {
|
||||
if (!entity.getShopId().equals(param.getShopId())) {
|
||||
return;
|
||||
}
|
||||
UpdateChain.of(Product.class)
|
||||
|
|
@ -365,6 +365,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||
return;
|
||||
}
|
||||
flow.setAfterNumber(NumberUtil.toBigDecimal(entity.getStockNumber()));
|
||||
flow.setRemark(param.getRemark());
|
||||
productStockFlowService.saveFlow(flow);
|
||||
}
|
||||
|
||||
|
|
@ -539,19 +540,19 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|||
entity.setConId(consInfo.getConsInfoId());
|
||||
entity.setConName(consInfo.getConName());
|
||||
entity.setPurchasePrice(consInfo.getPrice());
|
||||
BigDecimal balance = NumberUtil.sub(consInfo.getStockNumber(), param.getNumber());
|
||||
BigDecimal inOutNumber = NumberUtil.mul(param.getNumber(), consInfo.getSurplusStock());
|
||||
BigDecimal balance = NumberUtil.sub(consInfo.getStockNumber(), inOutNumber);
|
||||
if (NumberUtil.isLess(balance, BigDecimal.ZERO)) {
|
||||
throw new CzgException(StrUtil.format("耗材{}存在发生变动,请刷新后重试", entity.getConName()));
|
||||
}
|
||||
entity.setBeforeNumber(consInfo.getStockNumber());
|
||||
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, balance));
|
||||
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, inOutNumber));
|
||||
entity.setAfterNumber(balance);
|
||||
entity.setInOutType(InOutTypeEnum.OUT.value());
|
||||
entity.setInOutItem(InOutItemEnum.DAMAGE_OUT.value());
|
||||
entity.setSubTotal(NumberUtil.mul(param.getNumber(), consInfo.getPrice()));
|
||||
entity.setSubTotal(NumberUtil.mul(inOutNumber, consInfo.getPrice()));
|
||||
entity.setImgUrls(JSON.toJSONString(param.getImgUrls()));
|
||||
entity.setRemark("【商品报损,自动报损相关耗材】" + StrUtil.nullToDefault(param.getRemark(), ""));
|
||||
consStockFlowMapper.insert(entity);
|
||||
consStockFlowService.saveFlow(entity);
|
||||
consInfo.setStockNumber(entity.getAfterNumber());
|
||||
UpdateChain.of(ConsInfo.class)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
t2.con_unit,
|
||||
t2.con_name,
|
||||
t2.price,
|
||||
t2.stock_number
|
||||
t2.stock_number,
|
||||
t1.surplus_stock
|
||||
FROM tb_prod_cons_relation t1
|
||||
LEFT JOIN tb_cons_info t2 on t1.cons_info_id = t2.id
|
||||
WHERE t1.product_id = #{prodId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue