diff --git a/dev_jco_rfc.trc b/dev_jco_rfc.trc deleted file mode 100644 index 9731a6f6..00000000 --- a/dev_jco_rfc.trc +++ /dev/null @@ -1,114 +0,0 @@ - -**** Error file opened at 20230724 105509 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Mon Jul 24 10:55:09,173< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Mon Jul 24 10:55:09 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 2 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - -Error: >Mon Jul 24 10:55:30,220< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Mon Jul 24 10:55:30 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 4 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - - -**** Error file opened at 20230725 103104 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Tue Jul 25 10:31:04,628< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Tue Jul 25 10:31:04 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 2 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - -Error: >Tue Jul 25 10:31:25,675< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Tue Jul 25 10:31:25 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 4 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - - -**** Error file opened at 20230816 113444 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Wed Aug 16 11:34:44,064< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. -Wed Aug 16 17:42:53,538< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. -Wed Aug 16 17:44:47,079< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. - list = equTeamService.getMaintenanceTeamList(equTeam); + return getDataTable(list); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java index 7f7344d1..7a79430f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java @@ -8,6 +8,7 @@ import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; import com.op.device.domain.EquOrder; +import com.op.device.domain.EquPlan; import com.op.device.service.IEquUpkeepOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -66,8 +67,8 @@ public class EquUpkeepOrderController extends BaseController { @RequiresPermissions("device:upkeepOrder:add") @Log(title = "保养工单", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody EquOrder equOrder) { - return toAjax(equUpkeepOrderService.insertEquOrder(equOrder)); + public AjaxResult add(@RequestBody EquPlan equPlan) { + return equUpkeepOrderService.insertEquOrder(equPlan); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEquSpare.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEquSpare.java new file mode 100644 index 00000000..250bd23d --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEquSpare.java @@ -0,0 +1,182 @@ +package com.op.device.domain; + +import java.math.BigDecimal; +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_order_equ_spare + * + * @author Open Platform + * @date 2023-11-02 + */ +public class EquOrderEquSpare extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String id; + + /** 编码 */ + @Excel(name = "编码") + private String code; + + /** 主工单信息 */ + @Excel(name = "主工单信息") + private String orderCode; + + /** 关联上级code */ + @Excel(name = "关联上级code") + private String parentCode; + + /** 备件code */ + @Excel(name = "备件code") + private String materialCode; + + /** 备件名称 */ + @Excel(name = "备件名称") + private String materialDesc; + + /** 备件类型 */ + @Excel(name = "备件类型") + private String spareType; + + /** 申领数量 */ + @Excel(name = "申领数量") + private BigDecimal applyNum; + + /** 工厂 */ + @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 setCode(String code) { + this.code = code; + } + + public String getCode() { + return code; + } + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderCode() { + return orderCode; + } + public void setParentCode(String parentCode) { + this.parentCode = parentCode; + } + + public String getParentCode() { + return parentCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + public void setMaterialDesc(String materialDesc) { + this.materialDesc = materialDesc; + } + + public String getMaterialDesc() { + return materialDesc; + } + public void setSpareType(String spareType) { + this.spareType = spareType; + } + + public String getSpareType() { + return spareType; + } + public void setApplyNum(BigDecimal applyNum) { + this.applyNum = applyNum; + } + + public BigDecimal getApplyNum() { + return applyNum; + } + 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("code", getCode()) + .append("orderCode", getOrderCode()) + .append("parentCode", getParentCode()) + .append("materialCode", getMaterialCode()) + .append("materialDesc", getMaterialDesc()) + .append("spareType", getSpareType()) + .append("applyNum", getApplyNum()) + .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(); + } +} 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/EquOrderEquSpareMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java new file mode 100644 index 00000000..58d5c9e6 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java @@ -0,0 +1,61 @@ +package com.op.device.mapper; + +import java.util.List; + +import com.op.device.domain.EquOrderEquSpare; + +/** + * 工单设备备件关联Mapper接口 + * + * @author Open Platform + * @date 2023-11-02 + */ +public interface EquOrderEquSpareMapper { + /** + * 查询工单设备备件关联 + * + * @param id 工单设备备件关联主键 + * @return 工单设备备件关联 + */ + public EquOrderEquSpare selectEquOrderEquSpareById(String id); + + /** + * 查询工单设备备件关联列表 + * + * @param equOrderEquSpare 工单设备备件关联 + * @return 工单设备备件关联集合 + */ + public List selectEquOrderEquSpareList(EquOrderEquSpare equOrderEquSpare); + + /** + * 新增工单设备备件关联 + * + * @param equOrderEquSpare 工单设备备件关联 + * @return 结果 + */ + public int insertEquOrderEquSpare(EquOrderEquSpare equOrderEquSpare); + + /** + * 修改工单设备备件关联 + * + * @param equOrderEquSpare 工单设备备件关联 + * @return 结果 + */ + public int updateEquOrderEquSpare(EquOrderEquSpare equOrderEquSpare); + + /** + * 删除工单设备备件关联 + * + * @param id 工单设备备件关联主键 + * @return 结果 + */ + public int deleteEquOrderEquSpareById(String id); + + /** + * 批量删除工单设备备件关联 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEquOrderEquSpareByIds(String[] ids); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java index a447e04d..32da1d8a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderMapper.java @@ -92,4 +92,10 @@ public interface EquOrderMapper { * @return */ EquOrder selectEquOrderByOrderId(String orderId); + + /** + * 获取流水号 + * @return + */ + int selectSerialNumber(); } 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/IEquUpkeepOrderService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java index 0827962b..74511196 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java @@ -1,6 +1,8 @@ package com.op.device.service; +import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquOrder; +import com.op.device.domain.EquPlan; import java.util.List; @@ -33,7 +35,7 @@ public interface IEquUpkeepOrderService { * @param equOrder 保养工单 * @return 结果 */ - public int insertEquOrder(EquOrder equOrder); + public AjaxResult insertEquOrder(EquPlan equPlan); /** * 修改保养工单 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/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java index 7255138b..c19ed49c 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java @@ -1,15 +1,26 @@ package com.op.device.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; -import com.op.device.domain.EquOrder; -import com.op.device.mapper.EquOrderMapper; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.core.web.domain.AjaxResult; +import com.op.device.domain.*; +import com.op.device.mapper.*; import com.op.device.service.IEquUpkeepOrderService; +import com.op.system.api.domain.SysUser; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.List; +import static com.op.common.core.web.domain.AjaxResult.success; + /** * 保养工单Service业务层处理 * @@ -20,6 +31,16 @@ import java.util.List; public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { @Autowired private EquOrderMapper equOrderMapper; + @Autowired + private EquOrderEquSpareMapper equOrderEquSpareMapper; + @Autowired + private EquOrderStandardMapper equOrderStandardMapper; + @Autowired + private EquOrderDetailMapper equOrderDetailMapper; + @Autowired + private EquOrderPersonMapper equOrderPersonMapper; + @Autowired + private EquOrderEquMapper equOrderEquMapper; /** * 查询保养工单 @@ -46,16 +67,136 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { } /** - * 新增保养工单 + * TODO 快速工单 * - * @param equOrder 保养工单 + * @param equPlan 保养工单 * @return 结果 */ @Override @DS("#header.poolName") - public int insertEquOrder(EquOrder equOrder) { + public AjaxResult insertEquOrder(EquPlan equPlan) { + + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String str = request.getHeader(key.substring(8)); + int index = str.indexOf("_"); + String factory = str.substring(index + 1); + + // 生成主工单信息 + EquOrder equOrder = new EquOrder(); + BeanUtils.copyProperties(equPlan,equOrder); + equOrder.setOrderId(IdUtils.fastSimpleUUID()); + // 流水号 + String serialNum = String.format("%03d",equOrderMapper.selectSerialNumber()); + equOrder.setOrderCode("F"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum); + equOrder.setPlanLoopType(""); + equOrder.setPlanLoopStart(equPlan.getPlanTimeArray().get(0)); + equOrder.setPlanLoopEnd(equPlan.getPlanTimeArray().get(1)); + // 设置工单状态 + equOrder.setOrderStatus("0"); + equOrder.setFactoryCode(factory); + equOrder.setCreateBy(SecurityContextHolder.getUserName()); equOrder.setCreateTime(DateUtils.getNowDate()); - return equOrderMapper.insertEquOrder(equOrder); + equOrder.setUpdateBy(SecurityContextHolder.getUserName()); + equOrder.setUpdateTime(DateUtils.getNowDate()); + equOrder.setPlanType("maintenance"); + // 工单插入数据库 + equOrderMapper.insertEquOrder(equOrder); + + // 生成工单-设备 + EquOrderEqu equ = new EquOrderEqu(); + List equPlanEquList = equPlan.getEquipmentItem(); + EquPlanEqu equPlanEqu = equPlanEquList.get(0); + BeanUtils.copyProperties(equPlanEqu,equ); + equ.setId(IdUtils.fastSimpleUUID()); + equ.setCode("E"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+"001"); + equ.setParentCode(equOrder.getOrderCode()); + equ.setOrderCode(equOrder.getOrderCode()); + equ.setFactoryCode(factory); + equ.setAttr1(""); + equ.setCreateBy(SecurityContextHolder.getUserName()); + // 设备插入 + equOrderEquMapper.insertEquOrderEqu(equ); + // 生成工单-备件 + List spareList = new ArrayList<>(); + List equSpareList = equPlanEqu.getSpareList(); + int spareSerialNum = 0; + for (EquPlanEquSpare spare : equSpareList) { + EquOrderEquSpare spareTemp = new EquOrderEquSpare(); + BeanUtils.copyProperties(spare,spareTemp); + spareTemp.setId(IdUtils.fastSimpleUUID()); + spareTemp.setCode("S"+equOrder.getOrderCode()+String.format("%03d",++spareSerialNum)); + spareTemp.setOrderCode(equOrder.getOrderCode()); + spareTemp.setParentCode(equ.getCode()); + spareTemp.setFactoryCode(factory); + spareTemp.setCreateBy(SecurityContextHolder.getUserName()); + spareTemp.setCreateTime(DateUtils.getNowDate()); + spareTemp.setUpdateBy(SecurityContextHolder.getUserName()); + spareTemp.setUpdateTime(DateUtils.getNowDate()); + // 插入备件信息 + equOrderEquSpareMapper.insertEquOrderEquSpare(spareTemp); + spareList.add(spareTemp); + } + // 备件置入 + System.out.println(spareList); + // 生成工单-设备-保养项 + List detailList = equPlanEqu.getEquPlanDetailList(); + + int detailSerialNum = 0; + for (EquPlanDetail detail : detailList) { + EquOrderDetail equOrderDetail = new EquOrderDetail(); + List orderStandardList = new ArrayList<>(); + List standardList = detail.getEquPlanStandardList(); + BeanUtils.copyProperties(detail,equOrderDetail); + equOrderDetail.setId(IdUtils.fastSimpleUUID()); + equOrderDetail.setCode("C"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+String.format("%03d",++detailSerialNum)); + equOrderDetail.setOrderCode(equOrder.getOrderCode()); + equOrderDetail.setParentCode(equ.getCode()); + equOrderDetail.setFactroyCode(factory); + equOrderDetail.setStandardList(orderStandardList); + equOrderDetail.setCreateBy(SecurityContextHolder.getUserName()); + equOrderDetail.setCreateTime(DateUtils.getNowDate()); + equOrderDetail.setUpdateBy(SecurityContextHolder.getUserName()); + equOrderDetail.setUpdateTime(DateUtils.getNowDate()); + // 插入检查项信息 + equOrderDetailMapper.insertEquOrderDetail(equOrderDetail); + + int standardSerialNum = 0; + for (EquPlanStandard standard : standardList) { + EquOrderStandard orderStandard = new EquOrderStandard(); + BeanUtils.copyProperties(standard,orderStandard); + orderStandard.setId(IdUtils.fastSimpleUUID()); + orderStandard.setCode("S"+equOrder.getOrderCode()+String.format("%03d",++standardSerialNum)); + orderStandard.setParentCode(equOrderDetail.getCode()); + orderStandard.setOrderCode(equOrder.getOrderCode()); + orderStandard.setCreateBy(SecurityContextHolder.getUserName()); + orderStandard.setCreateTime(DateUtils.getNowDate()); + orderStandard.setUpdateBy(SecurityContextHolder.getUserName()); + orderStandard.setUpdateTime(DateUtils.getNowDate()); + // 插入标准信息 + equOrderStandardMapper.insertEquOrderStandard(orderStandard); + } + } + + // 生成工单-人员 + List personList = equPlan.getPersonList(); + for (SysUser user : personList) { + EquOrderPerson equOrderPerson = new EquOrderPerson(); + equOrderPerson.setId(IdUtils.fastSimpleUUID()); + // TODO 要改变编码格式 + equOrderPerson.setOrderCode(equOrder.getOrderCode()); + equOrderPerson.setFactoryCode(factory); + equOrderPerson.setUserId(user.getUserId()); + equOrderPerson.setCreateBy(SecurityContextHolder.getUserName()); + equOrderPerson.setCreateTime(DateUtils.getNowDate()); + equOrderPerson.setUpdateBy(SecurityContextHolder.getUserName()); + equOrderPerson.setUpdateTime(DateUtils.getNowDate()); + // 插入人员信息 + equOrderPersonMapper.insertEquOrderPerson(equOrderPerson); + } + + return success(); } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml new file mode 100644 index 00000000..0b4e5fca --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select id, code, order_code, parent_code, material_code, material_desc, spare_type, apply_num, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_order_equ_spare + + + + + + + + insert into equ_order_equ_spare + + id, + code, + order_code, + parent_code, + material_code, + material_desc, + spare_type, + apply_num, + factory_code, + attr1, + attr2, + attr3, + del_flag, + create_by, + create_time, + update_by, + update_time, + + + #{id}, + #{code}, + #{orderCode}, + #{parentCode}, + #{materialCode}, + #{materialDesc}, + #{spareType}, + #{applyNum}, + #{factoryCode}, + #{attr1}, + #{attr2}, + #{attr3}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update equ_order_equ_spare + + code = #{code}, + order_code = #{orderCode}, + parent_code = #{parentCode}, + material_code = #{materialCode}, + material_desc = #{materialDesc}, + spare_type = #{spareType}, + apply_num = #{applyNum}, + 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_order_equ_spare where id = #{id} + + + + delete from equ_order_equ_spare where id in + + #{id} + + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml index ae0833a9..2ffbdad7 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml @@ -111,6 +111,12 @@ where order_id = #{orderId} + + insert into equ_order 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 diff --git a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java index 4d8617b0..a1afab77 100644 --- a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java +++ b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java @@ -73,7 +73,7 @@ public class RyTask { remotePlanService.syncSAPOrders(); } - /**每5分钟报工一次**/ + /**每5分钟报工一次(废弃)**/ public void reportWorkTask(){ logger.info("++报工接口+开始++reportWorkTask+++++"); remoteMesService.reportWorkTask(); diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java index dabab8e5..45ba3d3a 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java @@ -6,6 +6,7 @@ import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; +import com.op.mes.domain.MesReportWork; import com.op.mes.domain.dto.BaseEquipmentDto; import com.op.mes.domain.dto.LGInfoDto; import com.op.system.api.domain.dto.BoardDTO; @@ -103,6 +104,19 @@ public class WCSInterfaceController extends BaseController { } return success(wCInterfaceService.getMesBoardEquProductionToday(boardDTO)); } + + /**上位机报工**/ + @PostMapping("/reportWork") + public AjaxResult reportWork(@RequestBody MesReportWork mesReportWork) { + if(StringUtils.isBlank(mesReportWork.getFactoryCode())){ + return error("[factoryCode] is null"); + } + if(StringUtils.isBlank(mesReportWork.getReportCode())){ + return error("[reportCode] is null"); + } + return success(wCInterfaceService.reportWork(mesReportWork)); + } + /************************************************************/ /****************************数据库清理************************/ /************************************************************/ @@ -112,6 +126,7 @@ public class WCSInterfaceController extends BaseController { List tables = new ArrayList<>(); tables.add("mes_plc_log"); tables.add("mes_interface_log"); + tables.add("sys_sap_log"); return success(wCInterfaceService.dataClearTask(tables)); } //定期备份清理表 diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java index 2684c598..d9c8a5e9 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java @@ -3,6 +3,7 @@ package com.op.mes.mapper; import com.op.mes.domain.dto.BaseEquipmentDto; import com.op.mes.domain.dto.LGInfoDto; import com.op.system.api.domain.SysDept; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.dto.BoardDTO; import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.dto.WCSDataItemsDTO; @@ -50,5 +51,7 @@ public interface MesMapper { void deleteBkDate(@Param("table")String addMonthTable,@Param("startDate") String startDate, @Param("endDate")String endDate); + void addSapLog(SysSapLog sysSapLog); + List> selectcxjList(); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java index c6c8177f..575ddcd8 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java @@ -89,4 +89,8 @@ public interface MesReportWorkMapper { List getEquNames(MesHourReport mesHourReport); List selectProShift(); + + MesReportWork getProdResult(MesReportWork work); + + ProOrderWorkorder getOrderByCode(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java index f98207bd..44cec1cd 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java @@ -2,6 +2,7 @@ package com.op.mes.service; import com.op.common.core.domain.R; import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesReportWork; import com.op.mes.domain.MesShift; import com.op.mes.domain.dto.BaseEquipmentDto; import com.op.mes.domain.dto.LGInfoDto; @@ -34,5 +35,7 @@ public interface IWCSInterfaceService { R dataBKTask(List tables); + R reportWork(MesReportWork mesReportWork); + Map getDryRoomData(BoardDTO boardDTO); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 97aceb93..203a6c7a 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -6,25 +6,32 @@ import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.bean.BeanUtils; import com.op.common.core.utils.uuid.IdUtils; +import com.op.mes.domain.MesReportWork; import com.op.mes.domain.MesShift; +import com.op.mes.domain.ProOrderWorkorder; import com.op.mes.domain.dto.LGInfoDto; import com.op.mes.mapper.MesMapper; import com.op.mes.mapper.MesReportWorkMapper; import com.op.mes.mapper.ProRfidProcessDetailMapper; import com.op.mes.service.IWCSInterfaceService; +import com.op.system.api.RemoteSapService; import com.op.system.api.RemoteUserService; import com.op.system.api.domain.SysDept; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.SysUser; import com.op.system.api.domain.dto.BoardDTO; import com.op.system.api.domain.dto.WCSDTO; import com.op.system.api.domain.dto.WCSDataDTO; import com.op.system.api.domain.mes.ProRfidProcessDetail; +import com.op.system.api.domain.sap.SapRFW; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; @@ -54,6 +61,9 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { @Autowired private RemoteUserService remoteUserService; + @Autowired + private RemoteSapService remoteSapService; + /**下一工序机台集合获取 * JSON * { @@ -259,6 +269,74 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { return R.ok(true); } + @Override + public R reportWork(MesReportWork mesReportWork) { + DynamicDataSourceContextHolder.push("ds_"+mesReportWork.getFactoryCode());// 这是数据源的key + mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 + mesReportWork.setProdType("prod"); + List reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork); + if(CollectionUtils.isEmpty(reportWorks)){ + return R.fail("未查询报工单"); + } + + MesReportWork work = reportWorks.get(0); + SapRFW sapRFW = new SapRFW(); + sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号 + sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量 + SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改 + ltgs.setConf_activity1(work.getSac1());//人工 + ltgs.setConf_activity2(work.getSac2()); + ltgs.setConf_activity3(work.getSac3());//机器 + ltgs.setConf_activity4(work.getSac4()); + ltgs.setConf_activity5(work.getSac5());//折旧 + ltgs.setConf_activity6(work.getSac6()); + SapRFW.lt_hw lthw = sapRFW.getLt_hw();//MES生产订单报工货物移动修改 + lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO; + lthw.setMaterial(work.getProcessCode()); + + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(sapRFW.toString()); + sysSapLog.setMethod("reportWork"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + mesMapper.addSapLog(sysSapLog); + + R r = remoteSapService.sapRFWOrder(sapRFW); + //上传成功,更改mes_report_work状态 + if (r.getCode() == 200) { + work.setUploadStatus("1"); + } else { + work.setUploadStatus("2"); + work.setUploadMsg(r.getMsg()); + } + work.setUploadTime(DateUtils.getNowDate()); + mesReportWorkMapper.updateSyncSapStatus(work); + //工单完成数量>工单数量:关闭订单 + MesReportWork proResult = mesReportWorkMapper.getProdResult(work); + ProOrderWorkorder topOrder = this.getTopOrder(work.getWorkorderCode()); + if(proResult.getQuantityFeedback().compareTo(new BigDecimal(topOrder.getQuantitySplit()))>=0){ + //工单完成,关闭工单 + remoteSapService.sapCloseOrder(work.getOrderCode()); + work.setStatus("w4"); + work.setUpdateTime(DateUtils.getNowDate()); + //pro_work_order status->w4报工 + mesReportWorkMapper.updateWorkOrderStatus(work); + } + return R.ok(); + } + + //根据工单子单编码获取最顶级订单的母单 + private ProOrderWorkorder getTopOrder(String workorderCode) { + //pro_order_workorder + ProOrderWorkorder topOrder = mesReportWorkMapper.getOrderByCode(workorderCode); + while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { + //pro_order_workorder + topOrder = mesReportWorkMapper.getOrderByCode(topOrder.getParentOrder()); + } + return topOrder; + } public void dateBKFunc(String poolName,List tables){ diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareServiceImpl.java index 97f45a5d..a4d034cd 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesPrepareServiceImpl.java @@ -236,8 +236,8 @@ public class MesPrepareServiceImpl implements IMesPrepareService { try { dateSources.forEach(dateSource -> { logger.info("++++++++++++" + dateSource.get("poolName") + "++++报工开始++++++++++"); - Runnable run = () -> reportWorkByFactory(dateSource.get("poolName")); - executorService.execute(run); + //Runnable run = () -> reportWorkByFactory(dateSource.get("poolName")); + //executorService.execute(run); }); } catch (Exception e) { logger.error("service == deviceOfflineTimingTask == exception", e); @@ -249,17 +249,16 @@ public class MesPrepareServiceImpl implements IMesPrepareService { } //报工 public void reportWorkByFactory(String poolName) { - DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key - MesReportWork mesReportWork = new MesReportWork(); + MesReportWork mesReportWork = new MesReportWork(); mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 mesReportWork.setProdType("prod"); List reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork); - for(MesReportWork work:reportWorks){ + for(MesReportWork work:reportWorks) { SapRFW sapRFW = new SapRFW(); sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号 sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量 SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改 - ltgs.setConf_activity1(work.getSac1()); + ltgs.setConf_activity1(work.getSac1());//人工 ltgs.setConf_activity2(work.getSac2()); ltgs.setConf_activity3(work.getSac3()); ltgs.setConf_activity4(work.getSac4()); @@ -270,9 +269,9 @@ public class MesPrepareServiceImpl implements IMesPrepareService { lthw.setMaterial(work.getProcessCode()); R r = remoteSapService.sapRFWOrder(sapRFW); //上传成功,更改mes_report_work状态 - if(r.getCode() == 200){ + if (r.getCode() == 200) { work.setUploadStatus("1"); - }else{ + } else { work.setUploadStatus("2"); work.setUploadMsg(r.getMsg()); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java index 13963b84..40addf16 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java @@ -12,6 +12,7 @@ import com.op.mes.domain.*; import com.op.mes.domain.dto.LineChartDto; import com.op.mes.domain.dto.LineChartSeriesDto; import com.op.mes.domain.dto.SysFactoryDto; +import com.op.mes.service.IWCSInterfaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.mes.mapper.MesReportWorkMapper; @@ -29,6 +30,8 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { @Autowired private MesReportWorkMapper mesReportWorkMapper; + @Autowired + private IWCSInterfaceService iWCSInterfaceService; /** * 查询报工报表 * @@ -63,6 +66,7 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { @DS("#header.poolName") public int insertMesReportWork(MesReportWork mesReportWork) { mesReportWork.setCreateTime(DateUtils.getNowDate()); + iWCSInterfaceService.reportWork(mesReportWork); return mesReportWorkMapper.insertMesReportWork(mesReportWork); } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml index bc236c79..ae338574 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml @@ -156,6 +156,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT TOP 0 * INTO ${tableNew} FROM mes_material_transfer_result + + insert into sys_sap_log + (id,messsge,create_time,reqcode,method,remark,status) + values( + #{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status}) + + + + insert into mes_report_work diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml index c71ed154..cab05f69 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml @@ -64,11 +64,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" pp.process_name as nextProcessName, ppp.process_code as nowProcessCode, ppp.process_name as nowProcessName, - pow.order_code as orderCode + pow.order_code as orderCode, + pow.product_code as productCode, + pow.product_name as productName, + pow.product_date as productDate, + pow.shift_id as shiftId from pro_rfid_process_detail ppd left join pro_process pp on pp.process_id = ppd.next_process_id left join pro_process ppp on ppp.process_id = ppd.now_process_id left join pro_order_workorder pow on pow.workorder_code = ppd.workorder_code + order by ppd.in_time desc and ppd.workorder_code like concat('%', #{workorderCode}, '%') and rfid like concat('%', #{rfid}, '%') diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index 57cb0ef4..d8c90655 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -2,6 +2,7 @@ package com.op.plan.controller; import java.io.IOException; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -171,6 +172,15 @@ public class ProOrderController extends BaseController { return success(proOrderService.getProShifts()); } + /** + * 获取工单执行顺序 + * @return + */ + @PutMapping("/getProSortNo") + public int getProSortNo(@RequestBody ProOrder proOrder) { + return proOrderService.getProSortNo(proOrder); + } + /** * 通过工艺编码获取设备信息list * @@ -252,8 +262,8 @@ public class ProOrderController extends BaseController { */ @Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT) @PostMapping("/syncSAP") - public AjaxResult syncSAP() { - return proOrderService.syncSAP(); + public void syncSAP() { + proOrderService.syncSAP(); } @Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java index 809bfc3f..ef9b4bb9 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java @@ -158,7 +158,7 @@ public class ProOrderWorkorderController extends BaseController { @Log(title = "生产工单", businessType = BusinessType.DELETE) @DeleteMapping("/{workorderIds}") public AjaxResult remove(@PathVariable String[] workorderIds) { - //什么时候可以删除工单?TODO;没进入生产之前都可以? + //没进入生产之前都可以删除 // 根据工单的ids查工单的信息 List proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds); if (ObjectUtils.isEmpty(proOrderWorkorders)) { @@ -195,15 +195,11 @@ public class ProOrderWorkorderController extends BaseController { } else { throw new ServiceException("工单已进行生产,不允许删除!"); } - // 判断是否含有湿料计划 boolean值(存在为true,不存在为false) -// if (proWetMaterialPlanDetailService.selectProWetMaterialPlanDetailByWorkId(proOrderWorkorder.getWorkorderId())) { -// throw new ServiceException("工单已创建湿料计划,不能删除!"); -// } } String[] orderWorkerIds = strings.toArray(new String[0]); // 删除成品工单 - if (proWorkOrder.size() > 0) { + if (orderWorkerIds.length > 0) { proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds); } return toAjax(1); diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java index 41f5d641..ffb51e77 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java @@ -62,6 +62,16 @@ public class ProOrder extends TreeEntity { private String bomBo; private String syncUser; + private String productDate; + + public String getProductDate() { + return productDate; + } + + public void setProductDate(String productDate) { + this.productDate = productDate; + } + public String getBomBo() { return bomBo; } @@ -138,7 +148,7 @@ public class ProOrder extends TreeEntity { private String materialCode; private String materialName; - + private Integer sortNo; // 车数 private Integer carNum; @@ -338,6 +348,14 @@ public class ProOrder extends TreeEntity { return prodType; } + public Integer getSortNo() { + return sortNo; + } + + public void setSortNo(Integer sortNo) { + this.sortNo = sortNo; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index 99587760..9fe84808 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -150,6 +150,7 @@ public class ProOrderWorkorder extends TreeEntity { // 车数 private Integer carNum; + private Integer sortNo; public Integer getCarNum() { return carNum; @@ -506,6 +507,14 @@ public class ProOrderWorkorder extends TreeEntity { this.prodLineCodeArray = prodLineCodeArray; } + public Integer getSortNo() { + return sortNo; + } + + public void setSortNo(Integer sortNo) { + this.sortNo = sortNo; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java index a2632e3e..46a3e24e 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/ProOrderDTO.java @@ -65,6 +65,8 @@ public class ProOrderDTO { private Integer carNum; + private Integer sortNo; + public Integer getCarNum() { return carNum; } @@ -83,6 +85,14 @@ public class ProOrderDTO { private List children; + public Integer getSortNo() { + return sortNo; + } + + public void setSortNo(Integer sortNo) { + this.sortNo = sortNo; + } + @Override public String toString() { return "ProOrderDTO{" + diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/SplitOrderDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/SplitOrderDTO.java index 97e10046..6e0c7a35 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/SplitOrderDTO.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/SplitOrderDTO.java @@ -29,6 +29,15 @@ public class SplitOrderDTO { private String materialCode; private String materialName; + private Integer sortNo; + + public Integer getSortNo() { + return sortNo; + } + + public void setSortNo(Integer sortNo) { + this.sortNo = sortNo; + } public String getMaterialCode() { return materialCode; diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java index 3a90dbc5..94ccc952 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java @@ -9,6 +9,7 @@ import com.op.plan.domain.ProOrder; import com.op.plan.domain.ProShift; import com.op.plan.domain.*; import com.op.plan.domain.vo.CascaderDTO; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.model.SapProOrder; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; @@ -220,4 +221,6 @@ public interface ProOrderMapper { * @param orderCode */ void updateOrderStatusCompleteByOrderCode(String orderCode); + + void addSapLog(SysSapLog sysSapLog); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 55524237..708b08f1 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -148,5 +148,7 @@ public interface ProOrderWorkorderMapper { * @return */ List selectProOrderWorkorderByOrderId(String orderId); + + int getProSortNo(ProOrder proOrder); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java index 12864357..47098ea4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java @@ -97,7 +97,7 @@ public interface IProOrderService { public AjaxResult getOrderList(String id); - public AjaxResult syncSAP(); + public void syncSAP(); /** * 处理表格信息 @@ -134,4 +134,6 @@ public interface IProOrderService { * @return */ AjaxResult getCascadeProOrder(String orderCode); + + int getProSortNo(ProOrder proOrder); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 0f839de1..e4ad8417 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -27,6 +27,7 @@ import com.op.plan.domain.dto.SplitOrderDTO; import com.op.plan.mapper.*; import com.op.system.api.RemoteSapService; import com.op.system.api.RemoteUserService; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.SysUser; import com.op.system.api.domain.sap.SapShopOrderQuery; import com.op.system.api.model.SapProOrder; @@ -130,7 +131,7 @@ public class ProOrderServiceImpl implements IProOrderService { // 如果不重复 if (checkout) { - // 如果是白坯订单 + /****白坯订单*****/ if (splitOrderDTO.getProduct().getProdType().equals("white")){ boolean flag = false; @@ -180,7 +181,11 @@ public class ProOrderServiceImpl implements IProOrderService { proOrderMapper.updateWhiteOrder(proOrder); // 设置工单通用属性 - ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode()); + ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute( + proOrder, splitOrderDTO.getProductDate(), + splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), + splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo() + ); // 设置批次表通用信息 ProOrderWorkorderBatch proOrderWorkorderBatch = setCommonBatchAttribute(); // 设置工单 @@ -197,7 +202,7 @@ public class ProOrderServiceImpl implements IProOrderService { proOrderWorkorder.setEndFlag(1); proOrderWorkorder.setCarNum(splitOrderDTO.getCarNum()); - // 插入工单 + // 插入工单/**pro_order_workorder**/ proOrderWorkorderMapper.insertProOrderWorkorder(proOrderWorkorder); setBatch(proOrderWorkorderBatch,splitOrderDTO.getFormFields(),proOrderWorkorder.getWorkorderId(),1L); @@ -234,12 +239,16 @@ public class ProOrderServiceImpl implements IProOrderService { return success(); - }else { + }else {/****成品订单*****/ // 创建订单对象,并将信息copy进去 ProOrder proOrder = new ProOrder(); BeanUtils.copyProperties(splitOrderDTO.getProduct(), proOrder); // 设置工单通用属性 - ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(proOrder, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), splitOrderDTO.getRouteCode()); + ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute( + proOrder, splitOrderDTO.getProductDate(), + splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(), + splitOrderDTO.getRouteCode(),splitOrderDTO.getSortNo() + ); // 创建批次表通用对象 ProOrderWorkorderBatch workBatch = setCommonBatchAttribute(); // code @@ -262,12 +271,9 @@ public class ProOrderServiceImpl implements IProOrderService { workOrder.setWorkorderCode(proOrder.getOrderCode() + "-" + endCode); // 3.设置父工单 workOrder.setParentOrder(parentOrder.toString()); - // 工单对应车数-白坯订单操作 -// if (proOrder.getProdType().equals("white")) { -// int everyNum = (int) Math.ceil(proOrder.getQuantity() / proOrder.getCarNum()); -// int carNum = (int) Math.ceil(splitOrderDTO.getSplitNum() / everyNum); -// workOrder.setCarNum(carNum); -// } + + workOrder.setSortNo(splitOrderDTO.getSortNo()); + // 将工单信息更新至数据库 proOrderWorkorderMapper.insertProOrderWorkorder(workOrder); // 生成批次表信息并更新至数据库 @@ -295,34 +301,6 @@ public class ProOrderServiceImpl implements IProOrderService { } } } - - - // 关闭订单,判断是否拆分完成 -// ProOrder order = proOrderMapper.selectProOrderById(splitOrderDTO.getProduct().getId()); -// Long quantitySplit = order.getQuantitySplit(); -// Long quantity1 = order.getQuantity(); -// if (quantity1.equals(quantitySplit)) { -// // 需要关闭订单的codeList -// List orderCodes = new ArrayList<>(); -// // 临时存放code -// StringBuilder orderCode = new StringBuilder(); -// orderCode.append(order.getOrderCode()); -// while(true) { -// orderCodes.add(orderCode.toString()); -// String selectOrderCode = proOrderMapper.selectChildProOrderCodeByCode(orderCode.toString()); -// if (selectOrderCode == null) { -// break; -// } -// orderCode.setLength(0); -// orderCode.append(selectOrderCode); -// } -// -// // 关闭订单 -// for (String code : orderCodes) { -// remoteSapService.sapCloseOrder(code); -// } -// -// } return success(); } @@ -418,32 +396,39 @@ public class ProOrderServiceImpl implements IProOrderService { */ @Override @DS("#header.poolName") - public AjaxResult syncSAP() { + public void syncSAP() { SapShopOrderQuery sapqo = new SapShopOrderQuery(); // sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4)); // //获取当前所选工厂 -// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); -// String key = "#header.poolName"; -// sapqo.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + sapqo.setWerk(request.getHeader(key.substring(8)).replace("ds_","")); + SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); if(maxCreateTime == null ){ sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如:20230923 }else{ sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 } + + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(sapqo.toString()); + sysSapLog.setMethod("syncSAP"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + proOrderMapper.addSapLog(sysSapLog); + //取>=20230923的sap数据 R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 - if(rSapProOrder == null){ - return AjaxResult.error("无"+sapqo.getErdat()+"之后的最新订单"); - } - List newOrders = rSapProOrder.getData(); - - - syncSAPFunc(newOrders,SecurityUtils.getUsername()); - - return success(); + if(CollectionUtils.isEmpty(newOrders)){ + System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + }else { + syncSAPFunc(newOrders, "Job"); + } } public String syncSAPFunc(List newOrders,String syncUser){ @@ -687,6 +672,12 @@ public class ProOrderServiceImpl implements IProOrderService { return success(proOrderVO); } + @Override + @DS("#header.poolName") + public int getProSortNo(ProOrder proOrder) { + return proOrderWorkorderMapper.getProSortNo(proOrder); + } + public void getSAPOrderByFactory(String poolName) { DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key // SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime(); @@ -703,12 +694,22 @@ public class ProOrderServiceImpl implements IProOrderService { sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 } + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(sapqo.toString()); + sysSapLog.setMethod("shopOrderSync"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + proOrderMapper.addSapLog(sysSapLog); + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo); List newOrders = rSapProOrder.getData(); if(CollectionUtils.isEmpty(newOrders)){ - logger.error("无"+sapqo.getErdat()+"之后的最新订单"); + System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + }else { + syncSAPFunc(newOrders, "Job"); } - syncSAPFunc(newOrders,"Job"); } /** @@ -827,7 +828,7 @@ public class ProOrderServiceImpl implements IProOrderService { * @param proOrder * @return */ - private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode) { + private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId, String routeCode, Integer orderNum) { ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder(); // 更新者 proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName()); @@ -847,6 +848,8 @@ public class ProOrderServiceImpl implements IProOrderService { proOrderWorkorder.setProductSpc(proOrder.getProdSpc()); // 产线 proOrderWorkorder.setProdLineCode(proLineCode); + // 产线 + proOrderWorkorder.setOrderNum(orderNum); // 班次 proOrderWorkorder.setShiftId(shiftId); // TODO 产品类型(pro_type) @@ -873,7 +876,7 @@ public class ProOrderServiceImpl implements IProOrderService { proOrder.setUpdateBy(SecurityContextHolder.getUserName()); proOrder.setUpdateTime(date); // 订单状态逻辑 - if (proOrder.getQuantity().longValue() == (proOrder.getQuantitySplit().longValue() + Long.valueOf(proOrder.getAtrr1()))) { + if (proOrder.getQuantity().longValue() == proOrder.getQuantitySplit().longValue()) { // 已拆分 proOrder.setStatus("o2"); }else { @@ -897,6 +900,7 @@ public class ProOrderServiceImpl implements IProOrderService { proOrderWorkorder.setQuantitySplit(Long.valueOf(proOrder.getAtrr1())); // 设置工单产品类型 proOrderWorkorder.setProdType(proOrder.getOrderType()); + return proOrderWorkorder; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index df172021..bc6e778c 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -17,6 +17,7 @@ import com.op.plan.domain.vo.CascaderDTO; import com.op.plan.mapper.*; import com.op.plan.service.IProOrderWorkorderService; import com.op.system.api.RemoteSapService; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.dto.MesPrepareDTO; import com.op.system.api.domain.dto.MesPrepareDetailDTO; import com.op.system.api.domain.sap.SapCreateOrder; @@ -96,12 +97,11 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { Map equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 for (int c = 0; c < codeArray.size(); c++) { String equipCode = codeArray.getJSONArray(c).getString(1); - prodLineName += equipMap.get(equipCode).getLabel() + ","; + CascaderDTO eInfo = equipMap.get(equipCode); + if(eInfo != null){ + prodLineName += eInfo.getLabel() + ","; + } } -// Set keys = equipMap.keySet(); -// for (String key : keys) { -// prodLineName += equipMap.get(key).getLabel() + ","; -// } workorder.setProdLineName(prodLineName); // // 通过设备code查询出机型名称 @@ -264,6 +264,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//开始时间 sap.setDatee(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//完成时间 sapList.add(sap); + + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(sapList.toString()); + sysSapLog.setMethod("downProOrderWorkorderByWorkorderIds"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + proOrderMapper.addSapLog(sysSapLog); + R> r = remoteSapService.SapCreateOrder(sapList); logger.info("sap工单回传:" + r.getMsg()); if (500 == r.getCode()) { diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index e51f9e40..252b3d60 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -256,6 +256,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GETDATE(), + + insert into sys_sap_log + (id,messsge,create_time,reqcode,method,remark,status) + values( + #{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status}) + update pro_order @@ -292,8 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update pro_order - quantity_split += #{atrr1}, - quantity_split = #{atrr1}, + quantity_split = #{quantitySplit}, update_by = #{updateBy}, update_time = #{updateTime}, status = #{status}, diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 692a4adf..694a8a40 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -37,13 +37,14 @@ + select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time, prod_type, factory_code , end_flag , car_num + update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no from pro_order_workorder @@ -201,6 +202,7 @@ factory_code, end_flag, car_num, + sort_no, #{workorderId}, @@ -235,6 +237,7 @@ #{factoryCode}, #{endFlag}, #{carNum}, + #{sortNo}, @@ -341,6 +344,10 @@ where order_id = #{orderId} and del_flag = '0' + insert into mes_prepare_detail @@ -422,7 +429,7 @@ update pro_order_workorder set del_flag = '1' - where order_id in + where workorder_id in #{workorderId} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java new file mode 100644 index 00000000..e428cd02 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java @@ -0,0 +1,186 @@ +package com.op.quality.controller; + +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.poi.ExcelUtil; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.web.page.TableDataInfo; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.QcBomComponent; +import com.op.quality.domain.QcCheckTaskDetail; +import com.op.quality.domain.QcCheckReportIncome; +import com.op.quality.domain.QcSupplier; +import com.op.quality.service.IQcCheckReportIncomeService; +import com.op.system.api.domain.SysUser; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * 来料检验Controller + * + * @author Open Platform + * @date 2023-10-19 + */ +@RestController +@RequestMapping("/qcIncomeReport") +public class QcCheckReportIncomeController extends BaseController { + @Autowired + private IQcCheckReportIncomeService qcCheckReportIncomeService; + + /** + * 查询来料检验列表 + */ + @RequiresPermissions("quality:qcIncomeReport:list") + @GetMapping("/list") + public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) { + + //默认时间范围T 00:00:00~T+1 00:00:00 + /*if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ + qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + LocalDate date = LocalDate.now(); + LocalDate dateEnd = date.plusDays(1); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateEndStr = dtf.format(dateEnd)+" 00:00:00"; + qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + }*/ + +// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ +// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start +// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end +// } + + startPage(); + List list = qcCheckReportIncomeService.selectQcCheckReportIncomeList(qcCheckReportIncome); + return getDataTable(list); + } + + /** + * 导出来料检验列表 + */ + @RequiresPermissions("quality:qcIncomeReport:export") + @Log(title = "来料检验", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) { + + //默认时间范围T 00:00:00~T+1 00:00:00 + if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ + qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + LocalDate date = LocalDate.now(); + LocalDate dateEnd = date.plusDays(1); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateEndStr = dtf.format(dateEnd)+" 00:00:00"; + qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + } + +// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ +// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start +// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end +// } + + List list = qcCheckReportIncomeService.selectQcCheckReportIncomeList(qcCheckReportIncome); + ExcelUtil util = new ExcelUtil(QcCheckReportIncome.class); + util.exportExcel(response, list, "来料检验数据"); + } + + /** + * 获取来料检验详细信息 + */ + @RequiresPermissions("quality:qcIncomeReport:query") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") String recordId) { + return success(qcCheckReportIncomeService.selectQcCheckReportIncomeByRecordId(recordId)); + } + + /** + * 新增来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:add") + @Log(title = "来料检验", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + int r = qcCheckReportIncomeService.insertQcCheckReportIncome(qcCheckReportIncome); + if(r>0){ + return toAjax(r); + } + return error("添加失败:请检查物料的关联检测项"); + } + + /** + * 修改来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:edit") + @Log(title = "来料检验", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + return toAjax(qcCheckReportIncomeService.updateQcCheckReportIncome(qcCheckReportIncome)); + } + + /** + * 删除来料检验 + */ + @RequiresPermissions("quality:qcIncomeReport:remove") + @Log(title = "来料检验", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable String[] recordIds) { + return toAjax(qcCheckReportIncomeService.deleteQcCheckReportIncomeByRecordIds(recordIds)); + } + + /** + * 查询BOM物料管理列表 + */ + @GetMapping("/getQcListBom") + public TableDataInfo getQcListBom(QcBomComponent bomComponent) { + startPage(); + List list = qcCheckReportIncomeService.getQcListBom(bomComponent); + return getDataTable(list); + } + /** + * 查询供应商列表 + */ + @GetMapping("/getQcListSupplier") + public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) { + startPage(); + List list = qcCheckReportIncomeService.getQcListSupplier(qcSupplier); + return getDataTable(list); + } + /** + * 查询人员列表 + */ + @GetMapping("/getQcListUser") + public TableDataInfo getQcListUser(SysUser sysUser) { + startPage(); + List list = qcCheckReportIncomeService.getQcListUser(sysUser); + return getDataTable(list); + } + + /** + * 状态修改 + */ + @PutMapping("/changeIncomeStatus") + public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername()); + qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate()); + return toAjax(qcCheckReportIncomeService.updateIncomeStatus(qcCheckReportIncome)); + } + + /** + * 检验项目弹窗列表 + * @param + * @return + */ + @GetMapping("/getCkeckProjectList") + public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + startPage(); + List list = qcCheckReportIncomeService.getCkeckProjectList(qcCheckTaskDetail); + return getDataTable(list); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java index bb84c5fa..b067368e 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTypeController.java @@ -2,6 +2,8 @@ package com.op.quality.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.quality.domain.QcCheckReportIncome; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -72,7 +74,12 @@ public class QcCheckTypeController extends BaseController { @Log(title = "检验节点维护", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody QcCheckType qcCheckType) { - return toAjax(qcCheckTypeService.insertQcCheckType(qcCheckType)); + QcCheckType valiData = qcCheckTypeService.selectQcCheckTypeById(qcCheckType.getOrderCode()); + if (valiData != null){ + return AjaxResult.error("节点编码已存在,请重新输入!"); + }else { + return toAjax(qcCheckTypeService.insertQcCheckType(qcCheckType)); + } } /** diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java new file mode 100644 index 00000000..af6b9441 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java @@ -0,0 +1,376 @@ +package com.op.quality.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 来料检验对象 qc_check_task_income + * + * @author Open Platform + * @date 2023-10-19 + */ +public class QcCheckReportIncome extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id */ + private String recordId; + + /** 检验任务编号 */ + @Excel(name = "检验任务编号") + private String checkNo; + + /** 来料批次号 */ + @Excel(name = "来料批次号") + private String incomeBatchNo; + + /** 订单号 */ + @Excel(name = "订单号") + private String orderNo; + + /** 物料号 */ + @Excel(name = "物料号") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 收货数量 */ + @Excel(name = "收货数量") + private BigDecimal quality; + + /** 单位 */ + @Excel(name = "单位") + private String unit; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String supplierCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String supplierName; + + /** 来料时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "来料时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date incomeTime; + + /** 检测地点 */ + @Excel(name = "检测地点") + private String checkLoc; + + /** 检测状态 */ + @Excel(name = "检测状态") + private String checkStatus; + + /** 检测人工号 */ + @Excel(name = "检测人工号") + private String checkManCode; + + /** 检测人姓名 */ + @Excel(name = "检测人姓名") + private String checkManName; + + /** 检验时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "检验时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date checkTime; + + /** 检验结果Y合格 */ + @Excel(name = "检验结果Y合格") + private String checkResult; + + /** 是否启用1启用0停用 */ + @Excel(name = "是否启用1启用0停用") + private String status; + + /** 预留字段1 */ + //@Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + //@Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + //@Excel(name = "预留字段3") + private String attr3; + + /** 预留字段4 */ + //@Excel(name = "预留字段4") + private String attr4; + + /** 工厂编码 */ + @Excel(name = "工厂编码") + private String factoryCode; + + /** 删除标识1删除0正常 */ + private String delFlag; + + private String incomeTimeStart; + private String incomeTimeEnd; + private String checkTimeStart; + private String checkTimeEnd; + private String typeCode; + private String checkType; + + + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public String getIncomeTimeStart() { + return incomeTimeStart; + } + + public void setIncomeTimeStart(String incomeTimeStart) { + this.incomeTimeStart = incomeTimeStart; + } + + public String getIncomeTimeEnd() { + return incomeTimeEnd; + } + + public void setIncomeTimeEnd(String incomeTimeEnd) { + this.incomeTimeEnd = incomeTimeEnd; + } + + public String getCheckTimeStart() { + return checkTimeStart; + } + + public void setCheckTimeStart(String checkTimeStart) { + this.checkTimeStart = checkTimeStart; + } + + public String getCheckTimeEnd() { + return checkTimeEnd; + } + + public void setCheckTimeEnd(String checkTimeEnd) { + this.checkTimeEnd = checkTimeEnd; + } + + public void setRecordId(String recordId) { + this.recordId = recordId; + } + + public String getRecordId() { + return recordId; + } + public void setCheckNo(String checkNo) { + this.checkNo = checkNo; + } + + public String getCheckNo() { + return checkNo; + } + public void setIncomeBatchNo(String incomeBatchNo) { + this.incomeBatchNo = incomeBatchNo; + } + + public String getIncomeBatchNo() { + return incomeBatchNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getOrderNo() { + return orderNo; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + public void setQuality(BigDecimal quality) { + this.quality = quality; + } + + public BigDecimal getQuality() { + return quality; + } + public void setUnit(String unit) { + this.unit = unit; + } + + public String getUnit() { + return unit; + } + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierCode() { + return supplierCode; + } + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierName() { + return supplierName; + } + public void setIncomeTime(Date incomeTime) { + this.incomeTime = incomeTime; + } + + public Date getIncomeTime() { + return incomeTime; + } + public void setCheckLoc(String checkLoc) { + this.checkLoc = checkLoc; + } + + public String getCheckLoc() { + return checkLoc; + } + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public String getCheckStatus() { + return checkStatus; + } + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } + + public String getCheckManCode() { + return checkManCode; + } + public void setCheckManName(String checkManName) { + this.checkManName = checkManName; + } + + public String getCheckManName() { + return checkManName; + } + public void setCheckTime(Date checkTime) { + this.checkTime = checkTime; + } + + public Date getCheckTime() { + return checkTime; + } + public void setCheckResult(String checkResult) { + this.checkResult = checkResult; + } + + public String getCheckResult() { + return checkResult; + } + public void setStatus(String status) { + this.status = status; + } + + public String getStatus() { + return status; + } + 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 setAttr4(String attr4) { + this.attr4 = attr4; + } + + public String getAttr4() { + return attr4; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + 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("recordId", getRecordId()) + .append("checkNo", getCheckNo()) + .append("incomeBatchNo", getIncomeBatchNo()) + .append("orderNo", getOrderNo()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("quality", getQuality()) + .append("unit", getUnit()) + .append("supplierCode", getSupplierCode()) + .append("supplierName", getSupplierName()) + .append("incomeTime", getIncomeTime()) + .append("checkLoc", getCheckLoc()) + .append("checkStatus", getCheckStatus()) + .append("checkManCode", getCheckManCode()) + .append("checkManName", getCheckManName()) + .append("checkTime", getCheckTime()) + .append("checkResult", getCheckResult()) + .append("status", getStatus()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("factoryCode", getFactoryCode()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java index efbd9d4a..9df23bee 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckUnqualified.java @@ -1,10 +1,13 @@ package com.op.quality.domain; +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; +import java.util.Date; + /** * 不合格处理对象 qc_check_unqualified * @@ -61,6 +64,173 @@ public class QcCheckUnqualified extends BaseEntity { private String type; + private String checkType; + private String checkName; + private String checkNo; + private String incomeBatchNo; + private String orderNo; + private String materialCode; + private String materialName; + private String quality; + private String unit; + private String supplierCode; + private String supplierName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "检验时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date incomeTime; + private String checkLoc; + private String checkStatus; + private String checkManCode; + private String checkManName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "检验时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private String checkTime; + private String checkResult; + + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + + public String getCheckName() { + return checkName; + } + + public void setCheckName(String checkName) { + this.checkName = checkName; + } + + public String getCheckNo() { + return checkNo; + } + + public void setCheckNo(String checkNo) { + this.checkNo = checkNo; + } + + public String getIncomeBatchNo() { + return incomeBatchNo; + } + + public void setIncomeBatchNo(String incomeBatchNo) { + this.incomeBatchNo = incomeBatchNo; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getQuality() { + return quality; + } + + public void setQuality(String quality) { + this.quality = quality; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public Date getIncomeTime() { + return incomeTime; + } + + public void setIncomeTime(Date incomeTime) { + this.incomeTime = incomeTime; + } + + public String getCheckLoc() { + return checkLoc; + } + + public void setCheckLoc(String checkLoc) { + this.checkLoc = checkLoc; + } + + public String getCheckStatus() { + return checkStatus; + } + + public void setCheckStatus(String checkStatus) { + this.checkStatus = checkStatus; + } + + public String getCheckManCode() { + return checkManCode; + } + + public void setCheckManCode(String checkManCode) { + this.checkManCode = checkManCode; + } + + public String getCheckManName() { + return checkManName; + } + + public void setCheckManName(String checkManName) { + this.checkManName = checkManName; + } + + public String getCheckTime() { + return checkTime; + } + + public void setCheckTime(String checkTime) { + this.checkTime = checkTime; + } + + public String getCheckResult() { + return checkResult; + } + + public void setCheckResult(String checkResult) { + this.checkResult = checkResult; + } + public String getType() { return type; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java new file mode 100644 index 00000000..7c6e169d --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckReportIncomeMapper.java @@ -0,0 +1,77 @@ +package com.op.quality.mapper; + +import com.op.quality.domain.QcBomComponent; +import com.op.quality.domain.QcCheckReportIncome; +import com.op.quality.domain.QcCheckTaskDetail; +import com.op.quality.domain.QcSupplier; +import com.op.system.api.domain.SysUser; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 检验报告来料Mapper接口 + * + * @author Open Platform + * @date 2023-10-19 + */ +@Mapper +public interface QcCheckReportIncomeMapper { + /** + * 查询来料报告 + * + * @param recordId 来料检验主键 + * @return 来料检验 + */ + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId); + + /** + * 查询来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 来料检验集合 + */ + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome); + + /** + * 新增来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 修改来料报告 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 删除来料报告 + * + * @param recordId 来料检验主键 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordId(String recordId); + + /** + * 批量删除来料报告 + * + * @param recordIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds); + + public List getQcListBom(QcBomComponent bomComponent); + + public List getQcListSupplier(QcSupplier qcSupplier); + + public List getQcListUser(SysUser sysUser); + + int getTodayMaxNum(QcCheckReportIncome qcCheckReportIncome); + + List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java new file mode 100644 index 00000000..7206e83b --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportIncomeService.java @@ -0,0 +1,74 @@ +package com.op.quality.service; + +import com.op.quality.domain.*; +import com.op.system.api.domain.SysUser; + +import java.util.List; + +/** + * 来料报告Service接口 + * + * @author Open Platform + * @date 2023-10-19 + */ +public interface IQcCheckReportIncomeService { + /** + * 查询来料报告 + * + * @param recordId 来料报告主键 + * @return 来料检验 + */ + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId); + + /** + * 查询来料报告列表 + * + * @param qcCheckReportIncome 来料报告 + * @return 来料检验集合 + */ + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome); + + /** + * 新增来料报告 + * + * @param qcCheckReportIncome 来料报告 + * @return 结果 + */ + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 修改来料报告 + * + * @param qcCheckReportIncome 来料报告 + * @return 结果 + */ + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 批量删除来料报告 + * + * @param recordIds 需要删除的来料报告主键集合 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds); + + /** + * 删除来料报告信息 + * + * @param recordId 来料报告主键 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordId(String recordId); + + public List getQcListBom(QcBomComponent bomComponent); + + public List getQcListSupplier(QcSupplier qcSupplier); + + public List getQcListUser(SysUser sysUser); + + int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome); + + List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail); + + public List getPrintData(QcCheckReportIncome qcCheckReportIncome); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index dbf6ab7f..aa4c805a 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -16,6 +16,7 @@ import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.quality.service.IQcCheckTaskIncomeService; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -99,12 +100,6 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTaskIncome.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_income**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskIncome.setRecordId(beLongId); - qcCheckTaskIncome.setFactoryCode(factoryCode); - qcCheckTaskIncome.setCreateTime(nowDate); - qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); @@ -127,6 +122,13 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskIncome.setRecordId(beLongId); + qcCheckTaskIncome.setFactoryCode(factoryCode); + qcCheckTaskIncome.setCreateTime(nowDate); + qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java index 8c21e88b..c8b075cc 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java @@ -99,13 +99,6 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService qcCheckTaskProduce.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_produce**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskProduce.setRecordId(beLongId); - qcCheckTaskProduce.setFactoryCode(factoryCode); - qcCheckTaskProduce.setCreateTime(nowDate); - qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); - /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); qctp.setTypeId(qcCheckTaskProduce.getCheckType());//生产过程检验 @@ -127,6 +120,13 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskProduce.setRecordId(beLongId); + qcCheckTaskProduce.setFactoryCode(factoryCode); + qcCheckTaskProduce.setCreateTime(nowDate); + qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java index c278f5dd..95a810f3 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java @@ -100,13 +100,6 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin qcCheckTaskWarehousing.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_warehousing**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskWarehousing.setRecordId(beLongId); - qcCheckTaskWarehousing.setFactoryCode(factoryCode); - qcCheckTaskWarehousing.setCreateTime(nowDate); - qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing); - /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); qctp.setTypeId(qcCheckTaskWarehousing.getCheckType());//生产过程检验 @@ -128,6 +121,13 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskWarehousing.setRecordId(beLongId); + qcCheckTaskWarehousing.setFactoryCode(factoryCode); + qcCheckTaskWarehousing.setCreateTime(nowDate); + qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java new file mode 100644 index 00000000..d60f4283 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckReportIncomeServiceImpl.java @@ -0,0 +1,201 @@ +package com.op.quality.service.serviceImpl; + +import com.alibaba.fastjson2.JSONArray; +import com.baomidou.dynamic.datasource.annotation.DS; +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.quality.domain.*; +import com.op.quality.mapper.*; +import com.op.quality.service.IQcCheckReportIncomeService; +import com.op.system.api.domain.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * 来料检验Service业务层处理 + * + * @author Open Platform + * @date 2023-10-19 + */ +@Service +public class QcCheckReportIncomeServiceImpl implements IQcCheckReportIncomeService { + @Autowired + private QcCheckReportIncomeMapper qcCheckReportIncomeMapper; + + @Autowired + private QcCheckTypeProjectMapper qcCheckTypeProjectMapper; + + @Autowired + private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper; + + @Autowired + private QcCheckTaskDetailMapper qcCheckTaskDetailMapper; + + /** + * 查询来料检验 + * + * @param recordId 来料检验主键 + * @return 来料检验 + */ + @Override + @DS("#header.poolName") + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId) { + return qcCheckReportIncomeMapper.selectQcCheckReportIncomeByRecordId(recordId); + } + + /** + * 查询来料检验列表 + * + * @param qcCheckReportIncome 来料检验 + * @return 来料检验 + */ + @Override + @DS("#header.poolName") + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setDelFlag("0"); + return qcCheckReportIncomeMapper.selectQcCheckReportIncomeList(qcCheckReportIncome); + } + + /** + * 新增来料检验 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) { + + String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + int liushuiNum = qcCheckReportIncomeMapper.getTodayMaxNum(qcCheckReportIncome); + String liushuiStr = String.format("%04d", liushuiNum); + + String createBy = SecurityUtils.getUsername(); + Date nowDate= DateUtils.getNowDate(); + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + + qcCheckReportIncome.setCheckNo(bpDD+liushuiStr); + + /**qc_check_task_income**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckReportIncome.setRecordId(beLongId); + qcCheckReportIncome.setFactoryCode(factoryCode); + qcCheckReportIncome.setCreateTime(nowDate); + qcCheckReportIncomeMapper.insertQcCheckReportIncome(qcCheckReportIncome); + + /**取检测项**/ + QcCheckTypeProject qctp= new QcCheckTypeProject(); + qctp.setTypeId(qcCheckReportIncome.getCheckType());//生产过程检验 + qctp.setMaterialCode(qcCheckReportIncome.getMaterialCode());//特性 + /**qc_check_type_project**/ + List items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp); + if(CollectionUtils.isEmpty(items)){ + /**qc_material_group_detail**/ + QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckReportIncome.getMaterialCode()); + if(group == null){ + return 0;//没有找到检测项目 + } + qctp.setGroupId(group.getGroupId());//共性 + items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp); + } + + /**qc_check_task_detail**/ + if(CollectionUtils.isEmpty(items)){ + return 0;//没有找到检测项目 + } + + for(QcCheckTaskDetail item:items){ + item.setRecordId(IdUtils.fastSimpleUUID()); + item.setBelongTo(beLongId); + item.setCreateTime(nowDate); + item.setCreateBy(createBy); + item.setFactoryCode(factoryCode); + item.setStatus("N"); + } + return qcCheckTaskDetailMapper.addBatch(items); + } + + /** + * 修改来料检验 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate()); + return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome); + } + + /** + * 批量删除来料检验 + * + * @param recordIds 需要删除的来料检验主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds) { + return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordIds(recordIds); + } + + /** + * 删除来料检验信息 + * + * @param recordId 来料检验主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcCheckReportIncomeByRecordId(String recordId) { + return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordId(recordId); + } + + @Override + @DS("#header.poolName") + public List getQcListBom(QcBomComponent bomComponent) { + return qcCheckReportIncomeMapper.getQcListBom(bomComponent); + } + + @Override + @DS("#header.poolName") + public List getQcListSupplier(QcSupplier qcSupplier) { + return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier); + } + + //在公共库里不需要切库 + @Override + public List getQcListUser(SysUser sysUser) { + return qcCheckReportIncomeMapper.getQcListUser(sysUser); + } + + @Override + @DS("#header.poolName") + public int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome) { + return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome); + } + + @Override + @DS("#header.poolName") + public List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail); + } + + @Override + public List getPrintData(QcCheckReportIncome qcCheckReportIncome) { + return null; + } + +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java index 0d023254..e75c29b2 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/serviceImpl/QcCheckTypeServiceImpl.java @@ -62,7 +62,7 @@ public class QcCheckTypeServiceImpl implements IQcCheckTypeService { @DS("#header.poolName") public int insertQcCheckType(QcCheckType qcCheckType) { if (StringUtils.isNotBlank(qcCheckType.getCheckName())){ - qcCheckType.setId(IdUtils.fastSimpleUUID()); + qcCheckType.setId(qcCheckType.getOrderCode()); qcCheckType.setCreateBy(SecurityUtils.getUsername()); qcCheckType.setCreateTime(DateUtils.getNowDate()); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml index d8a447ef..515f9b92 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckProjectMapper.xml @@ -120,6 +120,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml new file mode 100644 index 00000000..bc241d47 --- /dev/null +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select record_id, check_no, income_batch_no, order_no, material_code, material_name, quality, unit, supplier_code, supplier_name, income_time, check_loc, check_status, check_man_code, check_man_name, check_time, check_result, status, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_task + + + + + + + + + + + + + + + + + + insert into qc_check_task + + record_id, + check_no, + income_batch_no, + order_no, + material_code, + material_name, + quality, + unit, + supplier_code, + supplier_name, + income_time, + check_loc, + check_status, + check_man_code, + check_man_name, + check_time, + check_result, + status, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + factory_code, + del_flag, + + + #{recordId}, + #{checkNo}, + #{incomeBatchNo}, + #{orderNo}, + #{materialCode}, + #{materialName}, + #{quality}, + #{unit}, + #{supplierCode}, + #{supplierName}, + #{incomeTime}, + #{checkLoc}, + #{checkStatus}, + #{checkManCode}, + #{checkManName}, + #{checkTime}, + #{checkResult}, + #{status}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{factoryCode}, + #{delFlag}, + + + + + update qc_check_task + + check_no = #{checkNo}, + income_batch_no = #{incomeBatchNo}, + order_no = #{orderNo}, + material_code = #{materialCode}, + material_name = #{materialName}, + quality = #{quality}, + unit = #{unit}, + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + income_time = #{incomeTime}, + check_loc = #{checkLoc}, + check_status = #{checkStatus}, + check_man_code = #{checkManCode}, + check_man_name = #{checkManName}, + check_time = #{checkTime}, + check_result = #{checkResult}, + status = #{status}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + factory_code = #{factoryCode}, + del_flag = #{delFlag}, + + where record_id = #{recordId} + + + + delete from qc_check_task where record_id = #{recordId} + + + + delete from qc_check_task where record_id in + + #{recordId} + + + diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml index 020febbb..ff946001 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml @@ -29,29 +29,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from qc_check_unqualified - + select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark, + qcu.create_time createTime, + qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo, + qct.material_code materialCode,qct.material_name materialName,qct.quality,qct.unit,qct.supplier_code supplierCode, + qct.supplier_name supplierName,qct.income_time incomeTime,qct.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode, + qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult + from qc_check_unqualified qcu + left join qc_check_task qct on qcu.task_id = qct.record_id + left join qc_check_type qtn on qtn.id = qct.check_type and task_id like concat('%', #{taskId}, '%') and status = #{status} + and qct.order_no like concat('%', #{orderNo}, '%') + and qct.check_no like concat('%', #{checkNo}, '%') and next_node_code = #{nextNodeCode} and next_node_name like concat('%', #{nextNodeName}, '%') - and attr1 = #{attr1} - and attr2 = #{attr2} - and attr3 = #{attr3} - and attr4 = #{attr4} - and del_flag = #{delFlag} - and CONVERT(varchar(30),create_time, 120) >= #{checkTimeStart} - and #{checkTimeEnd} > CONVERT(varchar(30),create_time, 120) - and factory_code = #{factoryCode} + and qct.material_code like concat('%', #{materialCode}, '%') + and qct.material_name like concat('%', #{materialName}, '%') + and qcu.del_flag = '0' + and CONVERT(varchar(30),qct.check_time, 120) >= #{checkTimeStart} + and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_time, 120) + - + select qcu.id,qcu.task_id taskId,qcu.status,qcu.next_node_code nextNodeCode,qcu.next_node_name nextNodeName,qcu.remark, + qcu.create_time createTime, + qct.check_type checkType,qtn.check_name checkName,qct.check_no checkNo,qct.income_batch_no incomeBatchNo,qct.order_no orderNo, + qct.material_code materialCode,qct.material_name materialName,qct.quality,qct.unit,qct.supplier_code supplierCode, + qct.supplier_name supplierName,qct.income_time incomeTime,qct.check_loc checkLoc,qct.check_status checkStatus,qct.check_man_code checkManCode, + qct.check_man_name checkManName,qct.check_time checkTime,qct.check_result checkResult + from qc_check_unqualified qcu + left join qc_check_task qct on qcu.task_id = qct.record_id + left join qc_check_type qtn on qtn.id = qct.check_type + where qcu.id = #{id} diff --git a/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml b/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml index dcc8b5bf..a0af3125 100644 --- a/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml +++ b/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml @@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from pro_route_product pp where pp.route_id = #{routeId} ) - and bp.product_desc_zh like concat('%', #{itemName}, '%') - + and (bp.product_desc_zh like concat('%', #{itemName}, '%') + or bp.product_code like concat('%', #{itemName}, '%')) @@ -81,7 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from pro_route_product pp left join base_product bp on pp.item_code = bp.product_code where pp.route_id = #{routeId} - and bp.product_desc_zh like concat('%', #{itemName}, '%') + and (bp.product_desc_zh like concat('%', #{itemName}, '%') + or bp.product_code like concat('%', #{itemName}, '%'))