|
|
@@ -6,6 +6,10 @@ import com.ktg.common.core.redis.RedisCache;
|
|
|
import com.ktg.common.utils.SecurityUtils;
|
|
|
import com.ktg.common.utils.bean.BeanUtils;
|
|
|
import com.ktg.iscs.domain.*;
|
|
|
+import com.ktg.iscs.domain.dto.exUpdate.ExDTO;
|
|
|
+import com.ktg.iscs.domain.dto.exUpdate.IsJobCardExDTO;
|
|
|
+import com.ktg.iscs.domain.dto.exUpdate.IsKeyExDTO;
|
|
|
+import com.ktg.iscs.domain.dto.exUpdate.IsLockExDTO;
|
|
|
import com.ktg.iscs.domain.dto.hardwareApi.*;
|
|
|
import com.ktg.iscs.domain.enums.*;
|
|
|
import com.ktg.iscs.domain.vo.hardwareApi.*;
|
|
|
@@ -14,14 +18,15 @@ import com.ktg.iscs.domain.vo.ticket.JobTicketDetailVO;
|
|
|
import com.ktg.iscs.domain.vo.ticket.JobTicketUpdateProgressReqVO;
|
|
|
import com.ktg.iscs.domain.vo.ticketPoints.IsJobTicketPointsVO;
|
|
|
import com.ktg.iscs.service.*;
|
|
|
-import com.ktg.system.domain.vo.IsSystemAttributeVO;
|
|
|
-import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -493,10 +498,15 @@ public class HardwareApiServiceImpl implements HardwareApiService {
|
|
|
* 解锁时,解除因为点位冲突而没有被解除的点位数据
|
|
|
*/
|
|
|
public void updateConflictPoints(Long pointId, Long unlockedByKeyId, Date date, Long lockId) {
|
|
|
+ // 查询当前点位是否有取了钥匙去解锁的作业票,如果有则更新
|
|
|
+ List<IsJobTicketPoints> notFinishConflictJob = iIsJobTicketPointsService.getNotFinishConflictJob(pointId, lockId);
|
|
|
// 查询当前点位是否有已经完成的作业票,但是该点位没有解锁的
|
|
|
List<IsJobTicketPoints> finishConflictJob = iIsJobTicketPointsService.getFinishConflictJob(pointId, lockId);
|
|
|
+ finishConflictJob.addAll(notFinishConflictJob);
|
|
|
+ HashSet<IsJobTicketPoints> isJobTicketPoints1 = new HashSet<>(finishConflictJob);
|
|
|
+ // 查询都是去解锁的
|
|
|
if (!finishConflictJob.isEmpty()) {
|
|
|
- for (IsJobTicketPoints isJobTicketPoints : finishConflictJob) {
|
|
|
+ for (IsJobTicketPoints isJobTicketPoints : isJobTicketPoints1) {
|
|
|
// 2.1.1更新隔离点解锁信息
|
|
|
iIsJobTicketPointsService.update(Wrappers.<IsJobTicketPoints>lambdaUpdate()
|
|
|
.eq(IsJobTicketPoints::getRecordId, isJobTicketPoints.getRecordId())
|
|
|
@@ -901,4 +911,54 @@ public class HardwareApiServiceImpl implements HardwareApiService {
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean updateHardwareEsStatus(ExDTO dto) {
|
|
|
+ // 1.开始更新钥匙
|
|
|
+ if (!dto.getKeyExDTOList().isEmpty()) {
|
|
|
+ List<String> keyNfcList = dto.getKeyExDTOList().stream().map(IsKeyExDTO::getKeyNfc).collect(Collectors.toList());
|
|
|
+ List<IsKey> isKeyList = isKeyService.list(Wrappers.<IsKey>lambdaQuery()
|
|
|
+ .in(IsKey::getKeyNfc, keyNfcList));
|
|
|
+ for (IsKey isKey : isKeyList) {
|
|
|
+ for (IsKeyExDTO isKeyExDTO : dto.getKeyExDTOList()) {
|
|
|
+ if (isKey.getKeyNfc().equals(isKeyExDTO.getKeyNfc())) {
|
|
|
+ isKey.setExStatus(isKeyExDTO.getExStatus());
|
|
|
+ isKey.setExRemark(isKeyExDTO.getExRemark());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ isKeyService.updateBatchById(isKeyList);
|
|
|
+ }
|
|
|
+ // 2.开始更新挂锁
|
|
|
+ if (!dto.getLockExDTOList().isEmpty()) {
|
|
|
+ List<String> lockNfcList = dto.getLockExDTOList().stream().map(IsLockExDTO::getLockNfc).collect(Collectors.toList());
|
|
|
+ List<IsLock> isLockList = iIsLockService.list(Wrappers.<IsLock>lambdaQuery()
|
|
|
+ .in(IsLock::getLockNfc, lockNfcList));
|
|
|
+ for (IsLock isLock : isLockList) {
|
|
|
+ for (IsLockExDTO isLockExDTO : dto.getLockExDTOList()) {
|
|
|
+ if (isLock.getLockNfc().equals(isLockExDTO.getLockNfc())) {
|
|
|
+ isLock.setExStatus(isLockExDTO.getExStatus());
|
|
|
+ isLock.setExRemark(isLockExDTO.getExRemark());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iIsLockService.updateBatchById(isLockList);
|
|
|
+ }
|
|
|
+ // 3.开始更新挂锁
|
|
|
+ if (!dto.getJobCardExDTOList().isEmpty()) {
|
|
|
+ List<String> cardNfcList = dto.getJobCardExDTOList().stream().map(IsJobCardExDTO::getCardNfc).collect(Collectors.toList());
|
|
|
+ List<IsJobCard> cardList = iIsJobCardService.list(Wrappers.<IsJobCard>lambdaQuery()
|
|
|
+ .in(IsJobCard::getCardNfc, cardNfcList));
|
|
|
+ for (IsJobCard isJobCard : cardList) {
|
|
|
+ for (IsJobCardExDTO isJobCardExDTO : dto.getJobCardExDTOList()) {
|
|
|
+ if (isJobCard.getCardNfc().equals(isJobCardExDTO.getCardNfc())) {
|
|
|
+ isJobCard.setExStatus(isJobCardExDTO.getExStatus());
|
|
|
+ isJobCard.setExRemark(isJobCardExDTO.getExRemark());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iIsJobCardService.updateBatchById(cardList);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|