|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package org.springblade.desk.produce.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
@ -23,6 +24,14 @@ import org.springblade.desk.device.pojo.entity.RackSetEntity; |
|
|
|
|
import org.springblade.desk.device.service.IEquipmentService; |
|
|
|
|
import org.springblade.desk.device.service.IFeiBaSetService; |
|
|
|
|
import org.springblade.desk.device.service.IRackSetService; |
|
|
|
|
import org.springblade.desk.energy.pojo.entity.BsDosingRecEntity; |
|
|
|
|
import org.springblade.desk.energy.pojo.entity.BsEpciuPatrolInspectionEntity; |
|
|
|
|
import org.springblade.desk.energy.pojo.entity.BsSafeInspectionPointEntity; |
|
|
|
|
import org.springblade.desk.energy.pojo.entity.BsSafePatrolInspectionEntity; |
|
|
|
|
import org.springblade.desk.energy.service.IBsDosingRecService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsEpciuPatrolInspectionService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsSafeInspectionPointService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsSafePatrolInspectionService; |
|
|
|
|
import org.springblade.desk.order.pojo.entity.YieldOrder; |
|
|
|
|
import org.springblade.desk.order.pojo.entity.YieldOrderCraft; |
|
|
|
|
import org.springblade.desk.order.pojo.enums.YieldOrderEnum; |
|
|
|
|
@ -104,7 +113,10 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
|
|
|
|
|
private final IYieldOrderCraftService yieldOrderCraftService; |
|
|
|
|
|
|
|
|
|
private final IBsSafeInspectionPointService bsSafeInspectionPointService; |
|
|
|
|
private final IBsSafePatrolInspectionService inspectionService; |
|
|
|
|
private final IBsEpciuPatrolInspectionService bsEpciuPatrolInspectionService; |
|
|
|
|
private final IBsDosingRecService bsDosingRecService; |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void bindingCard(DeviceBindDTO deviceBindDTO) { |
|
|
|
|
@ -816,4 +828,69 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void saveSafetyInspection(String code, String man, String memo) { |
|
|
|
|
// 根据编码去拿未检验的数据
|
|
|
|
|
List<BsSafePatrolInspectionEntity> spiList = inspectionService.getByCode(code); |
|
|
|
|
if (spiList == null || spiList.size() == 0) { |
|
|
|
|
throw new RuntimeException("根据编码未找到需要处理数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<User> users = userClient.listByNameNolike(man); |
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(users)) { |
|
|
|
|
throw new RuntimeException("根据域账号未找到对应的处理人"); |
|
|
|
|
} |
|
|
|
|
User user = users.get(0); |
|
|
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
|
|
|
|
|
for (BsSafePatrolInspectionEntity safePatrolInspection : spiList) { |
|
|
|
|
// 不超过一个小时算正常检验
|
|
|
|
|
if (new Date().getTime() - safePatrolInspection.getLaunchTime().getTime() <= 60 * 60 * 1000) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.CHECKED.toString()); |
|
|
|
|
} else { |
|
|
|
|
// 超过一个小时但是下个任务并没有触发
|
|
|
|
|
int hours = safePatrolInspection.getLaunchTime().getHours(); |
|
|
|
|
int hours1 = new Date().getHours(); |
|
|
|
|
if (hours == 0 && hours1 < 2) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 2 && hours1 < 5) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 5 && hours1 < 7) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 7 && hours1 < 8) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else { |
|
|
|
|
// 超过一个小时但是下个任务已触发
|
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NO_CHECK.toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
safePatrolInspection.setTestTime(date); |
|
|
|
|
safePatrolInspection.setInsMan(man); |
|
|
|
|
safePatrolInspection.setParMemo(memo); |
|
|
|
|
BsSafeInspectionPointEntity safeInspectionPoint = bsSafeInspectionPointService.getByKey(safePatrolInspection.getIpId()); |
|
|
|
|
safeInspectionPoint.setLastInsCycle(date); |
|
|
|
|
inspectionService.updateOldPatrol(safePatrolInspection.getIpId(), safePatrolInspection.getLaunchTime(), user.getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void savePatrolIns(BsEpciuPatrolInspectionEntity epPatrolInspection) { |
|
|
|
|
if (Objects.isNull(epPatrolInspection.getId())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
bsEpciuPatrolInspectionService.savePatrolIns(epPatrolInspection); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void saveEpDosingRec(BsDosingRecEntity epDosingRec) { |
|
|
|
|
if (Objects.isNull(epDosingRec.getId())){ |
|
|
|
|
throw new RuntimeException("请选择加药记录"); |
|
|
|
|
} |
|
|
|
|
epDosingRec.setDosingMan(AuthUtil.getUserName()); |
|
|
|
|
epDosingRec.setDosingTime(new Date()); |
|
|
|
|
epDosingRec.setHandleResult(Long.valueOf(BsDosingRecEntity.HANDLE_RESULT_PDA)); |
|
|
|
|
bsDosingRecService.updateById(epDosingRec); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|