|
|
|
@ -30,7 +30,6 @@ import java.nio.charset.StandardCharsets; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
@ -82,23 +81,23 @@ public class ModbusCommunicateServiceImpl implements ModbusCommunicateService { |
|
|
|
|
|
|
|
//获取对应检验单号的值 |
|
|
|
List<List<Float>> floatValues = getValue(modbusIp, modbusPort, registerAddress, registerNum, unitId); |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
String site = folderLocation.getSite(); |
|
|
|
String buNo = folderLocation.getBuNo(); |
|
|
|
String fileNo = folderLocation.getFileNo(); |
|
|
|
params.add(site); |
|
|
|
params.add(buNo); |
|
|
|
params.add(fileNo); |
|
|
|
List<Map<String, Object>> resultList = procedureDao.getProcedureData("Equipment_batch_no", params); |
|
|
|
|
|
|
|
|
|
|
|
//获取对应的batchNo |
|
|
|
LambdaQueryWrapper<EquipmentFolderSortEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(EquipmentFolderSortEntity::getSite,folderLocation.getSite()); |
|
|
|
wrapper.eq(EquipmentFolderSortEntity::getBuNo,folderLocation.getBuNo()); |
|
|
|
wrapper.eq(EquipmentFolderSortEntity::getInspectionNo,inspectionOrderNumber); |
|
|
|
EquipmentFolderSortEntity one = equipmentFolderSortService.getOne(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
Integer batchNo ; |
|
|
|
//在所有的数据新增玩之后 , 对应的获取批次号进行新增或者修改(数据第一次就新增) |
|
|
|
if (CollectionUtils.isEmpty(resultList)) { |
|
|
|
if (one==null) { |
|
|
|
EquipmentFolderSortEntity equipmentFolderSortEntity = new EquipmentFolderSortEntity(); |
|
|
|
equipmentFolderSortEntity.setSite(folderLocation.getSite()); |
|
|
|
equipmentFolderSortEntity.setBuNo(folderLocation.getBuNo()); |
|
|
|
equipmentFolderSortEntity.setEquipmentNo(folderLocation.getEquipmentNo()); |
|
|
|
equipmentFolderSortEntity.setInspectionNo(inspectionOrderNumber); |
|
|
|
equipmentFolderSortEntity.setBatchNo(2); |
|
|
|
equipmentFolderSortEntity.setFileNo(folderLocation.getFileNo()); |
|
|
|
equipmentFolderSortEntity.setCreateDate(new Date()); |
|
|
|
@ -106,7 +105,7 @@ public class ModbusCommunicateServiceImpl implements ModbusCommunicateService { |
|
|
|
//对应的批次号为1 |
|
|
|
batchNo = 1; |
|
|
|
} else { |
|
|
|
Date createDate = (Date)resultList.get(0).get("createDate");//获取最近新增一条信息的时间 |
|
|
|
Date createDate = one.getCreateDate();//获取最近新增一条信息的时间 |
|
|
|
Date date = new Date(); |
|
|
|
if (StringUtils.isEmpty(folderLocation.getBatchDate())) { |
|
|
|
folderLocation.setBatchDate("1"); |
|
|
|
@ -114,19 +113,14 @@ public class ModbusCommunicateServiceImpl implements ModbusCommunicateService { |
|
|
|
int time = Integer.parseInt(folderLocation.getBatchDate()); |
|
|
|
Long finalTime = date.getTime() - createDate.getTime(); |
|
|
|
if (finalTime / 1000 > time) { |
|
|
|
batchNo = (Integer)resultList.get(0).get("batchNo") ; |
|
|
|
batchNo = one.getBatchNo(); |
|
|
|
//对应的不是第一次新增的情况下如果批次号不为空的情况下那么草果规定时间 批次号就加一,下次获取的时候就可以直接引用 |
|
|
|
EquipmentFolderSortEntity equipmentFolderSortEntity = new EquipmentFolderSortEntity(); |
|
|
|
equipmentFolderSortEntity.setId((int)resultList.get(0).get("id")); |
|
|
|
equipmentFolderSortEntity.setSite(folderLocation.getSite()); |
|
|
|
equipmentFolderSortEntity.setBuNo(folderLocation.getBuNo()); |
|
|
|
equipmentFolderSortEntity.setEquipmentNo(folderLocation.getEquipmentNo()); |
|
|
|
equipmentFolderSortEntity.setBatchNo(batchNo+1); |
|
|
|
equipmentFolderSortEntity.setFileNo(folderLocation.getFileNo()); |
|
|
|
equipmentFolderSortEntity.setCreateDate(new Date()); |
|
|
|
equipmentFolderSortService.updateById(equipmentFolderSortEntity); |
|
|
|
one.setBatchNo(batchNo+1); |
|
|
|
one.setFileNo(folderLocation.getFileNo()); |
|
|
|
one.setCreateDate(new Date()); |
|
|
|
equipmentFolderSortService.updateById(one); |
|
|
|
} else { |
|
|
|
batchNo = (Integer)resultList.get(0).get("batchNo")-1; |
|
|
|
batchNo = one.getBatchNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|