fix:修复设备台账更新问题

main
HuangHuiKang 11 hours ago
parent 3b663ea96c
commit 2a525ad190

@ -422,7 +422,7 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
item -> copyStockOutItem(sourceItem, warehouseId, areaId));
BigDecimal palletCount = resolvePalletCount(pallet, sourceItem);
if (palletCount.compareTo(BigDecimal.ZERO) <= 0) {
throw exception(STOCK_OUT_PRODUCT_PALLET_COUNT_EMPTY, pallet.getPalletId());
throw exception(STOCK_OUT_PRODUCT_PALLET_COUNT_EMPTY, getPalletCodeOrId(pallet.getPalletId()));
}
palletTotalCount = palletTotalCount.add(palletCount);
targetItem.setCount(defaultZero(targetItem.getCount()).add(palletCount));
@ -440,6 +440,14 @@ public class ErpStockOutServiceImpl implements ErpStockOutService {
reqVO.setItems(normalizedItems);
}
private Object getPalletCodeOrId(Long palletId) {
if (palletId == null) {
return null;
}
ErpPalletDO pallet = palletMapper.selectById(palletId);
return pallet != null && pallet.getCode() != null ? pallet.getCode() : palletId;
}
private ErpStockOutSaveReqVOItem copyStockOutItem(ErpStockOutSaveReqVOItem sourceItem, Long warehouseId, Long areaId) {
ErpStockOutSaveReqVOItem targetItem = BeanUtils.toBean(sourceItem, ErpStockOutSaveReqVOItem.class);
targetItem.setId(null);

@ -255,6 +255,9 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
updateObj.setComponentId(updateObj.getComponentId()==null?"":updateObj.getComponentId());
updateObj.setBeijianId(updateObj.getBeijianId()==null?"":updateObj.getBeijianId());
deviceLedgerMapper.updateById(updateObj);
deviceLedgerMapper.update(null, Wrappers.<DeviceLedgerDO>lambdaUpdate()
.eq(DeviceLedgerDO::getId, updateObj.getId())
.set(DeviceLedgerDO::getDvId, updateReqVO.getDvId()));
deviceLedgerComponentRelService.replaceByDeviceLedgerId(updateObj.getId(), updateReqVO.getComponentId());
deviceLedgerSpareRelService.replaceByDeviceLedgerId(updateObj.getId(), updateReqVO.getBeijianId());
}

Loading…
Cancel
Save