点检逻辑前后端优化

highway
wws 1 year ago
parent 28e2f90ce5
commit 8637740293

@ -72,4 +72,17 @@ public interface EquRepairOrderMapper {
//查询报修人员列表 //查询报修人员列表
@DS("master") @DS("master")
List<EquEquipment> getRepairPersonList(EquEquipment equEquipment); List<EquEquipment> getRepairPersonList(EquEquipment equEquipment);
/**
* code
* @param repairCode
* @return
*/
EquRepairOrder selectEquRepairOrderByRepairCode(String repairCode);
/**
* code-
* @param repairCode
*/
void deleteEquRepairOrderByRepairCode(String repairCode);
} }

@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success; import static com.op.common.core.web.domain.AjaxResult.success;
/** /**
@ -67,7 +68,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
timeArray.add(order.getOrderEnd()); timeArray.add(order.getOrderEnd());
order.setTimeArray(timeArray); order.setTimeArray(timeArray);
order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(orderCode)); order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode()));
order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop())); order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop()));
@ -135,6 +136,21 @@ public class EquOrderServiceImpl implements IEquOrderService {
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult updateEquOrder(EquOrder equOrder) { public AjaxResult updateEquOrder(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();
@ -165,13 +181,19 @@ public class EquOrderServiceImpl implements IEquOrderService {
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");
} }
} }
@ -187,6 +209,10 @@ public class EquOrderServiceImpl implements IEquOrderService {
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;
@ -198,6 +224,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
} }
} }
// 报修信息
if (checkRepair && hasError ) { if (checkRepair && hasError ) {
// 获取故障报修流水号 // 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder(); EquRepairOrder equRepairOrder = new EquRepairOrder();
@ -229,6 +256,16 @@ public class EquOrderServiceImpl implements IEquOrderService {
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();

@ -220,6 +220,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<delete id="deleteEquRepairOrderByRepairCode">
delete from equ_repair_order where order_code = #{repairCode} and del_flag = '0'
</delete>
<select id="selectOrderCodeSerialNumber" resultType="java.lang.Integer"> <select id="selectOrderCodeSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(order_id)+1 AS serialNum SELECT COUNT(order_id)+1 AS serialNum
FROM equ_repair_order FROM equ_repair_order
@ -237,4 +241,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where del_flag = '0' where del_flag = '0'
</select> </select>
<select id="selectEquRepairOrderByRepairCode" parameterType="String" resultMap="EquRepairOrderResult">
<include refid="selectEquRepairOrderVo"/>
where order_code = #{repairCode} and del_flag = '0'
</select>
</mapper> </mapper>
Loading…
Cancel
Save