|
@@ -192,6 +192,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
* @param invLotLocIdMoveForm
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public AjaxResult move(InvLotLocIdMoveForm invLotLocIdMoveForm) {
|
|
|
String locationFrom = invLotLocIdMoveForm.getLocationFrom();
|
|
@@ -201,6 +202,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
Long warehouseId = invLotLocIdMoveForm.getWarehouseId();
|
|
|
BaseLocationInfo baseLocationFrom = null;
|
|
|
BaseLocationInfo baseLocationTo = null;
|
|
|
+ String palletNo;
|
|
|
|
|
|
// 验证起始库位
|
|
|
Boolean isIdleFrom = baseLocationInfoService.verifyLocationIsIdle(locationFrom, warehouseId);
|
|
@@ -219,6 +221,16 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
// 起始和目标库位
|
|
|
baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
|
|
|
baseLocationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, warehouseId);
|
|
|
+ if (baseLocationTo.getZoneId().equals(Constant.ZONE_TYPE.ZONE_VIRTUAL.getValue())) {
|
|
|
+ return AjaxResult.error("目标库位虚拟库位不可叫车!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证起始库位必须有货
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationFrom.getId());
|
|
|
+ if (invLotLocIdLotattVOList.size() == 0) {
|
|
|
+ return AjaxResult.error("起始库位需要有库存!");
|
|
|
+ }
|
|
|
+ palletNo = invLotLocIdLotattVOList.get(0).getLotatt07();
|
|
|
|
|
|
// 根据起始库位判断目标库位是否可以放置
|
|
|
Boolean canPut = iBusinessService.checkLocCanPut(baseLocationFrom, baseLocationTo);
|
|
@@ -251,9 +263,12 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
baseLocationInfoService.lockLocationStockStatus(baseLocationFrom.getId(), baseLocationTo.getId()
|
|
|
, warehouseId, updateBy);
|
|
|
|
|
|
+ // 更新托盘绑定库位关系
|
|
|
+ iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
|
|
|
return AjaxResult.success("执行成功");
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public AjaxResult moveDirect(InvLotLocIdMoveForm invLotLocIdMoveForm) {
|
|
|
String locationFrom = invLotLocIdMoveForm.getLocationFrom();
|
|
@@ -263,6 +278,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
Long warehouseId = invLotLocIdMoveForm.getWarehouseId();
|
|
|
BaseLocationInfo baseLocationFrom = null;
|
|
|
BaseLocationInfo baseLocationTo = null;
|
|
|
+ String palletNo;
|
|
|
|
|
|
// 验证起始库位
|
|
|
Boolean isIdleFrom = baseLocationInfoService.verifyLocationIsIdle(locationFrom, warehouseId);
|
|
@@ -276,14 +292,21 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
}
|
|
|
Boolean isInStock = baseLocationInfoService.verifyLocationIsInStock(locationTo, warehouseId);
|
|
|
if (isInStock) {
|
|
|
- return AjaxResult.error("目标库位有货!");
|
|
|
+// return AjaxResult.error("目标库位有货!");
|
|
|
}
|
|
|
// 起始和目标库位
|
|
|
baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
|
|
|
baseLocationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, warehouseId);
|
|
|
|
|
|
+ // 验证起始库位必须有货
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationFrom.getId());
|
|
|
+ if (invLotLocIdLotattVOList.size() == 0) {
|
|
|
+ return AjaxResult.error("起始库位需要有库存!");
|
|
|
+ }
|
|
|
+ palletNo = invLotLocIdLotattVOList.get(0).getLotatt07();
|
|
|
+
|
|
|
// 转移库存
|
|
|
- int stockTransfer = invLotLocIdService.stockTransfer(baseLocationFrom.getId(), invLotLocIdMoveForm.getPalletNo(), baseLocationTo.getId());
|
|
|
+ int stockTransfer = invLotLocIdService.stockTransfer(baseLocationFrom.getId(), null, baseLocationTo.getId());
|
|
|
if (stockTransfer <= 0) {
|
|
|
return AjaxResult.success("库存转移失败!");
|
|
|
}
|
|
@@ -292,8 +315,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
|
|
|
// 更新目标库位空闲有货
|
|
|
baseLocationInfoService.updateLocationIdleAndNoEmpty(baseLocationTo.getId(), warehouseId, updateBy);
|
|
|
|
|
|
- // todo 事务
|
|
|
-
|
|
|
+ // 更新托盘绑定库位关系
|
|
|
+ iWmsBoxInfoService.updateLocationBind(palletNo,baseLocationFrom.getId(),baseLocationTo.getId(),null);
|
|
|
return AjaxResult.success("操作成功!");
|
|
|
}
|
|
|
|