|
|
|
@ -28,13 +28,16 @@ import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.redisson.api.RLock;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -127,6 +130,9 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesMoveRuleRepository mesMoveRuleRepository;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "redisMesPcn")
|
|
|
|
|
private ImppRedis redisMesPcn;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ListPager<MesPartInspection> queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) {
|
|
|
|
|
|
|
|
|
@ -204,8 +210,22 @@ public class MesNcProcessingService implements IMesNcProcessingService {
|
|
|
|
|
Integer type = model.getType();
|
|
|
|
|
MesDefectType person = StringUtil.isEmpty(model.getPerson())?new MesDefectType():model.getPerson();
|
|
|
|
|
|
|
|
|
|
final String redisKey = MesPcnExtConstWords.SAP_TRANS_JOB_LOCK_TAG + model.getSn();
|
|
|
|
|
RLock rLock = (RLock) redisMesPcn.getLock(redisKey);
|
|
|
|
|
try {
|
|
|
|
|
//使用tryLock拿不到锁直接返回
|
|
|
|
|
//rlock的leaseTime为-1,会每隔WatchdogTimeout秒去续约
|
|
|
|
|
if (!rLock.tryLock()){
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】此条码正在处理中,不能并发执行!", model.getSn()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存数据
|
|
|
|
|
saveDate(model, model.getPart(), type, person, org,model.getInventoryLocationCode(),isOrder);
|
|
|
|
|
} finally {
|
|
|
|
|
if (rLock.isHeldByCurrentThread()) {
|
|
|
|
|
rLock.unlock();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
Integer type = model.getType();
|
|
|
|
|