点检巡检保养手持优化

highway
wws 1 year ago
parent de89a76846
commit 0e6a6286f6

@ -3,6 +3,7 @@ package com.op.device.controller;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.annotation.RequiresPermissions; import com.op.common.security.annotation.RequiresPermissions;
import com.op.device.domain.*; import com.op.device.domain.*;
import com.op.device.domain.dto.PDADTO;
import com.op.device.service.IDevicePDAService; import com.op.device.service.IDevicePDAService;
import com.op.device.service.IEquRepairOrderService; import com.op.device.service.IEquRepairOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -26,22 +27,22 @@ public class DevicePDAController {
/** /**
* list * list
* @param userId * @param pdadto
* @return * @return
*/ */
@GetMapping("/getTodayTask") @GetMapping("/getTodayTask")
public AjaxResult getTodayTask(int userId) { public AjaxResult getTodayTask(PDADTO pdadto) {
return devicePDAService.getTodayTask(userId); return devicePDAService.getTodayTask(pdadto);
} }
/** /**
* *
* @param userId * @param pdadto
* @return * @return
*/ */
@GetMapping("/getTaskRecord") @GetMapping("/getTaskRecord")
public AjaxResult getTaskRecord(int userId) { public AjaxResult getTaskRecord(PDADTO pdadto) {
return devicePDAService.getTaskRecord(userId); return devicePDAService.getTaskRecord(pdadto);
} }
/** /**

@ -84,7 +84,7 @@ public class EquPlanController extends BaseController {
* @param equEquipment * @param equEquipment
* @return * @return
*/ */
@RequiresPermissions("device:plan:list") @RequiresPermissions("device:inspectionPlan:list")
@GetMapping("/getEquList") @GetMapping("/getEquList")
public TableDataInfo getEquList(EquEquipment equEquipment) { public TableDataInfo getEquList(EquEquipment equEquipment) {
startPage(); startPage();
@ -95,7 +95,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:list") @RequiresPermissions("device:inspectionPlan:list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(EquPlan equPlan) { public TableDataInfo list(EquPlan equPlan) {
startPage(); startPage();
@ -106,7 +106,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:export") @RequiresPermissions("device:inspectionPlan:export")
@Log(title = "计划", businessType = BusinessType.EXPORT) @Log(title = "计划", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, EquPlan equPlan) { public void export(HttpServletResponse response, EquPlan equPlan) {
@ -118,7 +118,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:query") @RequiresPermissions("device:inspectionPlan:query")
@GetMapping(value = "/{planId}") @GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId) { public AjaxResult getInfo(@PathVariable("planId") String planId) {
return success(equPlanService.selectEquPlanByPlanId(planId)); return success(equPlanService.selectEquPlanByPlanId(planId));
@ -127,7 +127,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:add") @RequiresPermissions("device:inspectionPlan:add")
@Log(title = "计划", businessType = BusinessType.INSERT) @Log(title = "计划", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody EquPlan equPlan) { public AjaxResult add(@RequestBody EquPlan equPlan) {
@ -137,7 +137,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:edit") @RequiresPermissions("device:inspectionPlan:edit")
@Log(title = "计划", businessType = BusinessType.UPDATE) @Log(title = "计划", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody EquPlan equPlan) { public AjaxResult edit(@RequestBody EquPlan equPlan) {
@ -147,7 +147,7 @@ public class EquPlanController extends BaseController {
/** /**
* *
*/ */
@RequiresPermissions("device:plan:remove") @RequiresPermissions("device:inspectionPlan:remove")
@Log(title = "计划", businessType = BusinessType.DELETE) @Log(title = "计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}") @DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds) { public AjaxResult remove(@PathVariable String[] planIds) {

@ -0,0 +1,23 @@
package com.op.device.domain.dto;
// 手持传参dto
public class PDADTO {
private String userId;
private String planType;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
}

@ -4,6 +4,8 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.device.domain.EquOrder; import com.op.device.domain.EquOrder;
import com.op.device.domain.dto.PDADTO;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -74,18 +76,13 @@ public interface EquOrderMapper {
*/ */
String selectCenterNameByCenterCode(String planWorkshop); String selectCenterNameByCenterCode(String planWorkshop);
/**
* list
* @return
*/
List<EquOrder> selectTodayTask(int userId);
/** /**
* *
* @param userId * @param pdadto
* @return * @return
*/ */
List<EquOrder> selectTaskRecord(int userId); List<EquOrder> selectTaskRecord(PDADTO pdadto);
/** /**
* id * id
@ -107,4 +104,11 @@ public interface EquOrderMapper {
*/ */
@DS("#master") @DS("#master")
String changeLoopType(String planLoopType); String changeLoopType(String planLoopType);
/**
* list
* @param pdadto
* @return
*/
List<EquOrder> selectTodayTask(PDADTO pdadto);
} }

@ -2,6 +2,7 @@ package com.op.device.service;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.*; import com.op.device.domain.*;
import com.op.device.domain.dto.PDADTO;
/** /**
* PDAService * PDAService
@ -15,14 +16,14 @@ public interface IDevicePDAService {
* list * list
* @return * @return
*/ */
AjaxResult getTodayTask(int userId); AjaxResult getTodayTask(PDADTO pdadto);
/** /**
* *
* @param userId * @param pdadto
* @return * @return
*/ */
AjaxResult getTaskRecord(int userId); AjaxResult getTaskRecord(PDADTO pdadto);
/** /**
* *

@ -9,6 +9,7 @@ import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils; import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.*; import com.op.device.domain.*;
import com.op.device.domain.dto.PDADTO;
import com.op.device.mapper.*; import com.op.device.mapper.*;
import com.op.device.service.IDevicePDAService; import com.op.device.service.IDevicePDAService;
import com.op.system.api.domain.SysUser; import com.op.system.api.domain.SysUser;
@ -70,21 +71,21 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult getTodayTask(int userId) { public AjaxResult getTodayTask(PDADTO pdadto) {
List<EquOrder> orderList = equOrderMapper.selectTodayTask(userId); List<EquOrder> orderList = equOrderMapper.selectTodayTask(pdadto);
return success(orderList); return success(orderList);
} }
/** /**
* *
* *
* @param userId * @param pdadto
* @return * @return
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult getTaskRecord(int userId) { public AjaxResult getTaskRecord(PDADTO pdadto) {
List<EquOrder> orderList = equOrderMapper.selectTaskRecord(userId); List<EquOrder> orderList = equOrderMapper.selectTaskRecord(pdadto);
return success(orderList); return success(orderList);
} }
@ -150,6 +151,20 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult updateInspectionRecord(EquOrder equOrder) { 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; boolean hasError = false;
EquOrderEqu equ = equOrder.getEqu(); EquOrderEqu equ = equOrder.getEqu();
@ -180,13 +195,19 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
if (standard.getStandardType().equals("quantify")) { if (standard.getStandardType().equals("quantify")) {
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.setErrorFlag("0");
if (!(up != 1 && down != -1)) { if (!(up != 1 && down != -1)) {
hasError = true; hasError = true;
standard.setErrorFlag("1");
standard.setDetailReach("0");
} }
}else { }else {
// TODO 未达标 // TODO 未达标
if (standard.getDetailReach().equals("1")) { standard.setErrorFlag("0");
if (standard.getDetailReach().equals("0")) {
hasError = true; hasError = true;
standard.setErrorFlag("1");
} }
} }
@ -202,6 +223,10 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName()); equOrder.setPlanPerson(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; boolean checkRepair = false;
@ -213,7 +238,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
} }
if (checkRepair && hasError) { // 报修信息
if (checkRepair && hasError ) {
// 获取故障报修流水号 // 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder(); EquRepairOrder equRepairOrder = new EquRepairOrder();
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
@ -227,7 +253,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID()); equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());
equRepairOrder.setCreateTime(DateUtils.getNowDate()); equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername()); equRepairOrder.setCreateBy(SecurityUtils.getUsername());
equRepairOrder.setOrderStatus("待审核");
// 报修来源 // 报修来源
if (equOrder.getPlanType().equals("inspection")){ if (equOrder.getPlanType().equals("inspection")){
equRepairOrder.setOrderSource("巡检"); equRepairOrder.setOrderSource("巡检");
@ -238,12 +263,23 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
if (equOrder.getPlanType().equals("maintenance")){ if (equOrder.getPlanType().equals("maintenance")){
equRepairOrder.setOrderSource("保养"); equRepairOrder.setOrderSource("保养");
} }
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);
} }
if (!hasError) {
// TODO 删除报修单
if (equOrder.getRepairCode() != null) {
if (!equOrder.getRepairCode().isEmpty()) {
equRepairOrderMapper.deleteEquRepairOrderByRepairCode(equOrder.getRepairCode());
equOrder.setRepairCode("");
}
}
}
// 更新工单信息 // 更新工单信息
equOrderMapper.updateEquOrder(equOrder); equOrderMapper.updateEquOrder(equOrder);
return success(); return success();

@ -98,20 +98,6 @@
select top 1 workshop_name from base_equipment where del_flag = '0' and workshop_code = #{planWorkshop} select top 1 workshop_name from base_equipment where del_flag = '0' and workshop_code = #{planWorkshop}
</select> </select>
<select id="selectTodayTask" resultType="java.lang.Integer" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where CONVERT(date,GETDATE()) > plan_loop_start and plan_type = 'inspection' and del_flag = '0' and order_status != '1' and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_id = #{userId} GROUP BY order_code
)
</select>
<select id="selectTaskRecord" resultType="java.lang.Integer" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where del_flag = '0' and order_status = '1' and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_id = '12' GROUP BY order_code
)
</select>
<select id="selectEquOrderByOrderId" parameterType="String" resultMap="EquOrderResult"> <select id="selectEquOrderByOrderId" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/> <include refid="selectEquOrderVo"/>
where order_id = #{orderId} and del_flag = '0' where order_id = #{orderId} and del_flag = '0'
@ -127,6 +113,20 @@
select dict_label from sys_dict_data where dict_value = #{planLoopType} select dict_label from sys_dict_data where dict_value = #{planLoopType}
</select> </select>
<select id="selectTodayTask" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where CONVERT(date,GETDATE()) > plan_loop_start and plan_type = #{planType} and del_flag = '0' and order_status != '1' and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_id = #{userId} GROUP BY order_code
)
</select>
<select id="selectTaskRecord" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where del_flag = '0' and order_status = '1' and plan_type = #{planType} and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_id = #{userId} GROUP BY order_code
)
</select>
<insert id="insertEquOrder" parameterType="EquOrder"> <insert id="insertEquOrder" parameterType="EquOrder">
insert into equ_order insert into equ_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save