From 1d5b107814648bd9708bae3ccdbf7f816bb19ce8 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Thu, 2 Nov 2023 16:36:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E4=BF=AE+=E7=BB=B4=E4=BF=AE+=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=8F=AD=E7=BB=84+=E5=A7=94=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EquRepairWorkOrderController.java | 6 +- .../device/controller/EquTeamController.java | 8 + .../op/device/domain/EquOutsourceWork.java | 111 ++++++++--- .../com/op/device/domain/EquRepairOrder.java | 11 ++ .../op/device/domain/EquRepairWorkOrder.java | 178 ++++++++++++++---- .../com/op/device/mapper/EquTeamMapper.java | 3 + .../service/IEquOutsourceWorkService.java | 1 + .../service/IEquRepairWorkOrderService.java | 3 + .../op/device/service/IEquTeamService.java | 3 + .../impl/EquOutsourceWorkServiceImpl.java | 22 +-- .../impl/EquRepairOrderServiceImpl.java | 19 ++ .../impl/EquRepairWorkOrderServiceImpl.java | 67 ++++++- .../service/impl/EquTeamServiceImpl.java | 9 + .../mapper/device/EquOutsourceWorkMapper.xml | 63 +++++-- .../mapper/device/EquRepairOrderMapper.xml | 8 +- .../device/EquRepairWorkOrderMapper.xml | 99 +++++++--- .../resources/mapper/device/EquTeamMapper.xml | 9 +- 17 files changed, 497 insertions(+), 123 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java index 221884bf..c5fffdc7 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java @@ -107,8 +107,8 @@ public class EquRepairWorkOrderController extends BaseController { */ @RequiresPermissions("device:repairOrder:apply") @PostMapping("/apply") - public AjaxResult apply(@RequestBody EquOutsourceWork equOutsourceWork) { - return toAjax(equOutsourceWorkService.insertEquOutsourceWork(equOutsourceWork)); + public AjaxResult apply(@RequestBody EquRepairWorkOrder equRepairWorkOrder) { + return toAjax(equRepairWorkOrderService.applyEquOutsourceWork(equRepairWorkOrder)); } /** @@ -117,7 +117,7 @@ public class EquRepairWorkOrderController extends BaseController { @RequiresPermissions("device:repairOrder:write") @PostMapping("/write") public AjaxResult write(@RequestBody EquRepairWorkOrder equRepairWorkOrder) { - equRepairWorkOrder.setWorkCost(equRepairWorkOrder.getWorkCost()+"元"); + equRepairWorkOrder.setWorkCost(equRepairWorkOrder.getWorkCost()); return toAjax(equRepairWorkOrderService.updateEquRepairWorkOrder(equRepairWorkOrder)); } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java index a1d4645d..a5934298 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java @@ -94,4 +94,12 @@ public class EquTeamController extends BaseController { public AjaxResult remove(@PathVariable String[] ids) { return toAjax(equTeamService.deleteEquTeamByIds(ids)); } + + //查询设备维修班组 + @GetMapping("/getMaintenanceTeamList") + public TableDataInfo getMaintenanceTeamList(EquTeam equTeam) { + startPage(); + List list = equTeamService.getMaintenanceTeamList(equTeam); + return getDataTable(list); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOutsourceWork.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOutsourceWork.java index 7af3b8ca..a4903fcb 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOutsourceWork.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOutsourceWork.java @@ -25,8 +25,12 @@ public class EquOutsourceWork extends BaseEntity { @Excel(name = "报修编码") private String orderCode; - /** 维修人员 */ - @Excel(name = "维修人员") + /** 维修编码 */ + @Excel(name = "维修编码") + private String repairCode; + + /** 委外维修人员 */ + @Excel(name = "委外维修人员") private String workPerson; /** 委外单位 */ @@ -41,16 +45,12 @@ public class EquOutsourceWork extends BaseEntity { @Excel(name = "原因") private String workReason; - /** 委外原因 */ - @Excel(name = "委外原因") - private String outSourceReason; - /** 委外类型 */ @Excel(name = "委外类型") private String workType; - /** 管理单号 */ - @Excel(name = "管理单号") + /** 设备编码 */ + @Excel(name = "设备编码") private String equipmentCode; /** 委外费用 */ @@ -80,10 +80,30 @@ public class EquOutsourceWork extends BaseEntity { @Excel(name = "工厂编码") private String factoryCode; + // 设备 + /** 设备名称 */ + @Excel(name = "设备名称") + private String equipmentName; + + /** 规格型号 */ + @Excel(name = "规格型号") + private String equipmentSpec; + + /** 设备类型名称 */ + @Excel(name = "设备类型名称") + private String equipmentTypeName; + + /** 设备位置 */ + @Excel(name = "设备位置") + private String equipmentLocation; + + /** 部门 */ + @Excel(name = "部门") + private String department; + public void setWorkId(String workId) { this.workId = workId; } - public String getWorkId() { return workId; } @@ -91,7 +111,6 @@ public class EquOutsourceWork extends BaseEntity { public void setOrderCode(String orderCode) { this.orderCode = orderCode; } - public String getOrderCode() { return orderCode; } @@ -99,107 +118,142 @@ public class EquOutsourceWork extends BaseEntity { public void setWorkCode(String workCode) { this.workCode = workCode; } - public String getWorkCode() { return workCode; } + + public void setRepairCode(String repairCode) { + this.repairCode = repairCode; + } + public String getRepairCode() { + return repairCode; + } + public void setWorkPerson(String workPerson) { this.workPerson = workPerson; } - public String getWorkPerson() { return workPerson; } + public void setWorkOutsourcingUnit(String workOutsourcingUnit) { this.workOutsourcingUnit = workOutsourcingUnit; } - public String getWorkOutsourcingUnit() { return workOutsourcingUnit; } + public void setWorkConnection(String workConnection) { this.workConnection = workConnection; } - public String getWorkConnection() { return workConnection; } + public void setWorkReason(String workReason) { this.workReason = workReason; } - public String getWorkReason() { return workReason; } + public void setWorkType(String workType) { this.workType = workType; } - public String getWorkType() { return workType; } + public void setEquipmentCode(String equipmentCode) { this.equipmentCode = equipmentCode; } - public String getEquipmentCode() { return equipmentCode; } + public void setWorkCost(String workCost) { this.workCost = workCost; } - public String getWorkCost() { return workCost; } + public void setWorkCostTime(String workCostTime) { this.workCostTime = workCostTime; } - public String getWorkCostTime() { return workCostTime; } + 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; } + public void setFactoryCode(String factoryCode) { this.factoryCode = factoryCode; } - public String getFactoryCode() { return factoryCode; } - public void setOutSourceReason(String outSourceReason) { - this.outSourceReason = outSourceReason; + //设备 + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentSpec(String equipmentSpec) { + this.equipmentSpec = equipmentSpec; + } + public String getEquipmentSpec() { + return equipmentSpec; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + this.equipmentTypeName = equipmentTypeName; + } + public String getEquipmentTypeName() { + return equipmentTypeName; + } + + public void setEquipmentLocation(String equipmentLocation) { + this.equipmentLocation = equipmentLocation; + } + public String getEquipmentLocation() { + return equipmentLocation; + } + + public void setDepartment(String department) { + this.department = department; } - public String getOutSourceReason() { - return outSourceReason; + public String getDepartment() { + return department; } @Override @@ -208,6 +262,7 @@ public class EquOutsourceWork extends BaseEntity { .append("workId", getWorkId()) .append("orderCode", getWorkCode()) .append("workCode", getWorkCode()) + .append("repairCode", getRepairCode()) .append("workPerson", getWorkPerson()) .append("workOutsourcingUnit", getWorkOutsourcingUnit()) .append("workConnection", getWorkConnection()) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java index dfd01fd7..c0a3b409 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java @@ -84,6 +84,10 @@ public class EquRepairOrder extends BaseEntity { /** 删除标志 */ private String delFlag; + /** 工厂编码 */ + @Excel(name = "工厂编码") + private String factoryCode; + //设备 /** 设备类型名称 */ @Excel(name = "设备类型名称") @@ -410,6 +414,13 @@ public class EquRepairOrder extends BaseEntity { return workDownMachine; } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + public String getFactoryCode() { + return factoryCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java index 709ca98b..28068b08 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java @@ -1,6 +1,8 @@ package com.op.device.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -73,10 +75,6 @@ public class EquRepairWorkOrder extends BaseEntity { @Excel(name = "原因分析") private String workReason; - /** 委外原因 */ - @Excel(name = "委外原因") - private String outSourceReason; - /** 故障描述 */ @Excel(name = "故障描述") private String workFaultDesc; @@ -131,7 +129,6 @@ public class EquRepairWorkOrder extends BaseEntity { @Excel(name = "维修结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private String workEndTime; - // 设备 /** 设备名称 */ @Excel(name = "设备名称") @@ -153,7 +150,6 @@ public class EquRepairWorkOrder extends BaseEntity { @Excel(name = "部门") private String department; - //报修 /** 故障描述 */ @Excel(name = "故障描述") @@ -181,6 +177,35 @@ public class EquRepairWorkOrder extends BaseEntity { @Excel(name = "联系方式") private String orderConnection; + //班组 + /** 班组名称 */ + @Excel(name = "班组名称") + private String teamName; + + /** 班组人员 */ + @Excel(name = "班组人员") + private String teamPerson; + + //时间列表 虚拟字段 + private List workPlanTimeArray; + private List workPlanDownTimeArray; + //计划开始时间、结束时间 + private String workPlanTimeStart; + private String workPlanTimeEnd; + //计划停机开始时间、结束时间 + private String workPlanDownTimeStart; + private String workPlanDownTimeEnd; + + //委外虚拟字段 + /** 委外维修人员 */ + private String outSourcePerson; + /** 委外维修原因 */ + private String outSourceReason; + /** 委外单位 */ + private String workOutsourcingUnit; + /** 联系方式 */ + private String workConnection; + //报修 public void setOrderDesc(String orderDesc) { @@ -263,14 +288,13 @@ public class EquRepairWorkOrder extends BaseEntity { public void setWorkId(String workId) { this.workId = workId; } - public String getWorkId() { return workId; } + public void setOrderId(String orderId) { this.orderId = orderId; } - public String getOrderId() { return orderId; } @@ -278,7 +302,6 @@ public class EquRepairWorkOrder extends BaseEntity { public void setWorkCode(String workCode) { this.workCode = workCode; } - public String getWorkCode() { return workCode; } @@ -286,155 +309,146 @@ public class EquRepairWorkOrder extends BaseEntity { public void setOrderCode(String orderCode) { this.orderCode = orderCode; } - public String getOrderCode() { return orderCode; } + public void setWorkHandle(String workHandle) { this.workHandle = workHandle; } - public String getWorkHandle() { return workHandle; } + public void setWorkPlanTime(Date workPlanTime) { this.workPlanTime = workPlanTime; } - public Date getWorkPlanTime() { return workPlanTime; } + public void setWorkPlanDownTime(Date workPlanDownTime) { this.workPlanDownTime = workPlanDownTime; } - public Date getWorkPlanDownTime() { return workPlanDownTime; } + public void setOrderRelevance(String orderRelevance) { this.orderRelevance = orderRelevance; } - public String getOrderRelevance() { return orderRelevance; } + public void setWorkPerson(String workPerson) { this.workPerson = workPerson; } - public String getWorkPerson() { return workPerson; } - public void setOutSourceReason(String outSourceReason) { - this.outSourceReason = outSourceReason; - } - public String getOutSourceReason() { - return outSourceReason; - } - public void setWorkTeam(String workTeam) { this.workTeam = workTeam; } - public String getWorkTeam() { return workTeam; } + public void setWorkOutsource(String workOutsource) { this.workOutsource = workOutsource; } - public String getWorkOutsource() { return workOutsource; } + public void setWorkDownMachine(String workDownMachine) { this.workDownMachine = workDownMachine; } - public String getWorkDownMachine() { return workDownMachine; } + public void setEquipmentCode(String equipmentCode) { this.equipmentCode = equipmentCode; } - public String getEquipmentCode() { return equipmentCode; } + public void setWorkReason(String workReason) { this.workReason = workReason; } - public String getWorkReason() { return workReason; } + public void setWorkFaultDesc(String workFaultDesc) { this.workFaultDesc = workFaultDesc; } - public String getWorkFaultDesc() { return workFaultDesc; } + public void setWorkCostTime(Date workCostTime) { this.workCostTime = workCostTime; } - public Date getWorkCostTime() { return workCostTime; } + public void setWorkCost(String workCost) { this.workCost = workCost; } - public String getWorkCost() { return workCost; } + public void setOutWorkId(String outWorkId) { this.outWorkId = outWorkId; } - public String getOutWorkId() { return outWorkId; } + public void setOutWorkCode(String outWorkCode) { this.outWorkCode = outWorkCode; } - public String getOutWorkCode() { return outWorkCode; } + 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; } + public void setFactoryCode(String factoryCode) { this.factoryCode = factoryCode; } - public String getFactoryCode() { return factoryCode; } @@ -443,7 +457,6 @@ public class EquRepairWorkOrder extends BaseEntity { public void setWorkStatus(String workStatus) { this.workStatus = workStatus; } - public String getWorkStatus() { return workStatus; } @@ -452,7 +465,6 @@ public class EquRepairWorkOrder extends BaseEntity { public void setWorkStartTime(String workStartTime) { this.workStartTime = workStartTime; } - public String getWorkStartTime() { return workStartTime; } @@ -460,11 +472,97 @@ public class EquRepairWorkOrder extends BaseEntity { public void setWorkEndTime(String workEndTime) { this.workEndTime = workEndTime; } - public String getWorkEndTime() { return workEndTime; } + //班组 + public void setTeamName(String teamName) { + this.teamName = teamName; + } + public String getTeamName() { + return teamName; + } + + public void setTeamPerson(String teamPerson) { + this.teamPerson = teamPerson; + } + public String getTeamPerson() { + return teamPerson; + } + + //时间列表 + public List getWorkPlanTimeArray() { + return workPlanTimeArray; + } + public void setWorkPlanTimeArray(List workPlanTimeArray) { + this.workPlanTimeArray = workPlanTimeArray; + } + + public List getWorkPlanDownTimeArray() { + return workPlanDownTimeArray; + } + public void setWorkPlanDownTimeArray(List workPlanDownTimeArray) { + this.workPlanDownTimeArray = workPlanDownTimeArray; + } + + //计划开始时间、结束时间 + public String getWorkPlanDownTimeStart() { + return workPlanDownTimeStart; + } + public void setWorkPlanDownTimeStart(String workPlanDownTimeStart) { + this.workPlanDownTimeStart = workPlanDownTimeStart; + } + public String getWorkPlanDownTimeEnd() { + return workPlanDownTimeEnd; + } + public void setWorkPlanDownTimeEnd(String workPlanDownTimeEnd) { + this.workPlanDownTimeEnd = workPlanDownTimeEnd; + } + + //计划停机开始时间、结束时间 + public String getWorkPlanTimeStart() { + return workPlanTimeStart; + } + public void setWorkPlanTimeStart(String workPlanTimeStart) { + this.workPlanTimeStart = workPlanTimeStart; + } + public String getWorkPlanTimeEnd() { + return workPlanTimeEnd; + } + public void setWorkPlanTimeEnd(String workPlanTimeEnd) { + this.workPlanTimeEnd = workPlanTimeEnd; + } + + //委外维修人员/委外维修原因 虚拟字段 + public void setOutSourceReason(String outSourceReason) { + this.outSourceReason = outSourceReason; + } + public String getOutSourceReason() { + return outSourceReason; + } + + public void setOutSourcePerson(String outSourcePerson) { + this.outSourcePerson = outSourcePerson; + } + public String getOutSourcePerson() { + return outSourcePerson; + } + + public void setWorkOutsourcingUnit(String workOutsourcingUnit) { + this.workOutsourcingUnit = workOutsourcingUnit; + } + public String getWorkOutsourcingUnit() { + return workOutsourcingUnit; + } + + public void setWorkConnection(String workConnection) { + this.workConnection = workConnection; + } + public String getWorkConnection() { + return workConnection; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java index 614f34e2..828fb06b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java @@ -58,4 +58,7 @@ public interface EquTeamMapper { * @return 结果 */ public int deleteEquTeamByIds(String[] ids); + + //查询设备维修组列表 + public List getMaintenanceTeamList(EquTeam equTeam); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquOutsourceWorkService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquOutsourceWorkService.java index 762872ef..906ae808 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquOutsourceWorkService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquOutsourceWorkService.java @@ -2,6 +2,7 @@ package com.op.device.service; import java.util.List; import com.op.device.domain.EquOutsourceWork; +import com.op.device.domain.EquRepairWorkOrder; /** * 委外工单Service接口 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java index b6ffed93..fe2c5077 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java @@ -62,4 +62,7 @@ public interface IEquRepairWorkOrderService { //获取维修人员列表 public List getMaintenancePersonList(EquEquipment equEquipment); + + //委外申请 + public int applyEquOutsourceWork(EquRepairWorkOrder equRepairWorkOrder); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java index 245d2530..2c80041c 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java @@ -57,4 +57,7 @@ public interface IEquTeamService { * @return 结果 */ public int deleteEquTeamById(String id); + + //维修组列表 + List getMaintenanceTeamList(EquTeam equTeam); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java index 3bb88a81..869f0559 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java @@ -13,6 +13,10 @@ import org.springframework.stereotype.Service; import com.op.device.mapper.EquOutsourceWorkMapper; import com.op.device.domain.EquOutsourceWork; import com.op.device.service.IEquOutsourceWorkService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; /** * 委外工单Service业务层处理 @@ -61,22 +65,18 @@ public class EquOutsourceWorkServiceImpl implements IEquOutsourceWorkService { @Override @DS("#header.poolName") public int insertEquOutsourceWork(EquOutsourceWork equOutsourceWork) { - //转委外 + equOutsourceWork.setWorkId(IdUtils.fastSimpleUUID()); String serialNum = String.format("%03d", equOutsourceWorkMapper.selectWorkCodeSerialNumber()); String equipmentCode = equOutsourceWork.getEquipmentCode(); equOutsourceWork.setWorkCode("WW"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); - if(equOutsourceWork.getWorkId()!= null){ - EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder(); - equRepairWorkOrder.setWorkId(equOutsourceWork.getWorkId()); - equRepairWorkOrder.setWorkOutsource("1"); - equRepairWorkOrder.setOutWorkCode(equOutsourceWork.getWorkCode()); - equRepairWorkOrderMapper.updateWorkOutsource(equRepairWorkOrder); - equOutsourceWork.setWorkId(""); - } - equOutsourceWork.setWorkId(IdUtils.fastSimpleUUID()); - equOutsourceWork.setWorkReason(equOutsourceWork.getOutSourceReason()); equOutsourceWork.setCreateTime(DateUtils.getNowDate()); equOutsourceWork.setCreateBy(SecurityUtils.getUsername()); + equOutsourceWork.setOrderCode("无"); + equOutsourceWork.setRepairCode("无"); + //工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); return equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java index b4b6eda9..0fbbf8a4 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java @@ -17,6 +17,10 @@ import org.springframework.stereotype.Service; import com.op.device.mapper.EquRepairOrderMapper; import com.op.device.domain.EquRepairOrder; import com.op.device.service.IEquRepairOrderService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; /** * 故障报修Service业务层处理 @@ -79,6 +83,9 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairOrder.setCreateTime(DateUtils.getNowDate()); equRepairOrder.setCreateBy(SecurityUtils.getUsername()); equRepairOrder.setOrderStatus("待审核"); +// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); +// String key = "#header.poolName"; +// equRepairOrder.setFactory(request.getHeader(key.substring(8)).replace("ds_","")); return equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); } @@ -115,9 +122,14 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairWorkOrder.setWorkDownMachine("0"); } equRepairWorkOrder.setWorkFaultDesc(equRepairOrder.getOrderDesc()); + equRepairWorkOrder.setWorkStatus("0"); equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID()); equRepairWorkOrder.setCreateTime(DateUtils.getNowDate()); equRepairWorkOrder.setCreateBy(SecurityUtils.getUsername()); + //工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); equRepairOrder.setOrderStatus("审核通过"); }else if(equRepairOrder.getRepairDestination().equals("不维修")){ @@ -129,11 +141,18 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equOutsourceWork.setOrderCode(equRepairOrder.getOrderCode()); String serialNum = String.format("%03d", equOutsourceWorkMapper.selectWorkCodeSerialNumber()); String equipmentCode = equRepairOrder.getEquipmentCode(); + equOutsourceWork.setEquipmentCode(equipmentCode); equOutsourceWork.setWorkCode("WW"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + equOutsourceWork.setRepairCode("无"); equOutsourceWork.setWorkConnection(equRepairOrder.getWorkConnection()); equOutsourceWork.setWorkOutsourcingUnit(equRepairOrder.getWorkOutsourcingUnit()); equOutsourceWork.setWorkPerson(equRepairOrder.getOutSourcePerson()); equOutsourceWork.setWorkReason(equRepairOrder.getOutSourceReason()); + equOutsourceWork.setCreateBy(SecurityUtils.getUsername()); + equOutsourceWork.setCreateTime(DateUtils.getNowDate()); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork); equRepairOrder.setOrderStatus("审核通过"); }else if(equRepairOrder.getRepairDestination().equals("立即维修")){ diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java index 04d24992..be3f3be3 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.op.device.service.impl; +import java.text.SimpleDateFormat; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; @@ -7,11 +8,17 @@ import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; import com.op.device.domain.EquEquipment; +import com.op.device.domain.EquOutsourceWork; +import com.op.device.mapper.EquOutsourceWorkMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquRepairWorkOrderMapper; import com.op.device.domain.EquRepairWorkOrder; import com.op.device.service.IEquRepairWorkOrderService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; /** * 维修工单Service业务层处理 @@ -24,6 +31,9 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService @Autowired private EquRepairWorkOrderMapper equRepairWorkOrderMapper; + @Autowired + private EquOutsourceWorkMapper equOutsourceWorkMapper; + /** * 查询维修工单 * @@ -45,6 +55,22 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService @Override @DS("#header.poolName") public List selectEquRepairWorkOrderList(EquRepairWorkOrder equRepairWorkOrder) { + if (equRepairWorkOrder.getWorkPlanTimeArray() != null) { + // 设置创建日期开始和结束值 + if (equRepairWorkOrder.getWorkPlanTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equRepairWorkOrder.setWorkPlanTimeStart(formatter.format(equRepairWorkOrder.getWorkPlanTimeArray().get(0))); + equRepairWorkOrder.setWorkPlanTimeEnd(formatter.format(equRepairWorkOrder.getWorkPlanTimeArray().get(1))); + } + } + if (equRepairWorkOrder.getWorkPlanDownTimeArray() != null) { + // 设置更新日期开始和结束 + if (equRepairWorkOrder.getWorkPlanDownTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equRepairWorkOrder.setWorkPlanDownTimeStart(formatter.format(equRepairWorkOrder.getWorkPlanDownTimeArray().get(0))); + equRepairWorkOrder.setWorkPlanDownTimeEnd(formatter.format(equRepairWorkOrder.getWorkPlanDownTimeArray().get(1))); + } + } return equRepairWorkOrderMapper.selectEquRepairWorkOrderList(equRepairWorkOrder); } @@ -62,9 +88,16 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService String serialNum = String.format("%03d", equRepairWorkOrderMapper.selectWorkCodeSerialNumber()); String equipmentCode = equRepairWorkOrder.getEquipmentCode(); //维修单号 + equRepairWorkOrder.setOrderCode("无"); + equRepairWorkOrder.setOutWorkCode("无"); + equRepairWorkOrder.setWorkStatus("待维修"); equRepairWorkOrder.setWorkCode("WX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); equRepairWorkOrder.setCreateBy(SecurityUtils.getUsername()); equRepairWorkOrder.setCreateTime(DateUtils.getNowDate()); + //工厂号 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); return equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); } @@ -72,11 +105,15 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService * 修改维修工单 * * @param equRepairWorkOrder 维修工单 - * @return 结果 + * @return 结果outSourcePerson */ @Override @DS("#header.poolName") public int updateEquRepairWorkOrder(EquRepairWorkOrder equRepairWorkOrder) { + if(equRepairWorkOrder.getWorkDownMachine().equals("0")){ + equRepairWorkOrder.setWorkPlanDownTime(null); + } + equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); return equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); } @@ -110,4 +147,32 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService public List getMaintenancePersonList(EquEquipment equEquipment) { return equRepairWorkOrderMapper.getMaintenancePersonList(equEquipment); } + + //委外申请 + @Override + @DS("#header.poolName") + public int applyEquOutsourceWork(EquRepairWorkOrder equRepairWorkOrder) { + //转委外 + EquOutsourceWork equOutsourceWork = new EquOutsourceWork(); + equOutsourceWork.setWorkId(IdUtils.fastSimpleUUID()); + //委外工单号 + String serialNum = String.format("%03d", equOutsourceWorkMapper.selectWorkCodeSerialNumber()); + String equipmentCode = equRepairWorkOrder.getEquipmentCode(); + equOutsourceWork.setOrderCode("无"); + equOutsourceWork.setWorkCode("WW"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + equOutsourceWork.setEquipmentCode(equipmentCode); + equOutsourceWork.setRepairCode(equRepairWorkOrder.getWorkCode()); + equOutsourceWork.setWorkReason(equRepairWorkOrder.getOutSourceReason()); + equOutsourceWork.setWorkPerson(equRepairWorkOrder.getOutSourcePerson()); + equOutsourceWork.setWorkOutsourcingUnit(equRepairWorkOrder.getWorkOutsourcingUnit()); + equOutsourceWork.setWorkConnection(equRepairWorkOrder.getWorkConnection()); + equOutsourceWork.setCreateTime(DateUtils.getNowDate()); + equOutsourceWork.setCreateBy(SecurityUtils.getUsername()); + if(equRepairWorkOrder.getWorkId()!= null){ + equRepairWorkOrder.setWorkOutsource("1"); + equRepairWorkOrder.setOutWorkCode(equOutsourceWork.getWorkCode()); + equRepairWorkOrderMapper.updateWorkOutsource(equRepairWorkOrder); + } + return equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java index 3491c18c..d4d76a1f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java @@ -99,4 +99,13 @@ public class EquTeamServiceImpl implements IEquTeamService { public int deleteEquTeamById(String id) { return equTeamMapper.deleteEquTeamById(id); } + + /** + * 查询设备维修组列表 + */ + @Override + @DS("#header.poolName") + public List getMaintenanceTeamList(EquTeam equTeam) { + return equTeamMapper.getMaintenanceTeamList(equTeam); + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml index d171c4d3..b835a9c9 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -25,24 +26,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + - select work_id, work_code,order_code, work_person, work_outsourcing_unit, work_connection, work_reason, work_type, equipment_code, work_cost, work_cost_time, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_outsource_work + select work_id, work_code,order_code, repair_code, work_person, work_outsourcing_unit, work_connection, work_reason, work_type, equipment_code, work_cost, work_cost_time, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_outsource_work @@ -66,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" work_id, work_code, order_code, + repair_code, work_person, work_outsourcing_unit, work_connection, @@ -88,6 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{workId}, #{workCode}, #{orderCode}, + #{repairCode}, #{workPerson}, #{workOutsourcingUnit}, #{workConnection}, @@ -113,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" work_code = #{workCode}, order_code = #{orderCode}, + repair_code = #{repairCode}, work_person = #{workPerson}, work_outsourcing_unit = #{workOutsourcingUnit}, work_connection = #{workConnection}, diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml index 8f4dd627..090182f4 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml @@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select order_id, order_code, equipment_code, order_desc, order_breakdown_time, order_source, order_time, order_handle, order_repairman, order_connection, order_status, order_relevance, order_picture, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,repair_destination from equ_repair_order + select order_id, order_code, equipment_code, order_desc, order_breakdown_time, order_source, order_time, order_handle, order_repairman, order_connection, order_status, order_relevance, order_picture, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,factory_code,repair_destination from equ_repair_order - + select + erwo.work_id, + erwo.order_id, + erwo.order_code, + erwo.work_code, + erwo.work_handle, + erwo.work_plan_time, + erwo.work_plan_down_time, + erwo.order_relevance, + erwo.work_person, + erwo.work_team, + erwo.work_outsource, + erwo.work_down_machine, + erwo.equipment_code, + erwo.work_reason, + erwo.work_fault_desc, + erwo.work_start_time, + erwo.work_end_time, + erwo.work_cost_time, + erwo.work_cost, + erwo.work_status, + erwo.out_work_id, + erwo.out_work_code, + erwo.attr1, + erwo.attr2, + erwo.attr3, + erwo.create_by, + erwo.create_time, + erwo.update_time, + erwo.update_by, + erwo.del_flag, + erwo.factory_code, + be.equipment_name, + et.team_name, + et.team_person + from equ_repair_work_order erwo + left join base_equipment be on erwo.equipment_code = be.equipment_code + left join equ_team et on erwo.work_team = et.team_code - and order_id = #{orderId} - and work_code like concat('%', #{workCode}, '%') - and order_code like concat('%', #{orderCode}, '%') + and erwo.order_id = #{orderId} + and erwo.work_code like concat('%', #{workCode}, '%') + and erwo.order_code like concat('%', #{orderCode}, '%') - and equipment_code like concat('%', #{equipmentCode}, '%') - and work_fault_desc = #{workFaultDesc} - and work_plan_time = #{workPlanTime} - and work_down_machine = #{workDownMachine} - and work_plan_down_time = #{workPlanDownTime} + and erwo.equipment_code like concat('%', #{equipmentCode}, '%') + and erwo.work_fault_desc = #{workFaultDesc} + and CONVERT(date,work_plan_time) >= #{workPlanTimeStart} + and #{workPlanTimeEnd} >= CONVERT(date,erwo.work_plan_time) + and erwo.work_down_machine = #{workDownMachine} + and CONVERT(date,work_plan_down_time) >= #{workPlanDownTimeStart} + and #{workPlanDownTimeEnd} >= CONVERT(date,erwo.work_plan_down_time) - and work_person like concat('%', #{workPerson}, '%') - and work_team like concat('%', #{workTeam}, '%') + and erwo.work_person like concat('%', #{workPerson}, '%') + and erwo.work_team like concat('%', #{workTeam}, '%') - and work_outsource = #{workOutsource} - and out_work_code = #{outWorkCode} + and erwo.work_outsource = #{workOutsource} + and erwo.out_work_code like concat('%', #{outWorkCode}, '%') - and work_reason = #{workReason} - and work_start_time = #{workStartTime} - and work_end_time = #{workEndTime} - and work_cost_time = #{workCostTime} - and work_cost = #{workCost} - and work_status = #{workStatus} - and factory_code = #{factoryCode} + and erwo.work_reason = #{workReason} + and erwo.work_start_time = #{workStartTime} + and erwo.work_end_time = #{workEndTime} + and erwo.work_cost_time = #{workCostTime} + and erwo.work_cost = #{workCost} + and erwo.work_status = #{workStatus} + and erwo.factory_code = #{factoryCode} - and work_handle = #{workHandle} - and order_relevance = #{orderRelevance} - and del_flag = '0' + and erwo.work_handle = #{workHandle} + and erwo.order_relevance = #{orderRelevance} + and erwo.del_flag = '0' - ORDER BY create_time DESC + ORDER BY erwo.create_time DESC where id = #{id} - where del_flag = '0' + and del_flag = '0' @@ -98,4 +98,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + \ No newline at end of file