|
@@ -163,7 +163,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R saveShipMessage(PjShip ship) {
|
|
public R saveShipMessage(PjShip ship) {
|
|
|
-
|
|
|
|
|
//获得所属公司
|
|
//获得所属公司
|
|
|
R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
if (ObjectUtil.isNotEmpty(dept)) {
|
|
if (ObjectUtil.isNotEmpty(dept)) {
|
|
@@ -199,6 +198,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
baseMapper.insert(ship);
|
|
baseMapper.insert(ship);
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ PjShip ship1 = baseMapper.selectById(ship.getId());
|
|
|
|
|
+ if ("已入库".equals(ship1.getStatusName())) {
|
|
|
|
|
+ throw new RuntimeException("该单据已入库,请刷新页面");
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("已出库".equals(ship1.getStatusName())) {
|
|
|
|
|
+ throw new RuntimeException("该单据已出库,请刷新页面");
|
|
|
|
|
+ }
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
ship.setUpdateTime(new Date());
|
|
|
baseMapper.updateById(ship);
|
|
baseMapper.updateById(ship);
|
|
@@ -606,7 +612,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
}
|
|
|
if (stockOne != null) {
|
|
if (stockOne != null) {
|
|
|
if (stockOne.getBalanceQuantity().compareTo(item.getSendNum()) < 0) {
|
|
if (stockOne.getBalanceQuantity().compareTo(item.getSendNum()) < 0) {
|
|
|
- throw new RuntimeException("库存不足,出库失败");
|
|
|
|
|
|
|
+ System.err.println("商品:"+goodsDesc.getCname());
|
|
|
|
|
+ throw new RuntimeException("商品:"+goodsDesc.getCname()+"库存不足,出库失败");
|
|
|
}
|
|
}
|
|
|
stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().subtract(item.getSendNum()));
|
|
stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().subtract(item.getSendNum()));
|
|
|
stockOne.setStoreInventory(stockOne.getBalanceQuantity());
|
|
stockOne.setStoreInventory(stockOne.getBalanceQuantity());
|