feat: observe inbound allocation without changing legacy

This commit is contained in:
zgw
2026-08-11 18:44:25 +08:00
parent 01333cbf03
commit 023f3f5e02
2 changed files with 121 additions and 1 deletions

View File

@@ -6,6 +6,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.ruoyi.algorithm.shadow.InboundShadowObservation;
import com.ruoyi.algorithm.shadow.ShadowObservationGateway;
import com.ruoyi.api.domain.*;
import com.ruoyi.api.service.IToErpService;
import com.ruoyi.api.service.IToWmsService;
@@ -90,6 +92,8 @@ public class ToWmsServiceImpl implements IToWmsService {
private IBasStockService stockService;
@Autowired
private MydoJobMapper mydoJobMapper;
@Autowired
private ShadowObservationGateway shadowObservationGateway;
@Override
@@ -412,11 +416,22 @@ public class ToWmsServiceImpl implements IToWmsService {
map.put("v_tray_code", inJob.getTrayCode());
map.put("v_code", deviceCode);
InboundShadowObservation shadowObservation = InboundShadowObservation.empty();
try {
shadowObservation = shadowObservationGateway.planInbound(taskNo, inJob.getTrayCode());
} catch (RuntimeException exception) {
log.warn("Inbound shadow observation failed open for task {}: {}",
taskNo, exception.getMessage());
}
mydoJobMapper.allotInJobSpace(map);
if (!"10".equals(map.get("v_result").toString())) {
String legacyResultCode = map.get("v_result").toString();
if (!"10".equals(legacyResultCode)) {
compareInboundShadow(shadowObservation, legacyResultCode, null);
return AjaxResult.error(map.get("v_resultmsg").toString());
}else{
MydoJob inJob2 = mydoJobMapper.selectInJobByTaskNo(taskNo);
compareInboundShadow(shadowObservation, legacyResultCode,
inJob2 == null ? null : inJob2.getCargoSpaceId());
return AjaxResult.success(inJob2);
}
}
@@ -425,5 +440,15 @@ public class ToWmsServiceImpl implements IToWmsService {
}
}
private void compareInboundShadow(InboundShadowObservation observation,
String legacyResultCode, String legacySpaceId) {
try {
shadowObservationGateway.compareInbound(observation, legacyResultCode, legacySpaceId);
} catch (RuntimeException exception) {
log.warn("Inbound shadow comparison failed open for request {}: {}",
observation == null ? null : observation.requestId(), exception.getMessage());
}
}
}