|
|
@ -22,8 +22,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.op.common.core.web.domain.AjaxResult.error;
|
|
|
|
import static com.op.common.core.web.domain.AjaxResult.error;
|
|
|
@ -81,6 +86,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private EquFaultReasonMapper equFaultReasonMapper;
|
|
|
|
private EquFaultReasonMapper equFaultReasonMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private EquOperationMapper equOperationMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取今日任务工单list-状态不为已完成
|
|
|
|
* 获取今日任务工单list-状态不为已完成
|
|
|
@ -627,14 +635,14 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询设备
|
|
|
|
* 查询设备
|
|
|
|
* @param equipmentId
|
|
|
|
* @param equipmentCode
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@DS("#header.poolName")
|
|
|
|
@DS("#header.poolName")
|
|
|
|
public AjaxResult selectEquEquipmentByEquEquipmentId(Long equipmentId) {
|
|
|
|
public AjaxResult selectEquEquipmentByEquEquipmentCode(String equipmentCode) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId);
|
|
|
|
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentCode(equipmentCode);
|
|
|
|
return success(list);
|
|
|
|
return success(list);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
return error();
|
|
|
|
return error();
|
|
|
@ -705,7 +713,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
@DS("#header.poolName")
|
|
|
|
@DS("#header.poolName")
|
|
|
|
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
|
|
|
|
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
//判断是否停机
|
|
|
|
//1.判断是否停机
|
|
|
|
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
|
|
|
|
if (list.getWorkDownMachine().equals("1")) {
|
|
|
|
if (list.getWorkDownMachine().equals("1")) {
|
|
|
|
//维修真正停机时间
|
|
|
|
//维修真正停机时间
|
|
|
@ -714,10 +722,55 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
//维修工单结束时间
|
|
|
|
//维修工单结束时间
|
|
|
|
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
|
|
|
|
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
|
|
|
|
|
|
|
|
|
|
|
|
//计算维修工单用时
|
|
|
|
//2.计算维修工单用时
|
|
|
|
//获取工单的开始时间
|
|
|
|
if(list.getWorkStartTime()!= null && equRepairWorkOrder.getWorkEndTime()!= null){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.1计算日期差值
|
|
|
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault();
|
|
|
|
|
|
|
|
LocalDateTime start = LocalDateTime.ofInstant(list.getWorkStartTime().toInstant(), zoneId);
|
|
|
|
|
|
|
|
LocalDateTime end = LocalDateTime.ofInstant(equRepairWorkOrder.getWorkEndTime().toInstant(), zoneId);
|
|
|
|
|
|
|
|
LocalDateTime tempDateTime = LocalDateTime.from(start);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// long years = tempDateTime.until(end, ChronoUnit.YEARS);
|
|
|
|
|
|
|
|
// tempDateTime = tempDateTime.plusYears(years);
|
|
|
|
|
|
|
|
// long months = tempDateTime.until(end, ChronoUnit.MONTHS);
|
|
|
|
|
|
|
|
// tempDateTime = tempDateTime.plusMonths(months);
|
|
|
|
|
|
|
|
// long days = tempDateTime.until(end, ChronoUnit.DAYS);
|
|
|
|
|
|
|
|
// tempDateTime = tempDateTime.plusDays(days);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double hours = tempDateTime.until(end, ChronoUnit.HOURS);
|
|
|
|
|
|
|
|
// tempDateTime = tempDateTime.plusHours(hours);
|
|
|
|
|
|
|
|
double minutes = ((tempDateTime.until(end, ChronoUnit.MINUTES)*1.0)%60)/60;
|
|
|
|
|
|
|
|
// tempDateTime = tempDateTime.plusMinutes(minutes);
|
|
|
|
|
|
|
|
double seconds = ((tempDateTime.until(end, ChronoUnit.SECONDS)*1.0)%3600)/3600;
|
|
|
|
|
|
|
|
double hour = BigDecimal.valueOf(hours + minutes + seconds).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.2查询完好率报表
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
String time = sdf.format(equRepairWorkOrder.getWorkEndTime());
|
|
|
|
|
|
|
|
EquOperation equOperation = equOperationMapper.selectEquipmentIntegrityRate(time,equRepairWorkOrder.getEquipmentCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.3修改完好率报表
|
|
|
|
|
|
|
|
if(equOperation != null){
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
|
|
|
|
//实际运行时间 = 实际运行时间 - 故障时间
|
|
|
|
|
|
|
|
double result = Double.parseDouble(equOperation.getActualOperationTime()) - hour;
|
|
|
|
|
|
|
|
//故障时间 = 原来的故障时间 + 这次的故障时间
|
|
|
|
|
|
|
|
double faultTime = Double.parseDouble(equOperation.getFaultTime()) + hour;
|
|
|
|
|
|
|
|
equOperation.setActualOperationTime(String.valueOf(df.format(result)));//实际运行时间
|
|
|
|
|
|
|
|
equOperation.setFaultTime(String.valueOf(faultTime));//故障时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal faultTimeBD = new BigDecimal(faultTime);// 故障时间
|
|
|
|
|
|
|
|
BigDecimal operationTimeBD = new BigDecimal(equOperation.getOperationTime());// 运行时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
equOperation.setFailureRate(faultTimeBD.multiply(new BigDecimal(100)).divide(operationTimeBD,2, RoundingMode.HALF_UP).toString()+"%");
|
|
|
|
|
|
|
|
equOperation.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
|
|
|
equOperation.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
|
|
|
equOperationMapper.updateEquOperation(equOperation);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////更新每一项点检/巡检检查项信息
|
|
|
|
////3.更新每一项点检/巡检检查项信息
|
|
|
|
//判空
|
|
|
|
//判空
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getDetailList())){
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getDetailList())){
|
|
|
|
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
|
|
|
|
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
|
|
|
@ -758,7 +811,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////新建申领单
|
|
|
|
////4.新建申领单
|
|
|
|
//判空
|
|
|
|
//判空
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){
|
|
|
|
if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){
|
|
|
|
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
|
|
|
|
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
|
|
|
@ -803,7 +856,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////增加多个维修后照片
|
|
|
|
////5.增加多个维修后照片
|
|
|
|
//先删除每个维修工单对应图片
|
|
|
|
//先删除每个维修工单对应图片
|
|
|
|
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
|
|
|
|
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
|
|
|
|
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
|
|
|
@ -825,7 +878,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
equRepairWorkOrderMapper.insertBaseFileBatch(files);
|
|
|
|
equRepairWorkOrderMapper.insertBaseFileBatch(files);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////更新维修工单
|
|
|
|
////6.更新维修工单
|
|
|
|
//维修状态
|
|
|
|
//维修状态
|
|
|
|
equRepairWorkOrder.setWorkStatus("1");
|
|
|
|
equRepairWorkOrder.setWorkStatus("1");
|
|
|
|
//维修人
|
|
|
|
//维修人
|
|
|
@ -843,7 +896,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
// BigDecimal orderCost = BigDecimal.valueOf(Double.valueOf(equRepairWorkOrder.getWorkCost()));
|
|
|
|
// BigDecimal orderCost = BigDecimal.valueOf(Double.valueOf(equRepairWorkOrder.getWorkCost()));
|
|
|
|
// equRepairWorkOrder.setWorkCost(String.valueOf(sparePartsCost.add(orderCost)));
|
|
|
|
// equRepairWorkOrder.setWorkCost(String.valueOf(sparePartsCost.add(orderCost)));
|
|
|
|
|
|
|
|
|
|
|
|
//修改设备状态 由维修中改为正常运行
|
|
|
|
//7.修改设备状态 由维修中改为正常运行
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
equEquipment.setEquipmentCode(example.getEquipmentCode());
|
|
|
|
equEquipment.setEquipmentCode(example.getEquipmentCode());
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|