diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/QmsConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/QmsConstants.java index f72c880..c2fde69 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/QmsConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/QmsConstants.java @@ -34,4 +34,8 @@ public class QmsConstants { public static final String QMS_CHECK_PROJECT_STATUS_FAIL = "0";//不合格 + /**质检工单实例节点处理状态*/ + public static final String QMS_PROCESS_HANDLE_STATUS_FINISHED = "0";//已结束 + public static final String QMS_PROCESS_HANDLE_STATUS_EXECUTING = "1";//执行中 + } diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WfConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WfConstants.java new file mode 100644 index 0000000..3186451 --- /dev/null +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/WfConstants.java @@ -0,0 +1,24 @@ +package com.hw.common.core.constant; + +/** + * @Description:工单常量定义 + * @ProjectName:HwMes + * @Author:xins + * @Date:2024-03-11 10:42 + * @Version:1.0 + */ +public class WfConstants { + + public static final Long WF_QUALITY_ABNORMAL_PROCESS_ID = 301L; + + /**质检工单实例状态*/ + public static final String WF_INSTANCE_STATUS_START = "1";//已启动 + public static final String WF_INSTANCE_STATUS_FINISH = "3";//已结束 + + /**质检工单实例节点状态*/ + public static final String WF_PROCESS_HANDLE_STATUS_FINISH = "0";//已结束 + + + /**质检文件关联类型*/ + public static final String QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY = "1";//质检工单实例节点 +} diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/controller/QmsMobileController.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/controller/QmsMobileController.java index bf6f5c5..da58c13 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/controller/QmsMobileController.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/controller/QmsMobileController.java @@ -1,6 +1,10 @@ package com.hw.qms.controller; import com.hw.common.core.constant.QmsConstants; +import com.hw.common.core.constant.SecurityConstants; +import com.hw.common.core.constant.WfConstants; +import com.hw.common.core.constant.WmsConstants; +import com.hw.common.core.domain.R; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.web.controller.BaseController; import com.hw.common.core.web.domain.AjaxResult; @@ -11,10 +15,21 @@ import com.hw.common.security.annotation.RequiresPermissions; import com.hw.qms.domain.*; import com.hw.qms.domain.vo.QmsCheckResultDetailVo; import com.hw.qms.domain.vo.QmsMaterialCheckVo; +import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo; import com.hw.qms.service.*; +import com.hw.system.api.RemoteFileService; +import com.hw.system.api.RemoteSysCommonService; +import com.hw.system.api.RemoteUserService; +import com.hw.system.api.domain.SysFile; +import com.hw.system.api.domain.common.WfProcessActivity; +import com.hw.system.api.domain.common.vo.WfProcessActivityVo; +import com.hw.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -39,6 +54,10 @@ public class QmsMobileController extends BaseController { private IQmsQualityInstanceService qmsQualityInstanceService; @Autowired private IQmsCheckInstanceFileService qmsCheckInstanceFileService; + @Resource + private RemoteSysCommonService remoteSysCommonService; + @Resource + private RemoteFileService remoteFileService; /** * 扫描物料条码或者通过质检结果详情列表页面点击获取质检结果详情 @@ -142,6 +161,7 @@ public class QmsMobileController extends BaseController { // @RequiresPermissions("qms:checkrule:list") @GetMapping("/getCheckResult4Handle") public AjaxResult getCheckResult4Handle(QmsCheckResult qmsCheckResult) { + //todo:修改工单时,根据用户工单流程步骤权限判断显示哪些 QmsCheckResultDetailVo qmsCheckResultDetailVo = qmsCheckResultDetailService.getCheckResultDetailVo(qmsCheckResult.getCheckResultId()); int batchAmount = mesBaseBarcodeInfoService.selectBarcodeInfoCountByBatchcode(qmsCheckResult.getMaterialBatch()); qmsCheckResultDetailVo.setBatchAmount(batchAmount); @@ -151,18 +171,43 @@ public class QmsMobileController extends BaseController { qmsCheckResultDetailVo.setMaterialName(qmsCheckResult.getMaterialName()); QmsQualityInstance qmsQualityInstance = qmsQualityInstanceService.selectQmsQualityInstanceByCheckResultId(qmsCheckResult.getCheckResultId()); + Long processActivityOrder = 1L; + List qmsQualityInstanceActivities = new ArrayList<>(); if (qmsQualityInstance != null) { - List qmsQualityInstanceActivities = qmsQualityInstance.getQmsQualityInstanceActivityList(); - qmsCheckResultDetailVo.setQmsQualityInstanceActivities(qmsQualityInstanceActivities); + qmsQualityInstanceActivities = qmsQualityInstance.getQmsQualityInstanceActivityList(); + + QmsQualityInstanceActivity lastQualityInstanceActivity = qmsQualityInstanceActivities.get(qmsQualityInstanceActivities.size() - 1); + processActivityOrder = lastQualityInstanceActivity.getProcessStepOrder() + 1;//获取下一步的流程实例步骤 QmsCheckInstanceFile queryCheckInstanceFile = new QmsCheckInstanceFile(); - queryCheckInstanceFile.setTargetType("1"); + queryCheckInstanceFile.setTargetType(WfConstants.QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY); queryCheckInstanceFile.setTargetId(qmsQualityInstance.getQualityInstanceId()); List qmsCheckInstanceFiles = qmsCheckInstanceFileService.selectQmsCheckInstanceFileList(queryCheckInstanceFile); qmsCheckResultDetailVo.setQmsCheckInstanceFiles(qmsCheckInstanceFiles); + } else { + qmsCheckResultDetailVo.setPicEditedAble(true); + } + + WfProcessActivityVo queryProcessActivityVo = new WfProcessActivityVo(); + queryProcessActivityVo.setWfProcessId(WfConstants.WF_QUALITY_ABNORMAL_PROCESS_ID); + queryProcessActivityVo.setProcessActivityOrder(processActivityOrder); + R processActivityResult = remoteSysCommonService.getWfProcessActivityByUI(queryProcessActivityVo, SecurityConstants.INNER); + if (processActivityResult != null) { + WfProcessActivity wfProcessActivity = processActivityResult.getData(); + if (wfProcessActivity != null) { + QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity(); + qmsQualityInstanceActivity.setProcessActivityId(wfProcessActivity.getProcessActivityId()); + qmsQualityInstanceActivity.setProcessHandleStatus(QmsConstants.QMS_PROCESS_HANDLE_STATUS_EXECUTING); + qmsQualityInstanceActivity.setProcessStepOrder(wfProcessActivity.getProcessActivityOrder()); + qmsQualityInstanceActivity.setEditedAble(true); + qmsQualityInstanceActivities.add(qmsQualityInstanceActivity); + } } + qmsCheckResultDetailVo.setQmsQualityInstanceActivities(qmsQualityInstanceActivities); + + return success(qmsCheckResultDetailVo); } @@ -173,8 +218,14 @@ public class QmsMobileController extends BaseController { // @RequiresPermissions("qms:checkresultdetail:add") @Log(title = "质检工单实例", businessType = BusinessType.INSERT) @PostMapping("/handleQualityInstance") - public AjaxResult handleQualityInstance(@RequestBody QmsQualityInstance qmsQualityInstance) { - System.out.println(qmsQualityInstance.getCheckResultId()); - return success(1); + public AjaxResult handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo, + @RequestParam(value = "files") List files) { + List fileUrls = new ArrayList<>(); + for (MultipartFile file : files) { + R sysFileR = remoteFileService.upload(file); + SysFile sysFile = sysFileR.getData(); + fileUrls.add(sysFile.getUrl()); + } + return success(qmsQualityInstanceService.handleQualityInstance(qmsQualityInstanceActivityVo,fileUrls)); } } diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/QmsQualityInstanceActivity.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/QmsQualityInstanceActivity.java index 6c87bae..1814301 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/QmsQualityInstanceActivity.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/QmsQualityInstanceActivity.java @@ -1,6 +1,8 @@ package com.hw.qms.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; @@ -9,7 +11,7 @@ import com.hw.common.core.web.domain.BaseEntity; /** * 质检工单实例节点对象 qms_quality_instance_activity - * + * * @author xins * @date 2024-01-23 */ @@ -71,124 +73,146 @@ public class QmsQualityInstanceActivity extends BaseEntity @Excel(name = "转单人用户id或转发协助用户id;1、在转发时,生成新的工单节点实例,执行人id为转发的用户,而转单人是刚才转发给此用户的用户id,是否协助工单为0,并且转发后当前工单的状态为已结束此用户的用户id,是否协助工单为0,并且转发后当前工单的状态为已结束此用户的用户id,是否协助工单为0,并且转发后当前工单的状态为已结束此用户的用户id,是否协助工单为0,并且转发后当前工单的状态为已结束2、在添加协助时,生成新的工单节点实例,执行人id为添加协助的用户,而转单人是刚才添加协助此用户的用户id,是否协助工单为1,并且转发后当前工单的状态仍为执行中") private Long transferUserId; - public void setInstanceActivityId(Long instanceActivityId) + /** 质检文件信息 */ + private List qmsCheckInstanceFileList; + + private boolean editedAble = false;//是否可编辑 + + public void setInstanceActivityId(Long instanceActivityId) { this.instanceActivityId = instanceActivityId; } - public Long getInstanceActivityId() + public Long getInstanceActivityId() { return instanceActivityId; } - public void setQualityInstanceId(Long qualityInstanceId) + public void setQualityInstanceId(Long qualityInstanceId) { this.qualityInstanceId = qualityInstanceId; } - public Long getQualityInstanceId() + public Long getQualityInstanceId() { return qualityInstanceId; } - public void setProcessActivityId(Long processActivityId) + public void setProcessActivityId(Long processActivityId) { this.processActivityId = processActivityId; } - public Long getProcessActivityId() + public Long getProcessActivityId() { return processActivityId; } - public void setProcessHandleResolution(String processHandleResolution) + public void setProcessHandleResolution(String processHandleResolution) { this.processHandleResolution = processHandleResolution; } - public String getProcessHandleResolution() + public String getProcessHandleResolution() { return processHandleResolution; } - public void setProcessHandleDesc(String processHandleDesc) + public void setProcessHandleDesc(String processHandleDesc) { this.processHandleDesc = processHandleDesc; } - public String getProcessHandleDesc() + public String getProcessHandleDesc() { return processHandleDesc; } - public void setProcessHandleStatus(String processHandleStatus) + public void setProcessHandleStatus(String processHandleStatus) { this.processHandleStatus = processHandleStatus; } - public String getProcessHandleStatus() + public String getProcessHandleStatus() { return processHandleStatus; } - public void setProcessStepOrder(Long processStepOrder) + public void setProcessStepOrder(Long processStepOrder) { this.processStepOrder = processStepOrder; } - public Long getProcessStepOrder() + public Long getProcessStepOrder() { return processStepOrder; } - public void setStartTime(Date startTime) + public void setStartTime(Date startTime) { this.startTime = startTime; } - public Date getStartTime() + public Date getStartTime() { return startTime; } - public void setEndTime(Date endTime) + public void setEndTime(Date endTime) { this.endTime = endTime; } - public Date getEndTime() + public Date getEndTime() { return endTime; } - public void setHandleUserId(Long handleUserId) + public void setHandleUserId(Long handleUserId) { this.handleUserId = handleUserId; } - public Long getHandleUserId() + public Long getHandleUserId() { return handleUserId; } - public void setHandleBy(String handleBy) + public void setHandleBy(String handleBy) { this.handleBy = handleBy; } - public String getHandleBy() + public String getHandleBy() { return handleBy; } - public void setHandleTime(Date handleTime) + public void setHandleTime(Date handleTime) { this.handleTime = handleTime; } - public Date getHandleTime() + public Date getHandleTime() { return handleTime; } - public void setTransferUserId(Long transferUserId) + public void setTransferUserId(Long transferUserId) { this.transferUserId = transferUserId; } - public Long getTransferUserId() + public Long getTransferUserId() { return transferUserId; } + public List getQmsCheckInstanceFileList() { + return qmsCheckInstanceFileList; + } + + public void setQmsCheckInstanceFileList(List qmsCheckInstanceFileList) { + this.qmsCheckInstanceFileList = qmsCheckInstanceFileList; + } + + public boolean isEditedAble() { + return editedAble; + } + + public void setEditedAble(boolean editedAble) { + this.editedAble = editedAble; + } + + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsCheckResultDetailVo.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsCheckResultDetailVo.java index efd0fa7..85a7aaa 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsCheckResultDetailVo.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsCheckResultDetailVo.java @@ -21,6 +21,7 @@ public class QmsCheckResultDetailVo { private static final long serialVersionUID = 1L; + private Long checkResultId; /** * 批次数量 */ @@ -41,6 +42,16 @@ public class QmsCheckResultDetailVo List qmsCheckInstanceFiles; + private boolean picEditedAble = false;//图片是否可编辑或上传 + + public Long getCheckResultId() { + return checkResultId; + } + + public void setCheckResultId(Long checkResultId) { + this.checkResultId = checkResultId; + } + public int getBatchAmount() { return batchAmount; } @@ -112,4 +123,12 @@ public class QmsCheckResultDetailVo public void setQmsCheckInstanceFiles(List qmsCheckInstanceFiles) { this.qmsCheckInstanceFiles = qmsCheckInstanceFiles; } + + public boolean isPicEditedAble() { + return picEditedAble; + } + + public void setPicEditedAble(boolean picEditedAble) { + this.picEditedAble = picEditedAble; + } } diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsQualityInstanceActivityVo.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsQualityInstanceActivityVo.java new file mode 100644 index 0000000..5864b65 --- /dev/null +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/domain/vo/QmsQualityInstanceActivityVo.java @@ -0,0 +1,37 @@ +package com.hw.qms.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 质检工单实例节点对象 qms_quality_instance_activity + * + * @author xins + * @date 2024-01-23 + */ +@Data +public class QmsQualityInstanceActivityVo extends BaseEntity +{ + @NotNull(message="质检结果ID必须输入") + private Long checkResultId; + + @NotNull(message="质检流程步骤ID必须输入") + private Long processActivityId; + + @NotNull(message="质检流程步骤顺序必须输入") + private Long processStepOrder; + + @NotBlank(message="处理意见必须输入") + /** 处理意见 */ + private String processHandleResolution; + + +} diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/mapper/QmsQualityInstanceActivityMapper.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/mapper/QmsQualityInstanceActivityMapper.java new file mode 100644 index 0000000..168b169 --- /dev/null +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/mapper/QmsQualityInstanceActivityMapper.java @@ -0,0 +1,87 @@ +package com.hw.qms.mapper; + +import java.util.List; +import com.hw.qms.domain.QmsQualityInstanceActivity; +import com.hw.qms.domain.QmsCheckInstanceFile; + +/** + * 质检工单实例节点Mapper接口 + * + * @author xins + * @date 2024-03-11 + */ +public interface QmsQualityInstanceActivityMapper +{ + /** + * 查询质检工单实例节点 + * + * @param instanceActivityId 质检工单实例节点主键 + * @return 质检工单实例节点 + */ + public QmsQualityInstanceActivity selectQmsQualityInstanceActivityByInstanceActivityId(Long instanceActivityId); + + /** + * 查询质检工单实例节点列表 + * + * @param qmsQualityInstanceActivity 质检工单实例节点 + * @return 质检工单实例节点集合 + */ + public List selectQmsQualityInstanceActivityList(QmsQualityInstanceActivity qmsQualityInstanceActivity); + + /** + * 新增质检工单实例节点 + * + * @param qmsQualityInstanceActivity 质检工单实例节点 + * @return 结果 + */ + public int insertQmsQualityInstanceActivity(QmsQualityInstanceActivity qmsQualityInstanceActivity); + + /** + * 修改质检工单实例节点 + * + * @param qmsQualityInstanceActivity 质检工单实例节点 + * @return 结果 + */ + public int updateQmsQualityInstanceActivity(QmsQualityInstanceActivity qmsQualityInstanceActivity); + + /** + * 删除质检工单实例节点 + * + * @param instanceActivityId 质检工单实例节点主键 + * @return 结果 + */ + public int deleteQmsQualityInstanceActivityByInstanceActivityId(Long instanceActivityId); + + /** + * 批量删除质检工单实例节点 + * + * @param instanceActivityIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQmsQualityInstanceActivityByInstanceActivityIds(Long[] instanceActivityIds); + + /** + * 批量删除质检文件 + * + * @param instanceActivityIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQmsCheckInstanceFileByTargetIds(Long[] instanceActivityIds); + + /** + * 批量新增质检文件 + * + * @param qmsCheckInstanceFileList 质检文件列表 + * @return 结果 + */ + public int batchQmsCheckInstanceFile(List qmsCheckInstanceFileList); + + + /** + * 通过质检工单实例节点主键删除质检文件信息 + * + * @param instanceActivityId 质检工单实例节点ID + * @return 结果 + */ + public int deleteQmsCheckInstanceFileByTargetId(Long instanceActivityId); +} diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/IQmsQualityInstanceService.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/IQmsQualityInstanceService.java index dd6aca3..9523e4b 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/IQmsQualityInstanceService.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/IQmsQualityInstanceService.java @@ -2,6 +2,8 @@ package com.hw.qms.service; import java.util.List; import com.hw.qms.domain.QmsQualityInstance; +import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo; +import org.springframework.transaction.annotation.Transactional; /** * 质检工单Service接口 @@ -68,4 +70,11 @@ public interface IQmsQualityInstanceService * @return 质检工单 */ public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId); + + /** + * 不合格处置保存 + * @param qmsQualityInstanceActivityVo + * @param fileUrls + */ + public int handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo, List fileUrls); } diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsCheckResultDetailServiceImpl.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsCheckResultDetailServiceImpl.java index 942b812..989eab5 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsCheckResultDetailServiceImpl.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsCheckResultDetailServiceImpl.java @@ -7,10 +7,10 @@ import java.util.List; import com.hw.common.core.constant.QmsConstants; import com.hw.common.core.utils.DateUtils; import com.hw.common.security.utils.SecurityUtils; -import com.hw.qms.domain.MesBaseBarcodeInfo; -import com.hw.qms.domain.QmsCheckRuleProject; +import com.hw.qms.domain.*; import com.hw.qms.domain.vo.QmsCheckResultDetailVo; import com.hw.qms.domain.vo.QmsMaterialCheckVo; +import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo; import com.hw.qms.mapper.QmsCheckResultDetailProjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,9 +19,7 @@ import java.util.ArrayList; import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; -import com.hw.qms.domain.QmsCheckResultDetailProject; import com.hw.qms.mapper.QmsCheckResultDetailMapper; -import com.hw.qms.domain.QmsCheckResultDetail; import com.hw.qms.service.IQmsCheckResultDetailService; /** @@ -271,7 +269,9 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer QmsCheckResultDetailVo checkResultDetailVo = new QmsCheckResultDetailVo(); checkResultDetailVo.setPassAmount(passAmount); checkResultDetailVo.setFailAmount(failAmount); + checkResultDetailVo.setCheckResultId(checkResultId); return checkResultDetailVo; } + } diff --git a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsQualityInstanceServiceImpl.java b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsQualityInstanceServiceImpl.java index fbf4ff0..6e8dbfa 100644 --- a/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsQualityInstanceServiceImpl.java +++ b/hw-modules/hw-qms/src/main/java/com/hw/qms/service/impl/QmsQualityInstanceServiceImpl.java @@ -1,10 +1,19 @@ package com.hw.qms.service.impl; +import java.util.Date; import java.util.List; + +import com.hw.common.core.constant.WfConstants; import com.hw.common.core.utils.DateUtils; +import com.hw.common.security.utils.SecurityUtils; +import com.hw.qms.domain.QmsCheckInstanceFile; +import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo; +import com.hw.qms.mapper.QmsQualityInstanceActivityMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import java.util.ArrayList; + import com.hw.common.core.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import com.hw.qms.domain.QmsQualityInstanceActivity; @@ -19,11 +28,13 @@ import com.hw.qms.service.IQmsQualityInstanceService; * @date 2024-01-23 */ @Service -public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService -{ +public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService { @Autowired private QmsQualityInstanceMapper qmsQualityInstanceMapper; + @Autowired + private QmsQualityInstanceActivityMapper qmsQualityInstanceActivityMapper; + /** * 查询质检工单 * @@ -31,8 +42,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService * @return 质检工单 */ @Override - public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) - { + public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) { return qmsQualityInstanceMapper.selectQmsQualityInstanceByQualityInstanceId(qualityInstanceId); } @@ -43,8 +53,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService * @return 质检工单 */ @Override - public List selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance) - { + public List selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance) { return qmsQualityInstanceMapper.selectQmsQualityInstanceList(qmsQualityInstance); } @@ -56,8 +65,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService */ @Transactional @Override - public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance) - { + public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance) { qmsQualityInstance.setCreateTime(DateUtils.getNowDate()); int rows = qmsQualityInstanceMapper.insertQmsQualityInstance(qmsQualityInstance); insertQmsQualityInstanceActivity(qmsQualityInstance); @@ -72,8 +80,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService */ @Transactional @Override - public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance) - { + public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance) { qmsQualityInstance.setUpdateTime(DateUtils.getNowDate()); qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qmsQualityInstance.getQualityInstanceId()); insertQmsQualityInstanceActivity(qmsQualityInstance); @@ -88,8 +95,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService */ @Transactional @Override - public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds) - { + public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds) { qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceIds(qualityInstanceIds); return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceIds(qualityInstanceIds); } @@ -102,8 +108,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService */ @Transactional @Override - public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) - { + public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) { qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qualityInstanceId); return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceId(qualityInstanceId); } @@ -113,33 +118,22 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService * * @param qmsQualityInstance 质检工单对象 */ - public void insertQmsQualityInstanceActivity(QmsQualityInstance qmsQualityInstance) - { + public void insertQmsQualityInstanceActivity(QmsQualityInstance qmsQualityInstance) { List qmsQualityInstanceActivityList = qmsQualityInstance.getQmsQualityInstanceActivityList(); Long qualityInstanceId = qmsQualityInstance.getQualityInstanceId(); - if (StringUtils.isNotNull(qmsQualityInstanceActivityList)) - { + if (StringUtils.isNotNull(qmsQualityInstanceActivityList)) { List list = new ArrayList(); - for (QmsQualityInstanceActivity qmsQualityInstanceActivity : qmsQualityInstanceActivityList) - { + for (QmsQualityInstanceActivity qmsQualityInstanceActivity : qmsQualityInstanceActivityList) { qmsQualityInstanceActivity.setQualityInstanceId(qualityInstanceId); list.add(qmsQualityInstanceActivity); } - if (list.size() > 0) - { + if (list.size() > 0) { qmsQualityInstanceMapper.batchQmsQualityInstanceActivity(list); } } } - - - - - - - /** * 查询质检工单 * @@ -147,8 +141,103 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService * @return 质检工单 */ @Override - public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId) - { + public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId) { return qmsQualityInstanceMapper.selectQmsQualityInstanceByCheckResultId(checkResultId); } + + + /** + * 不合格处置保存 + * + * @param qmsQualityInstanceActivityVo + * @param fileUrls + */ + @Transactional + @Override + public int handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo, List fileUrls) { + Long checkResultId = qmsQualityInstanceActivityVo.getCheckResultId(); + QmsQualityInstance qmsQualityInstance = qmsQualityInstanceMapper.selectQmsQualityInstanceByCheckResultId(checkResultId); + Date currentDate = new Date(); + String userName = SecurityUtils.getUsername(); + //todo:权限校验 + if (qmsQualityInstance == null) { + qmsQualityInstance = new QmsQualityInstance(); + qmsQualityInstance.setCheckResultId(checkResultId); + qmsQualityInstance.setWfProcessId(WfConstants.WF_QUALITY_ABNORMAL_PROCESS_ID); + qmsQualityInstance.setWfInstanceStatus(WfConstants.WF_INSTANCE_STATUS_START); + qmsQualityInstance.setStartTime(currentDate); + qmsQualityInstance.setCreateTime(currentDate); + qmsQualityInstance.setCreateBy(userName); + + int rows = qmsQualityInstanceMapper.insertQmsQualityInstance(qmsQualityInstance); + + QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity(); + qmsQualityInstanceActivity.setQualityInstanceId(qmsQualityInstance.getQualityInstanceId()); + qmsQualityInstanceActivity.setProcessActivityId(qmsQualityInstanceActivityVo.getProcessActivityId()); + qmsQualityInstanceActivity.setProcessHandleResolution(qmsQualityInstanceActivityVo.getProcessHandleResolution()); + qmsQualityInstanceActivity.setProcessStepOrder(qmsQualityInstanceActivityVo.getProcessStepOrder()); + qmsQualityInstanceActivity.setProcessHandleStatus(WfConstants.WF_PROCESS_HANDLE_STATUS_FINISH); + qmsQualityInstanceActivity.setStartTime(currentDate); + qmsQualityInstanceActivity.setEndTime(currentDate); + qmsQualityInstanceActivity.setHandleUserId(SecurityUtils.getUserId()); + qmsQualityInstanceActivity.setHandleBy(userName); + qmsQualityInstanceActivity.setHandleTime(currentDate); + qmsQualityInstanceActivity.setCreateBy(userName); + qmsQualityInstanceActivity.setCreateTime(currentDate); + + qmsQualityInstanceActivityMapper.insertQmsQualityInstanceActivity(qmsQualityInstanceActivity); + insertQmsCheckInstanceFile(qmsQualityInstanceActivity, fileUrls); + + return rows; + + } else { + QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity(); + qmsQualityInstanceActivity.setQualityInstanceId(qmsQualityInstance.getQualityInstanceId()); + qmsQualityInstanceActivity.setProcessActivityId(qmsQualityInstanceActivityVo.getProcessActivityId()); + qmsQualityInstanceActivity.setProcessHandleResolution(qmsQualityInstanceActivityVo.getProcessHandleResolution()); + qmsQualityInstanceActivity.setProcessStepOrder(qmsQualityInstanceActivityVo.getProcessStepOrder()); + qmsQualityInstanceActivity.setProcessHandleStatus(WfConstants.WF_PROCESS_HANDLE_STATUS_FINISH); + qmsQualityInstanceActivity.setStartTime(currentDate); + qmsQualityInstanceActivity.setEndTime(currentDate); + qmsQualityInstanceActivity.setHandleUserId(SecurityUtils.getUserId()); + qmsQualityInstanceActivity.setHandleBy(userName); + qmsQualityInstanceActivity.setHandleTime(currentDate); + qmsQualityInstanceActivity.setCreateBy(userName); + qmsQualityInstanceActivity.setCreateTime(currentDate); + + //todo:如果工单流程增加到2步以上,需要判断是否是最后一步再处理 + qmsQualityInstance.setEndTime(currentDate); + qmsQualityInstance.setWfInstanceStatus(WfConstants.WF_INSTANCE_STATUS_FINISH); + qmsQualityInstance.setUpdateTime(currentDate); + qmsQualityInstance.setUpdateBy(userName); + qmsQualityInstanceMapper.updateQmsQualityInstance(qmsQualityInstance); + + return qmsQualityInstanceActivityMapper.insertQmsQualityInstanceActivity(qmsQualityInstanceActivity); + } + } + + + /** + * 新增质检文件信息 + * + * @param qmsQualityInstanceActivity 质检工单实例节点对象 + * @param fileUrls 文件url列表 + */ + public void insertQmsCheckInstanceFile(QmsQualityInstanceActivity qmsQualityInstanceActivity, List fileUrls) { + Long instanceActivityId = qmsQualityInstanceActivity.getInstanceActivityId(); + if (StringUtils.isNotNull(fileUrls)) { + List list = new ArrayList(); + for (String fileUrl : fileUrls) { + QmsCheckInstanceFile qmsCheckInstanceFile = new QmsCheckInstanceFile(); + qmsCheckInstanceFile.setTargetId(instanceActivityId); + qmsCheckInstanceFile.setTargetType(WfConstants.QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY); + qmsCheckInstanceFile.setFaultFile(fileUrl); + list.add(qmsCheckInstanceFile); + } + if (list.size() > 0) { + qmsQualityInstanceActivityMapper.batchQmsCheckInstanceFile(list); + } + } + } + } diff --git a/hw-modules/hw-qms/src/main/resources/mapper/qms/QmsQualityInstanceActivityMapper.xml b/hw-modules/hw-qms/src/main/resources/mapper/qms/QmsQualityInstanceActivityMapper.xml new file mode 100644 index 0000000..ec3fe36 --- /dev/null +++ b/hw-modules/hw-qms/src/main/resources/mapper/qms/QmsQualityInstanceActivityMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select instance_activity_id, quality_instance_id, process_activity_id, process_handle_resolution, process_handle_desc, process_handle_status, process_step_order, start_time, end_time, handle_user_id, handle_by, handle_time, create_by, create_time, transfer_user_id from qms_quality_instance_activity + + + + + + + + insert into qms_quality_instance_activity + + quality_instance_id, + process_activity_id, + process_handle_resolution, + process_handle_desc, + process_handle_status, + process_step_order, + start_time, + end_time, + handle_user_id, + handle_by, + handle_time, + create_by, + create_time, + transfer_user_id, + + + #{qualityInstanceId}, + #{processActivityId}, + #{processHandleResolution}, + #{processHandleDesc}, + #{processHandleStatus}, + #{processStepOrder}, + #{startTime}, + #{endTime}, + #{handleUserId}, + #{handleBy}, + #{handleTime}, + #{createBy}, + #{createTime}, + #{transferUserId}, + + + + + update qms_quality_instance_activity + + quality_instance_id = #{qualityInstanceId}, + process_activity_id = #{processActivityId}, + process_handle_resolution = #{processHandleResolution}, + process_handle_desc = #{processHandleDesc}, + process_handle_status = #{processHandleStatus}, + process_step_order = #{processStepOrder}, + start_time = #{startTime}, + end_time = #{endTime}, + handle_user_id = #{handleUserId}, + handle_by = #{handleBy}, + handle_time = #{handleTime}, + create_by = #{createBy}, + create_time = #{createTime}, + transfer_user_id = #{transferUserId}, + + where instance_activity_id = #{instanceActivityId} + + + + delete from qms_quality_instance_activity where instance_activity_id = #{instanceActivityId} + + + + delete from qms_quality_instance_activity where instance_activity_id in + + #{instanceActivityId} + + + + + delete from qms_check_instance_file where target_id in + + #{targetId} + + + + + delete from qms_check_instance_file where target_id = #{targetId} + + + + insert into qms_check_instance_file( check_instance_file_id, target_type, target_id, fault_file) values + + ( #{item.checkInstanceFileId}, #{item.targetType}, #{item.targetId}, #{item.faultFile}) + + + \ No newline at end of file diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/common/controller/WfProcessActivityController.java b/hw-modules/hw-system/src/main/java/com/hw/system/common/controller/WfProcessActivityController.java index 41e11cb..2f2d58f 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/common/controller/WfProcessActivityController.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/common/controller/WfProcessActivityController.java @@ -3,8 +3,9 @@ package com.hw.system.common.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.hw.common.security.annotation.InnerAuth; import com.hw.system.api.domain.common.WfProcessActivity; -import oracle.jdbc.proxy.annotation.Post; +import com.hw.system.api.domain.common.vo.WfProcessActivityVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -111,4 +112,13 @@ public class WfProcessActivityController extends BaseController return wfProcessActivityService.selectProcessActivityIdByWfProcessId(wfProcessId); // return 200l; } + + + + @InnerAuth + @PostMapping("/getWfProcessActivityByUI") + public AjaxResult getWfProcessActivityByUI(@RequestBody WfProcessActivityVo queryProcessActivityVo) { + return success(wfProcessActivityService.selectWfProcessActivityByUI(queryProcessActivityVo.getWfProcessId(), + queryProcessActivityVo.getProcessActivityOrder())); + } } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/common/mapper/WfProcessActivityMapper.java b/hw-modules/hw-system/src/main/java/com/hw/system/common/mapper/WfProcessActivityMapper.java index f6f8cdf..1f7c732 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/common/mapper/WfProcessActivityMapper.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/common/mapper/WfProcessActivityMapper.java @@ -2,6 +2,7 @@ package com.hw.system.common.mapper; import com.hw.system.api.domain.common.WfProcessActivity; import com.hw.system.api.domain.common.WfProcessActivityAuth; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -88,4 +89,15 @@ public interface WfProcessActivityMapper Long selectProcessActivityIdByWfProcessId(Long wfProcessId); + + /** + * 查询工单流程节点步骤 + * + * @param wfProcessId 工单流程主键 + * @param processActivityOrder 顺序 + * @return 工单流程节点步骤 + */ + public WfProcessActivity selectWfProcessActivityByUI(@Param("wfProcessId") Long wfProcessId, + @Param("processActivityOrder") Long processActivityOrder); + } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/common/service/IWfProcessActivityService.java b/hw-modules/hw-system/src/main/java/com/hw/system/common/service/IWfProcessActivityService.java index 1deb45d..a16df33 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/common/service/IWfProcessActivityService.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/common/service/IWfProcessActivityService.java @@ -10,8 +10,7 @@ import java.util.List; * @author xins * @date 2024-01-19 */ -public interface IWfProcessActivityService -{ +public interface IWfProcessActivityService { /** * 查询工单流程节点步骤 * @@ -61,4 +60,14 @@ public interface IWfProcessActivityService public int deleteWfProcessActivityByProcessActivityId(Long processActivityId); Long selectProcessActivityIdByWfProcessId(Long wfProcessId); + + + /** + * 查询工单流程节点步骤 + * + * @param wfProcessId 工单流程主键 + * @param processActivityOrder 顺序 + * @return 工单流程节点步骤 + */ + public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder); } diff --git a/hw-modules/hw-system/src/main/java/com/hw/system/common/service/impl/WfProcessActivityServiceImpl.java b/hw-modules/hw-system/src/main/java/com/hw/system/common/service/impl/WfProcessActivityServiceImpl.java index c572d6d..f06ef75 100644 --- a/hw-modules/hw-system/src/main/java/com/hw/system/common/service/impl/WfProcessActivityServiceImpl.java +++ b/hw-modules/hw-system/src/main/java/com/hw/system/common/service/impl/WfProcessActivityServiceImpl.java @@ -166,4 +166,17 @@ public class WfProcessActivityServiceImpl implements IWfProcessActivityService } } } + + + + /** + * 查询工单流程节点步骤 + * + * @param wfProcessId 工单流程主键 + * @param processActivityOrder 顺序 + * @return 工单流程节点步骤 + */ + public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder){ + return wfProcessActivityMapper.selectWfProcessActivityByUI(wfProcessId, processActivityOrder); + } } diff --git a/hw-modules/hw-system/src/main/resources/mapper/system/common/WfProcessActivityMapper.xml b/hw-modules/hw-system/src/main/resources/mapper/system/common/WfProcessActivityMapper.xml index ab57f3c..102dcb2 100644 --- a/hw-modules/hw-system/src/main/resources/mapper/system/common/WfProcessActivityMapper.xml +++ b/hw-modules/hw-system/src/main/resources/mapper/system/common/WfProcessActivityMapper.xml @@ -164,4 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +