|
|
|
@ -388,8 +388,8 @@ public class StRealtimeStockServiceImpl extends BaseServiceImpl<StRealtimeStockM |
|
|
|
}// 新增:玻璃饼出库独立分支(与其他出库/刀具出库平级)
|
|
|
|
}// 新增:玻璃饼出库独立分支(与其他出库/刀具出库平级)
|
|
|
|
else if (StStockInoutRecord.INOUT_SOURCE_GLASS_CAKE_OUT.equals(inout.getInOutSource())) { |
|
|
|
else if (StStockInoutRecord.INOUT_SOURCE_GLASS_CAKE_OUT.equals(inout.getInOutSource())) { |
|
|
|
// 玻璃饼出库专属:预占用校验(规则与原有一致)
|
|
|
|
// 玻璃饼出库专属:预占用校验(规则与原有一致)
|
|
|
|
if (StringUtils.isNotBlank(inout.getWoCode()) && stock.getId() != null) { |
|
|
|
if (StringUtils.isNotBlank(inout.getCheckNo()) && stock.getId() != null) { |
|
|
|
if (!this.checkRealTimeLock(inout.getWoCode(), stock.getId().toString())) { |
|
|
|
if (!this.checkRealTimeLock(inout.getCheckNo(), stock.getId().toString())) { |
|
|
|
StGlassCakeOut stGlassCakeOut = stGlassCakeOutMapper.getBySirId(inout.getId()); |
|
|
|
StGlassCakeOut stGlassCakeOut = stGlassCakeOutMapper.getBySirId(inout.getId()); |
|
|
|
if (StringUtils.isNotBlank(stGlassCakeOut.getMemo())) { |
|
|
|
if (StringUtils.isNotBlank(stGlassCakeOut.getMemo())) { |
|
|
|
// 仅备注含"补"字时跳过预占用校验
|
|
|
|
// 仅备注含"补"字时跳过预占用校验
|
|
|
|
@ -418,6 +418,32 @@ public class StRealtimeStockServiceImpl extends BaseServiceImpl<StRealtimeStockM |
|
|
|
if (warnMsg4 != null) { |
|
|
|
if (warnMsg4 != null) { |
|
|
|
warnMsgList.add(warnMsg4); |
|
|
|
warnMsgList.add(warnMsg4); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (StStockInoutRecord.INOUT_SOURCE_GRAPHITE_MOLD_OUT.equals(inout.getInOutSource())) { |
|
|
|
|
|
|
|
// 石墨模出库:校验预占用锁库 + 扣减库存逻辑
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(inout.getCheckNo()) && stock.getId() != null) { |
|
|
|
|
|
|
|
if (!this.checkRealTimeLock(inout.getCheckNo(), stock.getId().toString())) { |
|
|
|
|
|
|
|
throw new ServiceException("石墨模出库需匹配预占用,此工作订单无预占用!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 校验可用库存
|
|
|
|
|
|
|
|
Double surplusQuantity = |
|
|
|
|
|
|
|
stGoods.getCurrentQuantity() + stGoods.getOnthewayQuantity() - stGoods.getLockQuantity(); |
|
|
|
|
|
|
|
if (surplusQuantity < quantity) { |
|
|
|
|
|
|
|
throw new ServiceException(stGoods.getGoodsCode() + "可用库存不足,石墨模出库失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 扣减库存
|
|
|
|
|
|
|
|
stGoodsService.addCurQuantity(inout.getGoodsId(), BigDecimal.valueOf(0).subtract(BigDecimal.valueOf(quantity)).doubleValue()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 最低库存预警
|
|
|
|
|
|
|
|
String warnMsg = checkAndWarnMinStock(stGoods, inout.getGoodsId(), quantity); |
|
|
|
|
|
|
|
if (warnMsg != null) { |
|
|
|
|
|
|
|
warnMsgList.add(warnMsg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 补货触发
|
|
|
|
|
|
|
|
String warnMsg2 = checkAndTriggerReissue(stGoods, inout.getGoodsId(), quantity); |
|
|
|
|
|
|
|
if (warnMsg2 != null) { |
|
|
|
|
|
|
|
warnMsgList.add(warnMsg2); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// else if (StStockInoutRecord.INOUT_SOURCE_ASSIGN_OUT.equals(inout.getInOutSource())) {
|
|
|
|
// else if (StStockInoutRecord.INOUT_SOURCE_ASSIGN_OUT.equals(inout.getInOutSource())) {
|
|
|
|
// if (!stock.getMoldBaseMaterial()) {
|
|
|
|
// if (!stock.getMoldBaseMaterial()) {
|
|
|
|
@ -532,9 +558,10 @@ public class StRealtimeStockServiceImpl extends BaseServiceImpl<StRealtimeStockM |
|
|
|
BigDecimal.valueOf(quantity)) |
|
|
|
BigDecimal.valueOf(quantity)) |
|
|
|
.doubleValue(); |
|
|
|
.doubleValue(); |
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(inout.getWoCode()) && newOccupy >= 0) { |
|
|
|
String lockNo = StrUtil.isNotBlank(inout.getWoCode()) ? inout.getWoCode() : inout.getCardNo(); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(lockNo) && newOccupy >= 0) { |
|
|
|
db.setOccupyQuantity(newOccupy); |
|
|
|
db.setOccupyQuantity(newOccupy); |
|
|
|
this.updateRealTimeLock(inout.getWoCode(), db.getId(), quantity); |
|
|
|
this.updateRealTimeLock(lockNo, db.getId(), quantity); |
|
|
|
// NumberUtil.add(
|
|
|
|
// NumberUtil.add(
|
|
|
|
// BigDecimal.valueOf(newOccupy),
|
|
|
|
// BigDecimal.valueOf(newOccupy),
|
|
|
|
// BigDecimal.valueOf(quantity)
|
|
|
|
// BigDecimal.valueOf(quantity)
|
|
|
|
@ -976,6 +1003,11 @@ public class StRealtimeStockServiceImpl extends BaseServiceImpl<StRealtimeStockM |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public Object[] queryByShIdAndSlId(String goodsCode, Double quantity, Long shId, Long slId) {
|
|
|
|
|
|
|
|
// return baseMapper.queryByShIdAndSlId(goodsCode, quantity, shId, slId);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<StRealtimeStockExcel> exportStRealtimeStock(Wrapper<StRealtimeStock> queryWrapper) { |
|
|
|
public List<StRealtimeStockExcel> exportStRealtimeStock(Wrapper<StRealtimeStock> queryWrapper) { |
|
|
|
List<StRealtimeStockExcel> stRealtimeStockList = baseMapper.exportStRealtimeStock(queryWrapper); |
|
|
|
List<StRealtimeStockExcel> stRealtimeStockList = baseMapper.exportStRealtimeStock(queryWrapper); |
|
|
|
|