fix: hold blocked outbound before WCS dispatch

This commit is contained in:
zgw
2026-09-15 11:04:07 +08:00
parent a0af05bfa2
commit 58e9832b61
7 changed files with 158 additions and 0 deletions

View File

@@ -51,6 +51,11 @@ public class ToWcsServiceImpl implements IToWcsService {
mydoJobParam.setInOut("2");
List<MydoJob> outMydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam);
for (MydoJob outMydoJob : outMydoJobs) {
// HTTP success only confirms receipt. A rear outbound stays in status 1 until
// every deeper position in its own lane is physically clear.
if (mydoJobService.isOutboundDispatchBlocked(outMydoJob.getJobId())) {
continue;
}
RequestLog requestLog = requestLogService.getRequestLog(PUSH_OUT_MYDO_JOB, JSONUtil.toJsonStr(outMydoJob), "推送出库任务","wms","wcs");
if ("1".equals(requestLog.getIsSuccessful())){
outMydoJob.setStatus("3");

View File

@@ -95,4 +95,6 @@ public interface MydoJobMapper
void updateLedError(HashMap<String, Object> map);
Integer selectBySpare4OrCargo(InStockinDetail inStockinDetail);
int countOutboundDispatchBlockers(@Param("jobId") String jobId);
}

View File

@@ -111,4 +111,7 @@ public interface IMydoJobService
List<MydoJob> getInJobBySerial(String serial);
void ykCompleted(MydoJob outJob);
/** True while a deeper position in the same lane blocks this outbound. */
boolean isOutboundDispatchBlocked(String jobId);
}

View File

@@ -540,4 +540,9 @@ public class MydoJobServiceImpl implements IMydoJobService {
log.info("移库任务处理成功 jobId:[{}] trayCode:[{}]", outJob.getJobId(), outJob.getTrayCode());
}
}
@Override
public boolean isOutboundDispatchBlocked(String jobId) {
return mydoJobMapper.countOutboundDispatchBlockers(jobId) > 0;
}
}

View File

@@ -271,6 +271,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from mydo_job where task_no = #{taskNo}
</select>
<select id="countOutboundDispatchBlockers" parameterType="String" resultType="int">
select count(1)
from mydo_job job
join bas_cargo_space source_space on source_space.cargo_space_id = job.cargo_space_id
where job.job_id = #{jobId}
and try_convert(int, job.in_or_out) &gt;= 20
and exists (
select 1
from bas_cargo_space outer_space
where outer_space.warehouse_id = source_space.warehouse_id
and outer_space.group_coding_no = source_space.group_coding_no
and try_convert(int, outer_space.group_coding) &gt; try_convert(int, source_space.group_coding)
and (
isnull(outer_space.status, '') &lt;&gt; '1'
or isnull(outer_space.locked, '') &lt;&gt; 'N'
or nullif(ltrim(rtrim(outer_space.tray_code)), '') is not null
or exists (select 1 from bas_stock stock where stock.cargo_space_id = outer_space.cargo_space_id)
or exists (
select 1 from mydo_job outer_job
where outer_job.job_id &lt;&gt; job.job_id
and (outer_job.cargo_space_id = outer_space.cargo_space_id
or outer_job.target_cargo_space_id = outer_space.cargo_space_id)
)
)
)
</select>
<select id="allotInJobSpace" parameterType="java.util.Map" statementType="CALLABLE">
{call proc_allot_space(