fix: remove INT dependency on new MES mapper

This commit is contained in:
tsiji 2026-07-31 17:13:12 +08:00
parent c1b76a8404
commit 8693177d33
2 changed files with 25 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import com.foreverwin.iep.integration.domain.MaterialQtySapRequest;
import com.foreverwin.iep.integration.entity.IntInData;
import com.foreverwin.iep.integration.entity.IntInDataLog;
import com.foreverwin.iep.integration.handler.def.sap.*;
import com.foreverwin.iep.integration.mapper.MaterialQtyAdjustmentQueryMapper;
import com.foreverwin.iep.integration.service.IntInDataLogService;
import com.foreverwin.iep.integration.service.IntInDataService;
import com.foreverwin.iep.integration.service.LotMaterialDealSendSapService;
@ -76,7 +77,7 @@ public class ShopOrderStatisticTransController {
private final ZLotMaterialConsumptionTransactionOffMapper zLotMaterialConsumptionTransactionOffMapper;
private final ZLotMaterialQtyAdjustmentMapper zLotMaterialQtyAdjustmentMapper;
private final MaterialQtyAdjustmentQueryMapper materialQtyAdjustmentQueryMapper;
@Autowired
@Qualifier("ZMM_MES_GOODMVT_REVERSE") // 通过 Bean 名称注入
@ -408,13 +409,13 @@ public class ShopOrderStatisticTransController {
String user = SecurityUtils.getUserName();
LocalDateTime localDateTime = LocalDateTime.now();
for (ZLotMaterialConsumptionTransaction consumptionTransaction : lotMaterialConsumptionTransactions) {
if (zLotMaterialQtyAdjustmentMapper.selectById(consumptionTransaction.getSid()) != null) {
if (materialQtyAdjustmentQueryMapper.countBySid(consumptionTransaction.getSid()) > 0) {
throw BusinessException.build("数量调整生成的261不允许使用整张凭证冲销");
}
if (zLotMaterialQtyAdjustmentMapper.countPending(consumptionTransaction.getSid()) > 0) {
if (materialQtyAdjustmentQueryMapper.countPending(consumptionTransaction.getSid()) > 0) {
throw BusinessException.build("该物料消耗事务存在待处理数量调整,请先完成核对");
}
if (zLotMaterialQtyAdjustmentMapper.countSuccess(consumptionTransaction.getSid()) > 0) {
if (materialQtyAdjustmentQueryMapper.countSuccess(consumptionTransaction.getSid()) > 0) {
throw BusinessException.build("批次" + consumptionTransaction.getLotNo() + "存在成功的数量调整,不允许整张凭证冲销");
}
ZLotMaterialCancel zLotMaterialCancel = zLotMaterialCancelMapper.selectById(consumptionTransaction.getSid());

View File

@ -0,0 +1,20 @@
package com.foreverwin.iep.integration.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface MaterialQtyAdjustmentQueryMapper {
@Select("select count(1) from z_lot_material_qty_adjustment where SID = #{sid}")
int countBySid(@Param("sid") String sid);
@Select("select count(1) from z_lot_material_qty_adjustment where SOURCE_TRANSACTION_SID = #{sourceSid} " +
"and STATUS in ('PROCESSING','SAP_UNKNOWN','LOCAL_PENDING')")
int countPending(@Param("sourceSid") String sourceSid);
@Select("select count(1) from z_lot_material_qty_adjustment " +
"where SOURCE_TRANSACTION_SID = #{sourceSid} and STATUS = 'SUCCESS'")
int countSuccess(@Param("sourceSid") String sourceSid);
}