Merge remote-tracking branch 'origin/master'

highway
zhaoxiaolin 12 months ago
commit d551bac244

@ -136,4 +136,14 @@ public class DevicePDAController {
public AjaxResult updateMaintenanceRecords(@RequestBody EquRepairWorkOrder equRepairWorkOrder) { public AjaxResult updateMaintenanceRecords(@RequestBody EquRepairWorkOrder equRepairWorkOrder) {
return devicePDAService.updateMaintenanceRecords(equRepairWorkOrder); return devicePDAService.updateMaintenanceRecords(equRepairWorkOrder);
} }
/**
*
* @param pdadto
* @return
*/
@GetMapping("/startMaintenanceTask")
public AjaxResult startMaintenanceTask(PDADTO pdadto) {
return devicePDAService.startMaintenanceTask(pdadto);
}
} }

@ -5,6 +5,26 @@ public class PDADTO {
private String userId; private String userId;
private String planType; private String planType;
private String orderCode;
private String shutDown;
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getShutDown() {
return shutDown;
}
public void setShutDown(String shutDown) {
this.shutDown = shutDown;
}
public String getUserId() { public String getUserId() {
return userId; return userId;
} }

@ -93,4 +93,11 @@ public interface IDevicePDAService {
//待处理 //待处理
AjaxResult getMaintenancePendRecords(EquRepairWorkOrder equRepairWorkOrder); AjaxResult getMaintenancePendRecords(EquRepairWorkOrder equRepairWorkOrder);
/**
*
* @param pdadto
* @return
*/
AjaxResult startMaintenanceTask(PDADTO pdadto);
} }

@ -286,6 +286,12 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
} }
// 保养逻辑
if (equOrder.getPlanType().equals("maintenance")) {
// 设置结束时间
equOrder.setOrderEnd(DateUtils.getNowDate());
}
// 更新工单信息 // 更新工单信息
equOrderMapper.updateEquOrder(equOrder); equOrderMapper.updateEquOrder(equOrder);
return success(); return success();
@ -314,9 +320,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairOrder.setOrderRepairmanCode(SecurityUtils.getUsername()); equRepairOrder.setOrderRepairmanCode(SecurityUtils.getUsername());
equRepairOrder.setOrderTime(DateUtils.getNowDate()); equRepairOrder.setOrderTime(DateUtils.getNowDate());
equRepairOrder.setOrderStatus("待审核"); equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName"; String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
//新增文件 //新增文件
@ -378,6 +384,27 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
} }
/**
*
* @param pdadto
* @return
*/
@Override
public AjaxResult startMaintenanceTask(PDADTO pdadto) {
EquOrder order = equOrderMapper.selectEquOrderByOrderCode(pdadto.getOrderCode());
// 改为进行中
order.setOrderStatus("3");
// 设置是否停机保养
order.setShutDown(pdadto.getShutDown());
// 设置开始时间
order.setOrderStart(DateUtils.getNowDate());
// 更新数据表
order.setUpdateBy(SecurityContextHolder.getUserName());
order.setUpdateTime(DateUtils.getNowDate());
equOrderMapper.updateEquOrder(order);
return success();
}
/** /**
* *
* *

@ -226,18 +226,13 @@ public class EquOrderServiceImpl implements IEquOrderService {
int up = standard.getActualValue().compareTo(standard.getDetailUpLimit()); int up = standard.getActualValue().compareTo(standard.getDetailUpLimit());
int down = standard.getActualValue().compareTo(standard.getDetailDownLimit()); int down = standard.getActualValue().compareTo(standard.getDetailDownLimit());
standard.setDetailReach("1"); standard.setDetailReach("1");
standard.setErrorFlag("0");
if (!(up != 1 && down != -1)) { if (!(up != 1 && down != -1)) {
hasError = true; hasError = true;
standard.setErrorFlag("1");
standard.setDetailReach("0"); standard.setDetailReach("0");
} }
} else { } else {
// TODO 未达标
standard.setErrorFlag("0");
if (standard.getDetailReach().equals("0")) { if (standard.getDetailReach().equals("0")) {
hasError = true; hasError = true;
standard.setErrorFlag("1");
} }
} }
@ -310,6 +305,15 @@ public class EquOrderServiceImpl implements IEquOrderService {
} }
} }
// 保养逻辑
if (equOrder.getPlanType().equals("maintenance")) {
// 用时
if (equOrder.getOrderStart() != null) {
long diffSeconds = (equOrder.getOrderEnd().getTime() - equOrder.getOrderStart().getTime()) / 60000;
equOrder.setOrderCostTime(String.valueOf(diffSeconds));
}
}
// 更新工单信息 // 更新工单信息
equOrderMapper.updateEquOrder(equOrder); equOrderMapper.updateEquOrder(equOrder);
return success(); return success();

Loading…
Cancel
Save