Browse Source

乐观锁

master
常熟吴彦祖 5 months ago
parent
commit
edb1c51a6d
  1. 23
      src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java
  2. 15
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java

23
src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java

@ -235,6 +235,27 @@ public class WmsMessageServiceImpl implements WmsMessageService {
if (currentStation == null) {
throw new RuntimeException("未找到托盘当前站点信息:" + currentLocationCode);
}
pallet.setLocationCode(request.getToStation());
pallet.setWcsLocation(request.getToStation());
palletService.updateById(pallet);
//如果更新wcs库位
//这里插入逻辑
// 检查该站点是否还有其他栈板如果没有则更新站点状态为空闲
long otherPalletCount = palletService.lambdaQuery()
.eq(Pallet::getSite, request.getSite())
.eq(Pallet::getLocationCode, currentLocationCode)
.ne(Pallet::getPalletId, request.getPalletId()) // 排除当前栈板
.eq(Pallet::getIsDeleted, "0")
.count();
if (otherPalletCount == 0) {
// 没有其他栈板在该站点更新站点状态为空闲
log.info("站点 {} 无其他栈板,更新状态为空闲", currentLocationCode);
wcsIntegrationMapper.updateAgvStationStatus(currentLocationCode, 0, "空闲");
} else {
log.info("站点 {} 还有 {} 个其他栈板,保持站点状态", currentLocationCode, otherPalletCount);
}
String fromWarehouseId;
String fromLocationId;
//如果是*说明在立库里需要查询里面料的当前位置
@ -363,9 +384,7 @@ public class WmsMessageServiceImpl implements WmsMessageService {
}
pallet.setLocationCode(request.getToStation());
palletService.updateById(pallet);
String result = "移库操作完成,出库事务号:" + stoTransNo + ",入库事务号:" + stiTransNo;

15
src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java

@ -4,16 +4,23 @@ import com.gaotao.modules.api.entity.WareHouseTransferRequest;
import com.gaotao.modules.api.service.WcsApiService;
import com.gaotao.modules.api.service.WmsMessageService;
import com.gaotao.modules.automatedWarehouse.entity.AgvStation;
import com.gaotao.modules.automatedWarehouse.entity.WcsCallbackTask;
import com.gaotao.modules.automatedWarehouse.entity.WmsOrderTask;
import com.gaotao.modules.automatedWarehouse.mapper.WcsIntegrationMapper;
import com.gaotao.modules.automatedWarehouse.service.WcsIntegrationService;
import com.gaotao.modules.automatedWarehouse.service.WcsTaskService;
import com.gaotao.modules.warehouse.entity.Pallet;
import com.gaotao.modules.warehouse.service.PalletService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* WCS任务处理服务实现类
@ -21,7 +28,11 @@ import java.util.List;
@Slf4j
@Service
public class WcsTaskServiceImpl implements WcsTaskService {
@Autowired
private PalletService palletService;
@Autowired
private WcsIntegrationService wcsIntegrationService;
@Autowired
private WcsIntegrationMapper wcsIntegrationMapper;
@ -80,8 +91,7 @@ public class WcsTaskServiceImpl implements WcsTaskService {
// 5. 如果是入库更新对应的wms_order_task状态
if ("入库".equals(callbackTask.getTransTypeDesc())) {
updateOrderTaskStatusForInbound(callbackTask);
//如果更新wcs库位
wcsIntegrationMapper.updatePalletWcsLocation(callbackTask.getSite(), callbackTask.getPalletId(), callbackTask.getToStation());
}
if ("出库".equals(callbackTask.getTransTypeDesc())) {
wcsIntegrationMapper.updatePalletWcsLocation(callbackTask.getSite(), callbackTask.getPalletId(), "");
@ -258,4 +268,5 @@ public class WcsTaskServiceImpl implements WcsTaskService {
return 0;
}
}
}
Loading…
Cancel
Save