|
|
|
@ -9,6 +9,7 @@ import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.device.domain.*;
|
|
|
|
|
import com.op.device.domain.dto.PDADTO;
|
|
|
|
|
import com.op.device.mapper.*;
|
|
|
|
|
import com.op.device.service.IDevicePDAService;
|
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
@ -70,21 +71,21 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult getTodayTask(int userId) {
|
|
|
|
|
List<EquOrder> orderList = equOrderMapper.selectTodayTask(userId);
|
|
|
|
|
public AjaxResult getTodayTask(PDADTO pdadto) {
|
|
|
|
|
List<EquOrder> orderList = equOrderMapper.selectTodayTask(pdadto);
|
|
|
|
|
return success(orderList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取巡检记录
|
|
|
|
|
*
|
|
|
|
|
* @param userId
|
|
|
|
|
* @param pdadto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult getTaskRecord(int userId) {
|
|
|
|
|
List<EquOrder> orderList = equOrderMapper.selectTaskRecord(userId);
|
|
|
|
|
public AjaxResult getTaskRecord(PDADTO pdadto) {
|
|
|
|
|
List<EquOrder> orderList = equOrderMapper.selectTaskRecord(pdadto);
|
|
|
|
|
return success(orderList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -150,6 +151,20 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult updateInspectionRecord(EquOrder equOrder) {
|
|
|
|
|
|
|
|
|
|
// 检验如果审核通过则不允许修改记录
|
|
|
|
|
if (equOrder.getRepairCode() != null) {
|
|
|
|
|
if (!equOrder.getRepairCode().isEmpty()) {
|
|
|
|
|
EquRepairOrder repairOrder = equRepairOrderMapper.selectEquRepairOrderByRepairCode(equOrder.getRepairCode());
|
|
|
|
|
if (repairOrder==null) {
|
|
|
|
|
return error(500,"未查询到报修单信息!");
|
|
|
|
|
}else {
|
|
|
|
|
if (!repairOrder.getOrderStatus().equals("待审核")){
|
|
|
|
|
return error(500,"报修单已审核,不可修改记录!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean hasError = false;
|
|
|
|
|
|
|
|
|
|
EquOrderEqu equ = equOrder.getEqu();
|
|
|
|
@ -180,13 +195,19 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
if (standard.getStandardType().equals("quantify")) {
|
|
|
|
|
int up = standard.getActualValue().compareTo(standard.getDetailUpLimit());
|
|
|
|
|
int down = standard.getActualValue().compareTo(standard.getDetailDownLimit());
|
|
|
|
|
standard.setDetailReach("1");
|
|
|
|
|
standard.setErrorFlag("0");
|
|
|
|
|
if (!(up != 1 && down != -1)) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
standard.setErrorFlag("1");
|
|
|
|
|
standard.setDetailReach("0");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
// TODO 未达标
|
|
|
|
|
if (standard.getDetailReach().equals("1")) {
|
|
|
|
|
standard.setErrorFlag("0");
|
|
|
|
|
if (standard.getDetailReach().equals("0")) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
standard.setErrorFlag("1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -202,6 +223,10 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
|
|
|
|
|
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
|
|
|
|
|
if (equOrder.getTimeArray().size() > 0) {
|
|
|
|
|
equOrder.setOrderStart(equOrder.getTimeArray().get(0));
|
|
|
|
|
equOrder.setOrderEnd(equOrder.getTimeArray().get(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean checkRepair = false;
|
|
|
|
|
|
|
|
|
@ -213,7 +238,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (checkRepair && hasError) {
|
|
|
|
|
// 报修信息
|
|
|
|
|
if (checkRepair && hasError ) {
|
|
|
|
|
// 获取故障报修流水号
|
|
|
|
|
EquRepairOrder equRepairOrder = new EquRepairOrder();
|
|
|
|
|
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
|
|
|
|
@ -227,7 +253,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());
|
|
|
|
|
equRepairOrder.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
equRepairOrder.setOrderStatus("待审核");
|
|
|
|
|
// 报修来源
|
|
|
|
|
if (equOrder.getPlanType().equals("inspection")){
|
|
|
|
|
equRepairOrder.setOrderSource("巡检");
|
|
|
|
@ -238,12 +263,23 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
|
|
|
|
|
if (equOrder.getPlanType().equals("maintenance")){
|
|
|
|
|
equRepairOrder.setOrderSource("保养");
|
|
|
|
|
}
|
|
|
|
|
equRepairOrder.setOrderStatus("待审核");
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!hasError) {
|
|
|
|
|
// TODO 删除报修单
|
|
|
|
|
if (equOrder.getRepairCode() != null) {
|
|
|
|
|
if (!equOrder.getRepairCode().isEmpty()) {
|
|
|
|
|
equRepairOrderMapper.deleteEquRepairOrderByRepairCode(equOrder.getRepairCode());
|
|
|
|
|
equOrder.setRepairCode("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新工单信息
|
|
|
|
|
equOrderMapper.updateEquOrder(equOrder);
|
|
|
|
|
return success();
|
|
|
|
|