|
|
|
@ -4,9 +4,12 @@ import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -80,6 +83,8 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquRepairOrderMapper equRepairOrderMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询维修工单
|
|
|
|
|
*
|
|
|
|
@ -788,6 +793,45 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService
|
|
|
|
|
return success(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult updateDeviceRunTimeORRate(Map map) {
|
|
|
|
|
//查询产线绑定的设备情况
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<Map> mapList = equEquipmentMapper.selectAuxiliaryEquipmentList(map);
|
|
|
|
|
EquOperation equOperation=new EquOperation();
|
|
|
|
|
for (Map mas:mapList){
|
|
|
|
|
System.out.println();
|
|
|
|
|
//查询设备有没有生成记录
|
|
|
|
|
String equipmentCode = mas.get("equipmentCode").toString();
|
|
|
|
|
String Time = map.get("productDate").toString();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
LocalDate localDate = LocalDate.parse(Time, formatter);
|
|
|
|
|
equOperation.setCreateTime(java.sql.Date.valueOf(localDate));
|
|
|
|
|
equOperation.setEquipmentCode(equipmentCode);
|
|
|
|
|
EquOperation operation = equOperationMapper.selectEquOperationByCode(equOperation);
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
|
if (operation!=null){
|
|
|
|
|
//更新运行时间以及实际运行时间、故障率
|
|
|
|
|
equOperation.setId(operation.getId());
|
|
|
|
|
equOperation.setOperationTime(map.get("RunTime").toString());
|
|
|
|
|
//实际运行时间 = 实际运行时间 - 故障时间
|
|
|
|
|
double result = Double.parseDouble(map.get("RunTime").toString()) - Double.parseDouble(operation.getFaultTime());
|
|
|
|
|
equOperation.setActualOperationTime(String.valueOf(df.format(result)));
|
|
|
|
|
//故障率计算(故障时间/运行时间)
|
|
|
|
|
BigDecimal faultTimeBD = new BigDecimal(operation.getFaultTime());
|
|
|
|
|
BigDecimal operationTimeBD = new BigDecimal(equOperation.getOperationTime());//运行时间
|
|
|
|
|
equOperation.setFailureRate(faultTimeBD.multiply(new BigDecimal(100)).divide(operationTimeBD, 2, RoundingMode.HALF_UP).toString() + "%");
|
|
|
|
|
equOperationMapper.updateEquOperation(equOperation);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
return error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
// public boolean checkWorkCodeUnique(EquRepairWorkOrder equRepairWorkOrder) {
|
|
|
|
|