diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java b/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java index 8a2cb991..2a89399a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java @@ -31,6 +31,7 @@ public class DevicePDAController extends BaseController { /** * 获取今日巡检任务工单list + * * @param pdadto * @return */ @@ -41,6 +42,7 @@ public class DevicePDAController extends BaseController { /** * 获取巡检记录 + * * @param pdadto * @return */ @@ -51,6 +53,7 @@ public class DevicePDAController extends BaseController { /** * 获取任务详情 + * * @param equOrder * @return */ @@ -60,7 +63,8 @@ public class DevicePDAController extends BaseController { } /** - * 填写巡检记录工单 + * 填写巡检、点检、保养记录 + * * @param equOrder * @return */ @@ -70,8 +74,10 @@ public class DevicePDAController extends BaseController { } //报修 + /** * 新增手持报修记录 + * * @param equRepairOrder * @return */ @@ -81,6 +87,7 @@ public class DevicePDAController extends BaseController { } //维修 + /** * 获取维修记录(待处理) * @@ -143,6 +150,7 @@ public class DevicePDAController extends BaseController { /** * 填写维修记录 + * * @param equRepairWorkOrder * @return */ @@ -159,6 +167,7 @@ public class DevicePDAController extends BaseController { /** * 开始保养任务 + * * @param pdadto * @return */ diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOperationRecord.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOperationRecord.java new file mode 100644 index 00000000..6c435598 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOperationRecord.java @@ -0,0 +1,173 @@ +package com.op.device.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * 设备运行记录对象 equ_operation_record + * + * @author Open Platform + * @date 2023-11-27 + */ +public class EquOperationRecord extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String id; + + /** 设备编码 */ + @Excel(name = "设备编码") + private String equipmentCode; + + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + /** 类型(on:开机、off:关机) */ + @Excel(name = "类型(on:开机、off:关机)") + private String type; + + /** 维护类型(upkeep:保养、repair:维修) */ + @Excel(name = "维护类型", readConverterExp = "u=pkeep:保养、repair:维修") + private String maintenanceType; + + /** 关联记录id */ + @Excel(name = "关联记录id") + private String parentId; + + /** 工厂 */ + @Excel(name = "工厂") + private String factoryCode; + + /** 备用字段1 */ + @Excel(name = "备用字段1") + private String attr1; + + /** 备用字段2 */ + @Excel(name = "备用字段2") + private String attr2; + + /** 备用字段3 */ + @Excel(name = "备用字段3") + private String attr3; + + /** 删除标识 */ + private String delFlag; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setEquipmentCode(String equipmentCode) { + this.equipmentCode = equipmentCode; + } + + public String getEquipmentCode() { + return equipmentCode; + } + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getStartTime() { + return startTime; + } + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Date getEndTime() { + return endTime; + } + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + public void setMaintenanceType(String maintenanceType) { + this.maintenanceType = maintenanceType; + } + + public String getMaintenanceType() { + return maintenanceType; + } + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentId() { + return parentId; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("equipmentCode", getEquipmentCode()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("type", getType()) + .append("maintenanceType", getMaintenanceType()) + .append("parentId", getParentId()) + .append("factoryCode", getFactoryCode()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} \ No newline at end of file diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/vo/IEquipmentVO.java b/op-modules/op-device/src/main/java/com/op/device/domain/vo/IEquipmentVO.java index fa8fa23d..a079d7ac 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/vo/IEquipmentVO.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/vo/IEquipmentVO.java @@ -8,14 +8,22 @@ public class IEquipmentVO { private String equipmentCode; // 所在部门 private String department; - // 状态 - private String status; // 设备故障率 private Double failureRate; // 设备有效利用率 private Double utilizationRatio; // 设备维修质量 private Double rapairQuantity; + // 设备状态 + private String equipmentStatus; + + public String getEquipmentStatus() { + return equipmentStatus; + } + + public void setEquipmentStatus(String equipmentStatus) { + this.equipmentStatus = equipmentStatus; + } public Double getRapairQuantity() { return rapairQuantity; @@ -49,14 +57,6 @@ public class IEquipmentVO { this.department = department; } - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - public Double getFailureRate() { return failureRate; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationRecordMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationRecordMapper.java new file mode 100644 index 00000000..63c67380 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOperationRecordMapper.java @@ -0,0 +1,61 @@ +package com.op.device.mapper; + +import java.util.List; + +import com.op.device.domain.EquOperationRecord; + +/** + * 设备运行记录Mapper接口 + * + * @author Open Platform + * @date 2023-11-27 + */ +public interface EquOperationRecordMapper { + /** + * 查询设备运行记录 + * + * @param id 设备运行记录主键 + * @return 设备运行记录 + */ + public EquOperationRecord selectEquOperationRecordById(String id); + + /** + * 查询设备运行记录列表 + * + * @param equOperationRecord 设备运行记录 + * @return 设备运行记录集合 + */ + public List selectEquOperationRecordList(EquOperationRecord equOperationRecord); + + /** + * 新增设备运行记录 + * + * @param equOperationRecord 设备运行记录 + * @return 结果 + */ + public int insertEquOperationRecord(EquOperationRecord equOperationRecord); + + /** + * 修改设备运行记录 + * + * @param equOperationRecord 设备运行记录 + * @return 结果 + */ + public int updateEquOperationRecord(EquOperationRecord equOperationRecord); + + /** + * 删除设备运行记录 + * + * @param id 设备运行记录主键 + * @return 结果 + */ + public int deleteEquOperationRecordById(String id); + + /** + * 批量删除设备运行记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEquOperationRecordByIds(String[] ids); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java b/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java index 79af434c..cadf7322 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java @@ -16,12 +16,14 @@ public interface IDevicePDAService { /** * 获取今日巡检任务工单list + * * @return */ AjaxResult getTodayTask(PDADTO pdadto); /** * 获取巡检记录 + * * @param pdadto * @return */ @@ -29,37 +31,45 @@ public interface IDevicePDAService { /** * 获取任务详情 + * * @param equOrder * @return */ AjaxResult getInspectionOrderInfo(EquOrder equOrder); /** - * 填写巡检记录工单 + * 填写巡检、点检、保养记录 + * * @param equOrder * @return */ AjaxResult updateInspectionRecord(EquOrder equOrder); //报修 + /** * 手持新增报修记录 + * * @param equRepairOrder * @return */ public AjaxResult addRepairRecord(EquRepairOrder equRepairOrder); //维修 + /** * 手持查询维修记录 (待处理和已经维修完成) + * * @param equRepairWorkOrder * @return */ public AjaxResult getMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder); //班组 + /** * 维修班组 + * * @param equTeamUser * @return */ @@ -67,6 +77,7 @@ public interface IDevicePDAService { /** * 手持是否停机 + * * @param equRepairWorkOrder * @return */ @@ -74,6 +85,7 @@ public interface IDevicePDAService { /** * 查询设备详细信息 + * * @param equipmentId * @return */ @@ -81,6 +93,7 @@ public interface IDevicePDAService { /** * 查询维修工单 + * * @param workId * @return */ @@ -88,6 +101,7 @@ public interface IDevicePDAService { /** * 填写维修工单 + * * @param equRepairWorkOrder * @return */ @@ -101,6 +115,7 @@ public interface IDevicePDAService { /** * 开始保养任务 + * * @param pdadto * @return */ diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index acc32181..a56dec8f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -58,14 +58,15 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { // 获取所有设备信息 List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); for (IEquipmentVO equipmentVO : equipmentVOList) { - // TODO 设备状态待修改 - if (equipmentVO.getStatus().equals("1")) { - equipmentVO.setStatus("正常"); + // 设备状态 + if (equipmentVO.getEquipmentStatus().equals("1")) { + equipmentVO.setEquipmentStatus("正常"); } else { - equipmentVO.setStatus("停用"); + equipmentVO.setEquipmentStatus("停用"); } // TODO 设备故障停机率 - equipmentVO.setFailureRate(0.90); + + equipmentVO.setFailureRate(0.10); // TODO 设备有效利用率 equipmentVO.setUtilizationRatio(0.80); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 0f385a17..c744876d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -56,7 +56,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { @Autowired private EquEquipmentMapper equEquipmentMapper; @Autowired - private EquSpareApplyMapper equSpareApplyMapper; + private EquSpareApplyMapper equSpareApplyMapper; @Autowired private EquFileMapper equFileMapper; @@ -165,7 +165,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { } /** - * 填写巡检记录工单 + * 填写巡检、点检、保养记录 * * @param equOrder * @return @@ -178,11 +178,11 @@ public class DevicePDAServiceImpl implements IDevicePDAService { 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,"报修单已审核,不可修改记录!"); + if (repairOrder == null) { + return error(500, "未查询到报修单信息!"); + } else { + if (!repairOrder.getOrderStatus().equals("待审核")) { + return error(500, "报修单已审核,不可修改记录!"); } } } @@ -228,7 +228,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { hasError = true; standard.setDetailReach("0"); } - }else { + } else { // 未达标 standard.setErrorFlag("0"); if (standard.getDetailReach().equals("0")) { @@ -255,10 +255,10 @@ public class DevicePDAServiceImpl implements IDevicePDAService { boolean checkRepair = false; - if (equOrder.getRepairCode() == null){ + if (equOrder.getRepairCode() == null) { checkRepair = true; - }else { - if (equOrder.getRepairCode().isEmpty()){ + } else { + if (equOrder.getRepairCode().isEmpty()) { checkRepair = true; } } @@ -270,7 +270,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); String equipmentCode = equOrder.getEquipmentCode(); //报修单号 - equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); //在主表中存入报修单号信息 equOrder.setRepairCode(equRepairOrder.getOrderCode()); @@ -289,19 +289,19 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equRepairOrder.setOrderConnection(equTeamUserList.getPhonenumber()); equRepairOrder.setOrderRepairmanName(equTeamUserList.getNickName()); // 报修来源 - if (equOrder.getPlanType().equals("inspection")){ + if (equOrder.getPlanType().equals("inspection")) { equRepairOrder.setOrderSource("巡检"); } - if (equOrder.getPlanType().equals("spotInspection")){ + if (equOrder.getPlanType().equals("spotInspection")) { equRepairOrder.setOrderSource("点检"); } - if (equOrder.getPlanType().equals("maintenance")){ + 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_","")); + equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); } @@ -344,8 +344,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService { } //////////////////////报修 + /** - * 新增报修记录 + * 新增报修记录 * * @param equRepairOrder * @return @@ -362,7 +363,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); String equipmentCode = equRepairOrder.getEquipmentCode(); //报修单号 - equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); equRepairOrder.setCreateTime(DateUtils.getNowDate()); equRepairOrder.setCreateBy(SecurityUtils.getUsername()); equRepairOrder.setOrderRepairmanCode(SecurityUtils.getUsername()); @@ -370,7 +371,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equRepairOrder.setOrderStatus("待审核"); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); 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); //删除照片 不需要清照片 因为是新增 @@ -435,6 +436,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService { /** * 开始保养任务 + * TODO 修改设备状态 + * * @param pdadto * @return */ @@ -490,6 +493,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { return error(); } } + /** * 获取维修人员 * @@ -520,7 +524,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { //不停机 那么实际停机开始时间和实际停机结束时间都没有 //如果停机 那么实际停机时间就是传入的时间 equRepairWorkOrder.setWorkStartTime(DateUtils.getNowDate()); - if(equRepairWorkOrder.getWorkDownMachine().equals("1")){ + if (equRepairWorkOrder.getWorkDownMachine().equals("1")) { equRepairWorkOrder.setActualDownStartTime(DateUtils.getNowDate()); } equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); @@ -535,8 +539,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService { } /** - * - * * @param equipmentId * @return */ @@ -544,8 +546,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService { @DS("#header.poolName") public AjaxResult selectEquEquipmentByEquEquipmentId(Long equipmentId) { try { - EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId); - return success(list); + EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId); + return success(list); } catch (Exception e) { return error(); } @@ -561,43 +563,43 @@ public class DevicePDAServiceImpl implements IDevicePDAService { @DS("#header.poolName") public AjaxResult selectPdaRepairWorkOrderDetails(String workId) { try { - EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(workId); - //查询对应检查项信息 - EquOrder equOrder = new EquOrder(); - equOrder.setWorkCode(list.getWorkCode()); - //检查项 - List checkLists = equOrderMapper.selectCheckListByWorkCode(equOrder); - //每个检查项对应的检测标准 - for(EquOrder equOrder1 :checkLists){ - EquOrderStandard equOrderStandard = new EquOrderStandard(); - equOrderStandard.setOrderCode(equOrder1.getOrderCode()); - equOrderStandard.setParentCode(equOrder1.getId()); - List standardLists = equOrderStandardMapper.selectPdaEquOrderList(equOrderStandard); - for(EquOrderStandard standardList :standardLists){ - //每个检查标准里面的照片 - List files = equOrderStandardMapper.getBaseFileBatch(standardList.getId()); - if (!CollectionUtils.isEmpty(files)) { - standardList.setPicturePaths(files); + EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(workId); + //查询对应检查项信息 + EquOrder equOrder = new EquOrder(); + equOrder.setWorkCode(list.getWorkCode()); + //检查项 + List checkLists = equOrderMapper.selectCheckListByWorkCode(equOrder); + //每个检查项对应的检测标准 + for (EquOrder equOrder1 : checkLists) { + EquOrderStandard equOrderStandard = new EquOrderStandard(); + equOrderStandard.setOrderCode(equOrder1.getOrderCode()); + equOrderStandard.setParentCode(equOrder1.getId()); + List standardLists = equOrderStandardMapper.selectPdaEquOrderList(equOrderStandard); + for (EquOrderStandard standardList : standardLists) { + //每个检查标准里面的照片 + List files = equOrderStandardMapper.getBaseFileBatch(standardList.getId()); + if (!CollectionUtils.isEmpty(files)) { + standardList.setPicturePaths(files); + } + standardList.setDetailReach(standardList.getRepairReach()); + standardList.setActualValue(standardList.getRepairValue()); } - standardList.setDetailReach(standardList.getRepairReach()); - standardList.setActualValue(standardList.getRepairValue()); + equOrder1.setStandardList(standardLists); } - equOrder1.setStandardList(standardLists); - } - list.setDetailList(checkLists); - - //备件申领单 - EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder(); - equRepairWorkOrder.setWorkCode(list.getWorkCode()); - List applyLists = equSpareApplyMapper.selectRepairSparePartsRecord(equRepairWorkOrder); - list.setApplyList(applyLists); - - //文件 - List files = equRepairWorkOrderMapper.getBaseFileBatch(workId); - if (!CollectionUtils.isEmpty(files)) { - list.setFiles(files); - } - return success(list); + list.setDetailList(checkLists); + + //备件申领单 + EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder(); + equRepairWorkOrder.setWorkCode(list.getWorkCode()); + List applyLists = equSpareApplyMapper.selectRepairSparePartsRecord(equRepairWorkOrder); + list.setApplyList(applyLists); + + //文件 + List files = equRepairWorkOrderMapper.getBaseFileBatch(workId); + if (!CollectionUtils.isEmpty(files)) { + list.setFiles(files); + } + return success(list); } catch (Exception e) { return error(); } @@ -612,114 +614,114 @@ public class DevicePDAServiceImpl implements IDevicePDAService { @Override @DS("#header.poolName") public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) { - //判断是否停机 - EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); - if(list.getWorkDownMachine().equals("1")){ - //维修结束时间、维修真正停机时间 - equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate()); - } - equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate()); - //更新每一项点检/巡检检查项信息 - List checkLists = equRepairWorkOrder.getDetailList(); - for(EquOrder checkList:checkLists){ - checkList.setUpdateBy(SecurityUtils.getUsername()); - checkList.setUpdateTime(DateUtils.getNowDate()); - List standardLists = checkList.getStandardList(); - for(EquOrderStandard standardList :standardLists){ - //先删除每个检查项标准图片 - equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId()); - //图片 - if (StringUtils.isNotEmpty(standardList.getPicturePath())) { - String[] ids = standardList.getPicturePath().split(","); - List files = new ArrayList<>(); - BaseFileData file = null; - for (String id : ids) { - file = new BaseFileData(); - file.setFileId(IdUtils.fastSimpleUUID()); - file.setFileName(id.split("&fileName=")[1]); - file.setFileAddress(id); - file.setSourceId(standardList.getId()); - file.setCreateBy(SecurityUtils.getUsername()); - file.setCreateTime(new Date()); - //维修后 - file.setImageType("4"); - files.add(file); - } - equOrderStandardMapper.insertBaseFileBatch(files); + //判断是否停机 + EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); + if (list.getWorkDownMachine().equals("1")) { + //维修结束时间、维修真正停机时间 + equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate()); + } + equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate()); + //更新每一项点检/巡检检查项信息 + List checkLists = equRepairWorkOrder.getDetailList(); + for (EquOrder checkList : checkLists) { + checkList.setUpdateBy(SecurityUtils.getUsername()); + checkList.setUpdateTime(DateUtils.getNowDate()); + List standardLists = checkList.getStandardList(); + for (EquOrderStandard standardList : standardLists) { + //先删除每个检查项标准图片 + equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId()); + //图片 + if (StringUtils.isNotEmpty(standardList.getPicturePath())) { + String[] ids = standardList.getPicturePath().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileName(id.split("&fileName=")[1]); + file.setFileAddress(id); + file.setSourceId(standardList.getId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + //维修后 + file.setImageType("4"); + files.add(file); } - standardList.setRepairReach(standardList.getDetailReach()); - standardList.setRepairValue(standardList.getActualValue()); - standardList.setUpdateTime(DateUtils.getNowDate()); - standardList.setUpdateBy(SecurityUtils.getUsername()); - equOrderStandardMapper.updateActualValues(standardList); + equOrderStandardMapper.insertBaseFileBatch(files); } - equOrderMapper.updateEquOrder(checkList); + standardList.setRepairReach(standardList.getDetailReach()); + standardList.setRepairValue(standardList.getActualValue()); + standardList.setUpdateTime(DateUtils.getNowDate()); + standardList.setUpdateBy(SecurityUtils.getUsername()); + equOrderStandardMapper.updateActualValues(standardList); } + equOrderMapper.updateEquOrder(checkList); + } - //新建申领单 - List equSpareApplies = equRepairWorkOrder.getApplyList(); - for(EquSpareApply equSpareApply:equSpareApplies){ - //生成领料单code - String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber()); - String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10); - //十五位单号 - equSpareApply.setApplyCode("AW" + code + serialNum); - equSpareApply.setApplyId(IdUtils.fastSimpleUUID()); - //备品备件规格型号!!!!! + //新建申领单 + List equSpareApplies = equRepairWorkOrder.getApplyList(); + for (EquSpareApply equSpareApply : equSpareApplies) { + //生成领料单code + String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber()); + String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10); + //十五位单号 + equSpareApply.setApplyCode("AW" + code + serialNum); + equSpareApply.setApplyId(IdUtils.fastSimpleUUID()); + //备品备件规格型号!!!!! // equSpareApply.setSpareModel(equSpareApply.getS); - equSpareApply.setSpareCode(equSpareApply.getMaterialCode()); - equSpareApply.setSpareName(equSpareApply.getMaterialDesc()); - equSpareApply.setApplyPeople(SecurityUtils.getUsername()); - equSpareApply.setCreateBy(SecurityUtils.getUsername()); - equSpareApply.setCreateTime(DateUtils.getNowDate()); - equSpareApply.setApplyTime(DateUtils.getNowDate()); - equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode()); - equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode()); - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String key = "#header.poolName"; - equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); - equSpareApplyMapper.insertEquSpareApply(equSpareApply); - - //更新完备品申领单后,更新库存 - SparePartsLedger sparePartsLedger = new SparePartsLedger(); - sparePartsLedger.setStorageId(equSpareApply.getStorageId()); - BigDecimal applyNum = equSpareApply.getSpareQuantity(); - BigDecimal amount = equSpareApply.getAmount(); - sparePartsLedger.setAmount(amount.subtract(applyNum)); - sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger); - } + equSpareApply.setSpareCode(equSpareApply.getMaterialCode()); + equSpareApply.setSpareName(equSpareApply.getMaterialDesc()); + equSpareApply.setApplyPeople(SecurityUtils.getUsername()); + equSpareApply.setCreateBy(SecurityUtils.getUsername()); + equSpareApply.setCreateTime(DateUtils.getNowDate()); + equSpareApply.setApplyTime(DateUtils.getNowDate()); + equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode()); + equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode()); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); + equSpareApplyMapper.insertEquSpareApply(equSpareApply); + + //更新完备品申领单后,更新库存 + SparePartsLedger sparePartsLedger = new SparePartsLedger(); + sparePartsLedger.setStorageId(equSpareApply.getStorageId()); + BigDecimal applyNum = equSpareApply.getSpareQuantity(); + BigDecimal amount = equSpareApply.getAmount(); + sparePartsLedger.setAmount(amount.subtract(applyNum)); + sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger); + } - //图片 - //先删除每个维修工单对应图片 - equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId()); - if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) { - String[] ids = equRepairWorkOrder.getFileList().split(","); - List files = new ArrayList<>(); - BaseFileData file = null; - for (String id : ids) { - file = new BaseFileData(); - file.setFileId(IdUtils.fastSimpleUUID()); - file.setFileName(id.split("&fileName=")[1]); - file.setFileAddress(id); - file.setSourceId(equRepairWorkOrder.getWorkId()); - file.setCreateBy(SecurityUtils.getUsername()); - file.setCreateTime(new Date()); - //维修后 - file.setImageType("4"); - files.add(file); - } - equRepairWorkOrderMapper.insertBaseFileBatch(files); + //图片 + //先删除每个维修工单对应图片 + equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId()); + if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) { + String[] ids = equRepairWorkOrder.getFileList().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileName(id.split("&fileName=")[1]); + file.setFileAddress(id); + file.setSourceId(equRepairWorkOrder.getWorkId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + //维修后 + file.setImageType("4"); + files.add(file); } - //维修人:当前登录人 - //维修状态 - equRepairWorkOrder.setWorkStatus("1"); - //维修结束时间 - equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername()); - equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); - equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); - equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); - //需要更新设备状态????这里没做 - return success("提交成功,维修完成!"); + equRepairWorkOrderMapper.insertBaseFileBatch(files); + } + //维修人:当前登录人 + //维修状态 + equRepairWorkOrder.setWorkStatus("1"); + //维修结束时间 + equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername()); + equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); + equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); + equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); + //需要更新设备状态????这里没做 + return success("提交成功,维修完成!"); } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 72c636d1..6d07432a 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -21,10 +21,10 @@ diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOperationRecordMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOperationRecordMapper.xml new file mode 100644 index 00000000..409edfe9 --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOperationRecordMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select id, equipment_code, start_time, end_time, type, maintenance_type, parent_id, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_operation_record + + + + + + + + insert into equ_operation_record + + id, + equipment_code, + start_time, + end_time, + type, + maintenance_type, + parent_id, + factory_code, + attr1, + attr2, + attr3, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{id}, + #{equipmentCode}, + #{startTime}, + #{endTime}, + #{type}, + #{maintenanceType}, + #{parentId}, + #{factoryCode}, + #{attr1}, + #{attr2}, + #{attr3}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update equ_operation_record + + equipment_code = #{equipmentCode}, + start_time = #{startTime}, + end_time = #{endTime}, + type = #{type}, + maintenance_type = #{maintenanceType}, + parent_id = #{parentId}, + factory_code = #{factoryCode}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from equ_operation_record where id = #{id} + + + + delete from equ_operation_record where id in + + #{id} + + + \ No newline at end of file diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseEquipmentController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseEquipmentController.java index 1421808f..1ee83137 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseEquipmentController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseEquipmentController.java @@ -7,7 +7,10 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import com.op.common.core.domain.ExcelCol; +import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.poi.ExcelMapUtil; +import com.op.common.security.utils.SecurityUtils; +import com.op.system.api.domain.SysUser; import com.op.wms.domain.EquSpareEquipment; import com.op.wms.domain.WmsSparePartsLedger; import com.op.wms.service.IBaseEquipmentService; @@ -114,7 +117,6 @@ public class BaseEquipmentController extends BaseController { /** * 查询设备类型 */ -// @RequiresPermissions("wms:equipment:getEquipmentTypeList") @GetMapping("/getEquipmentTypeList") public TableDataInfo getEquipmentTypeList(BaseEquipment baseEquipment) { List list = baseEquipmentService.getEquipmentTypeList(baseEquipment); @@ -125,8 +127,8 @@ public class BaseEquipmentController extends BaseController { * 查询设备备件 */ @GetMapping("/getSparePartsList") - public TableDataInfo getSparePartsList(BaseEquipment baseEquipment) { - List list = baseEquipmentService.getSparePartsList(baseEquipment); + public TableDataInfo getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger) { + List list = baseEquipmentService.getSparePartsList(wmsSparePartsLedger); return getDataTable(list); } @@ -218,4 +220,14 @@ public class BaseEquipmentController extends BaseController { return baseEquipmentService.importFile(orderList); } + /** + * 状态修改 + */ + @RequiresPermissions("wms:equipment:edit") + @Log(title = "修改设备状态", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody BaseEquipment baseEquipment) { + return toAjax(baseEquipmentService.updateBaseEquipmentStatus(baseEquipment)); + } + } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java index 840fb317..3aab7b21 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java @@ -61,7 +61,7 @@ public class BaseEquipment extends BaseEntity { private String workshopName; /** 设备状态 */ - @Excel(name = "设备状态") + @Excel(name = "设备是否启用") private String status; /** 预留字段1 */ @@ -207,6 +207,10 @@ public class BaseEquipment extends BaseEntity { @Excel(name = "工厂号") private String factoryCode; + /** 设备状态 */ + @Excel(name = "设备状态") + private String equipmentStatus; + private String imageFileList; private String barCodeFileList; @@ -619,6 +623,14 @@ public class BaseEquipment extends BaseEntity { return factoryCode; } + //设备状态 + public void setEquipmentStatus(String equipmentStatus) { + this.equipmentStatus = equipmentStatus; + } + public String getEquipmentStatus() { + return equipmentStatus; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java index 5b7d0208..a2132e72 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseEquipmentMapper.java @@ -81,7 +81,7 @@ public interface BaseEquipmentMapper { Long getEquipmentId(String equipmentCode); //查询备件 - List getSparePartsList(BaseEquipment baseEquipment); + List getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger); //绑定备品备件 public int bindSpareParts(EquSpareEquipment equSpareEquipment); @@ -107,4 +107,7 @@ public interface BaseEquipmentMapper { //设备 BaseEquipment selectExistByEquipmentCode(String equipmentCode); + + //更新设备状态 + Integer updateBaseEquipmentStatus(BaseEquipment baseEquipment); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseEquipmentService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseEquipmentService.java index 449a8105..a8562b48 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseEquipmentService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseEquipmentService.java @@ -69,11 +69,14 @@ public interface IBaseEquipmentService { List getEquipmentTypeList(BaseEquipment baseEquipment); //查询设备备品备件 - List getSparePartsList(BaseEquipment baseEquipment); + List getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger); //查询设备备品备件右侧列表 public List getRightSparePartsList(BaseEquipment baseEquipment); //导入设备基础数据文件 AjaxResult importFile(List equipmentList); + + //更改设备状态 + int updateBaseEquipmentStatus(BaseEquipment baseEquipment); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java index 0dd6c1cf..472f40a9 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseEquipmentServiceImpl.java @@ -372,8 +372,8 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService { */ @Override @DS("#header.poolName") - public List getSparePartsList(BaseEquipment baseEquipment) { - return baseEquipmentMapper.getSparePartsList(baseEquipment); + public List getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger) { + return baseEquipmentMapper.getSparePartsList(wmsSparePartsLedger); } /** @@ -481,4 +481,19 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService { return failEquipment; } + /** + * 修改设备管理 + * + * @param baseEquipment 设备管理 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateBaseEquipmentStatus(BaseEquipment baseEquipment) { + baseEquipment.setUpdateBy(SecurityUtils.getUsername()); + baseEquipment.setUpdateTime(DateUtils.getNowDate()); + Integer list = baseEquipmentMapper.updateBaseEquipmentStatus(baseEquipment); + return list; + } + } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml index b8a74f66..97f14bfe 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml @@ -47,6 +47,7 @@ + @@ -159,7 +160,9 @@ asset_head, fixed_asset_code, department, - equipment_head + equipment_head, + factory_code, + equipment_status from base_equipment @@ -201,6 +204,7 @@ and department = #{department} and sap_asset = #{sapAsset} and factory_code = #{factoryCode} + and equipment_status = #{equipmentStatus} and del_flag ='0' @@ -254,6 +258,7 @@ sap_asset, equipment_head, factory_code, + equipment_status, #{equipmentCode}, @@ -296,6 +301,7 @@ #{sapAsset}, #{equipmentHead}, #{factoryCode}, + equipmentStatus, @@ -342,6 +348,7 @@ sap_asset = #{sapAsset}, equipment_head = #{equipmentHead}, factory_code = #{factoryCode}, + equipment_status = #{equipmentStatus}, where equipment_id = #{equipmentId} @@ -514,4 +521,12 @@ and del_flag ='0' + + update base_equipment + + status = #{status}, + + where equipment_id = #{equipmentId} + + \ No newline at end of file