fix(qms): exclude current lots from shop-order first-SFC check

Station-in now calls QMS after commit, so lot_state already contains the starting lot and CHK_FIRST_SFC never creates SYWX jobs.
This commit is contained in:
tsiji 2026-09-11 01:30:35 +08:00
parent 146dac5f9e
commit 5b5ef20f78
3 changed files with 22 additions and 4 deletions

View File

@ -648,8 +648,12 @@ public class AutoCreateJobServiceImpl implements AutoCreateJobService {
AtomicInteger count = new AtomicInteger(0);
shopOrderBoMap.forEach((shopOrderBo, lotBasisList) -> {
String shopOrder = HandleBoProcessor.trimHandle(shopOrderBo);
Integer i = autoCreateJobMapper.chkFirstSfcByLotEquipment($site, shopOrder, $resource);
Integer j = autoCreateJobMapper.chkFirstSfcByLotState($site, shopOrder, $resource);
List<String> currentLotNos = lotBasisList.stream()
.map(LotBasis::getLotNo)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
Integer i = autoCreateJobMapper.chkFirstSfcByLotEquipment($site, shopOrder, $resource, currentLotNos);
Integer j = autoCreateJobMapper.chkFirstSfcByLotState($site, shopOrder, $resource, currentLotNos);
int k = i + j;
if (k <= 0) {

View File

@ -11,10 +11,12 @@ import java.util.List;
public interface AutoCreateJobMapper {
Integer chkFirstSfcByLotEquipment(@Param("site") String site, @Param("shopOrder") String shopOrder,
@Param("resource") String resource);
@Param("resource") String resource,
@Param("excludeLotNos") List<String> excludeLotNos);
Integer chkFirstSfcByLotState(@Param("site") String site, @Param("shopOrder") String shopOrder,
@Param("resource") String resource);
@Param("resource") String resource,
@Param("excludeLotNos") List<String> excludeLotNos);
Integer chkDailyFirstSfcByLotEquipment(@Param("site") String site, @Param("resource") String resource,
@Param("daily") LocalDateTime daily);

View File

@ -26,6 +26,12 @@
where a.SITE = #{site}
and a.SHOP_ORDER = #{shopOrder}
and e.RESRCE = #{resource}
<if test="excludeLotNos != null and excludeLotNos.size() &gt; 0">
and b.LOT_NO not in
<foreach collection="excludeLotNos" item="lotNo" open="(" separator="," close=")">
#{lotNo}
</foreach>
</if>
</select>
<select id="chkFirstSfcByLotState" resultType="java.lang.Integer">
select count(1)
@ -36,6 +42,12 @@
where a.SITE = #{site}
and a.SHOP_ORDER = #{shopOrder}
and d.RESRCE = #{resource}
<if test="excludeLotNos != null and excludeLotNos.size() &gt; 0">
and b.LOT_NO not in
<foreach collection="excludeLotNos" item="lotNo" open="(" separator="," close=")">
#{lotNo}
</foreach>
</if>
</select>
<select id="chkDailyFirstSfcByLotEquipment" resultType="java.lang.Integer">