fix:调整物料验收接口
This commit is contained in:
@@ -94,14 +94,6 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
|||||||
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
|
||||||
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) {
|
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) {
|
||||||
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
|
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
|
||||||
// return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class));
|
|
||||||
return success(pageResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/gong-page")
|
|
||||||
@Operation(summary = "获得批次工段分页")
|
|
||||||
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchGongPage(@Valid MaterialBatchPageReqVO pageReqVO) {
|
|
||||||
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchGongPageWithPdtInfo(pageReqVO);
|
|
||||||
return success(pageResult);
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,16 +52,18 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialLifecycleService materialLifecycleService;
|
private MaterialLifecycleService materialLifecycleService;
|
||||||
|
|
||||||
|
// QMS_RESOURCE_MATERIAL_COMMON
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "新建物料流程")
|
@Operation(summary = "新建物料流程")
|
||||||
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')")
|
||||||
public CommonResult<MaterialLifecycleRespVO> createMaterialLifecycle(@Validated(AddGroup.class) @RequestBody MaterialLifecycleSaveReqVO createReqVO) {
|
public CommonResult<MaterialLifecycleRespVO> createMaterialLifecycle(@Validated(AddGroup.class) @RequestBody MaterialLifecycleSaveReqVO createReqVO) {
|
||||||
return success(materialLifecycleService.createMaterialLifecycle(createReqVO));
|
return success(materialLifecycleService.createMaterialLifecycle(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新物料流程")
|
@Operation(summary = "更新物料流程")
|
||||||
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:update')")
|
||||||
public CommonResult<Boolean> updateMaterialLifecycle(@Validated(UpdateGroup.class) @RequestBody MaterialLifecycleSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateMaterialLifecycle(@Validated(UpdateGroup.class) @RequestBody MaterialLifecycleSaveReqVO updateReqVO) {
|
||||||
materialLifecycleService.updateMaterialLifecycle(updateReqVO);
|
materialLifecycleService.updateMaterialLifecycle(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -70,7 +72,7 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除物料流程")
|
@Operation(summary = "删除物料流程")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:delete')")
|
||||||
public CommonResult<Boolean> deleteMaterialLifecycle(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteMaterialLifecycle(@RequestParam("id") Long id) {
|
||||||
materialLifecycleService.deleteMaterialLifecycle(id);
|
materialLifecycleService.deleteMaterialLifecycle(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -86,25 +88,33 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得物料通用流程")
|
@Operation(summary = "获得物料流程")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
|
||||||
public CommonResult<MaterialLifecycleRespVO> getMaterialLifecycle(@RequestParam("id") Long id) {
|
public CommonResult<MaterialLifecycleRespVO> getMaterialLifecycle(@RequestParam("id") Long id) {
|
||||||
MaterialLifecycleDO materialLifecycle = materialLifecycleService.getMaterialLifecycle(id);
|
MaterialLifecycleRespVO lifecycleRespVO = materialLifecycleService.getMaterialLifecycle(id);
|
||||||
return success(BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class));
|
return success(lifecycleRespVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得物料通用流程,物料验收、退换货分页")
|
@Operation(summary = "获得物料流程分页")
|
||||||
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
|
||||||
public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) {
|
public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) {
|
||||||
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO);
|
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class));
|
return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/submit")
|
||||||
|
@Operation(summary = "提交(验收等流程)")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
public CommonResult<Boolean> submitLifecycle(@RequestParam("id") Long id) {
|
||||||
|
|
||||||
|
return success(materialLifecycleService.submitLifecycle(id));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出物料通用流程,物料验收、退换货 Excel")
|
@Operation(summary = "导出物料通用流程,物料验收、退换货 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:export')")
|
@PreAuthorize("@ss.hasPermission('qms:material-lifecycle:export')")
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO,
|
public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public class MaterialBatchPageReqVO extends PageParam {
|
|||||||
@Schema(description = "是否需要组装 children")
|
@Schema(description = "是否需要组装 children")
|
||||||
private Boolean children = false;
|
private Boolean children = false;
|
||||||
|
|
||||||
|
@Schema(description = "是否只需要工段")
|
||||||
|
private Boolean onlyGong = false;
|
||||||
|
|
||||||
@Schema(description = "批次编号")
|
@Schema(description = "批次编号")
|
||||||
private String batchNo;
|
private String batchNo;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class MaterialLifecyclePageReqVO extends PageParam {
|
|||||||
@Schema(description = "流程实例id", example = "12151")
|
@Schema(description = "流程实例id", example = "12151")
|
||||||
private String flowInstanceId;
|
private String flowInstanceId;
|
||||||
|
|
||||||
@Schema(description = "提交状态,提交状态,0-未提交,1-已提交", example = "1")
|
@Schema(description = "提交状态,0-未提交,1-已提交", example = "1")
|
||||||
private Integer submitStatus;
|
private Integer submitStatus;
|
||||||
|
|
||||||
@Schema(description = "流程审批状态", example = "1")
|
@Schema(description = "流程审批状态", example = "1")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ public class MaterialLifecycleRespVO {
|
|||||||
|
|
||||||
@Schema(description = "流程审批状态", example = "1")
|
@Schema(description = "流程审批状态", example = "1")
|
||||||
@ExcelProperty("流程审批状态")
|
@ExcelProperty("流程审批状态")
|
||||||
|
@Dict(dicCode = "flow_status")
|
||||||
private String flowStatus;
|
private String flowStatus;
|
||||||
|
|
||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
|
|||||||
@@ -23,25 +23,22 @@ public class MaterialLifecycleSaveReqVO {
|
|||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2")
|
@Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2")
|
||||||
|
@NotNull(groups = AddGroup.class, message = "业务类型不能为空")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
@Schema(description = "业务类型编码")
|
@Schema(description = "业务类型编码")
|
||||||
private String businessTypeCode;
|
private String businessTypeCode;
|
||||||
|
|
||||||
@Schema(description = "申请人")
|
@Schema(description = "申请人")
|
||||||
@NotNull(groups = AddGroup.class, message = "申请人不能为空")
|
|
||||||
private String applyUser;
|
private String applyUser;
|
||||||
|
|
||||||
@Schema(description = "申请人id", example = "4976")
|
@Schema(description = "申请人id", example = "4976")
|
||||||
@NotNull(groups = AddGroup.class, message = "申请人id 不能为空")
|
|
||||||
private Long applyUserId;
|
private Long applyUserId;
|
||||||
|
|
||||||
@Schema(description = "申请部门")
|
@Schema(description = "申请部门")
|
||||||
@NotNull(groups = AddGroup.class, message = "申请部门不能为空")
|
|
||||||
private String applyDepartment;
|
private String applyDepartment;
|
||||||
|
|
||||||
@Schema(description = "申请部门id", example = "19765")
|
@Schema(description = "申请部门id", example = "19765")
|
||||||
@NotNull(groups = AddGroup.class, message = "申请部门id 不能为空")
|
|
||||||
private Long applyDepartmentId;
|
private Long applyDepartmentId;
|
||||||
|
|
||||||
@Schema(description = "申请时间")
|
@Schema(description = "申请时间")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
|||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
|
import com.zt.plat.framework.security.core.LoginUser;
|
||||||
|
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||||
@@ -44,6 +46,11 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
|||||||
|
|
||||||
// onlyGong 是否只查询工段
|
// onlyGong 是否只查询工段
|
||||||
default PageResult<MaterialBatchRespVO> selectPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds, Boolean onlyGong) {
|
default PageResult<MaterialBatchRespVO> selectPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds, Boolean onlyGong) {
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
Long visitDeptId = null;
|
||||||
|
if (loginUser != null) {
|
||||||
|
visitDeptId = loginUser.getVisitDeptId();
|
||||||
|
}
|
||||||
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
|
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
|
||||||
.selectAll(MaterialBatchDO.class)
|
.selectAll(MaterialBatchDO.class)
|
||||||
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
|
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
|
||||||
@@ -54,6 +61,8 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
|||||||
.eq(onlyGong != null && !onlyGong, MaterialBatchDO::getParentId, 0)
|
.eq(onlyGong != null && !onlyGong, MaterialBatchDO::getParentId, 0)
|
||||||
// 只查询工段
|
// 只查询工段
|
||||||
.ne(onlyGong != null && onlyGong, MaterialBatchDO::getParentId, 0)
|
.ne(onlyGong != null && onlyGong, MaterialBatchDO::getParentId, 0)
|
||||||
|
.eq(onlyGong != null && onlyGong, MaterialBatchDO::getSubmitStatus, 1)
|
||||||
|
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
|
||||||
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
||||||
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
||||||
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
|
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
|
||||||
|
|||||||
@@ -3,10 +3,16 @@ package com.zt.plat.module.qms.resource.material.dal.mapper;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料通用流程明细 Mapper
|
* 物料通用流程明细 Mapper
|
||||||
*
|
*
|
||||||
@@ -32,4 +38,17 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
|
|||||||
.orderByDesc(MaterialLifecycleDetailDO::getId));
|
.orderByDesc(MaterialLifecycleDetailDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<MaterialLifecycleDetailRespVO> selectListWithPdtBatInfo(Long id){
|
||||||
|
MPJLambdaWrapperX<MaterialLifecycleDetailDO> wrapperX = new MPJLambdaWrapperX<MaterialLifecycleDetailDO>()
|
||||||
|
.selectAll(MaterialLifecycleDetailDO.class)
|
||||||
|
.selectAs(MaterialProductDO::getName, MaterialLifecycleDetailRespVO::getProductName)
|
||||||
|
.selectAs(MaterialProductDO::getCode, MaterialLifecycleDetailRespVO::getProductCode)
|
||||||
|
.selectAs(MaterialProductDO::getModelNo, MaterialLifecycleDetailRespVO::getProductModelNo)
|
||||||
|
.selectAs(MaterialBatchDO::getBatchNo, MaterialLifecycleDetailRespVO::getBatchNo)
|
||||||
|
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialLifecycleDetailDO::getProductId)
|
||||||
|
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getId, MaterialLifecycleDetailDO::getBatchId)
|
||||||
|
.eq(MaterialLifecycleDetailDO::getLifecycleId, id);
|
||||||
|
|
||||||
|
return selectJoinList(MaterialLifecycleDetailRespVO.class, wrapperX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -17,15 +17,15 @@ public interface MaterialLifecycleMapper extends BaseMapperX<MaterialLifecycleDO
|
|||||||
|
|
||||||
default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) {
|
default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>()
|
||||||
.eqIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
|
.likeIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType())
|
.eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
|
.eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
|
.likeIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId())
|
.eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
|
.likeIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
|
.eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
|
||||||
.betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime())
|
.betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
|
.likeIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId())
|
.eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus())
|
.eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus())
|
||||||
.eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus())
|
.eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus())
|
||||||
|
|||||||
@@ -137,9 +137,12 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MaterialBatchRespVO> getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
|
public PageResult<MaterialBatchRespVO> getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
|
||||||
// 先分页查询批次
|
// 先分页查询批次或工段
|
||||||
PageResult<MaterialBatchRespVO> pageResult = getMaterialBatchRespVOPageWithPdtInfo(pageReqVO, false);
|
Boolean onlyGong = pageReqVO.getOnlyGong();
|
||||||
// 再获取工段
|
PageResult<MaterialBatchRespVO> pageResult = getMaterialBatchRespVOPageWithPdtInfo(pageReqVO, onlyGong);
|
||||||
|
// 只获取工段
|
||||||
|
if (onlyGong) return pageResult;
|
||||||
|
// 如果获取是批次分页,再根据批次ids获取工段
|
||||||
List<MaterialBatchRespVO> batches = pageResult.getList();
|
List<MaterialBatchRespVO> batches = pageResult.getList();
|
||||||
if (CollUtil.isNotEmpty(batches)) {
|
if (CollUtil.isNotEmpty(batches)) {
|
||||||
List<Long> batIds = batches.stream().map(MaterialBatchRespVO::getId).toList();
|
List<Long> batIds = batches.stream().map(MaterialBatchRespVO::getId).toList();
|
||||||
@@ -235,6 +238,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
.ne(MaterialBatchDO::getParentId, 0));
|
.ne(MaterialBatchDO::getParentId, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean submitMaterialBatch(Long id) {
|
public Boolean submitMaterialBatch(Long id) {
|
||||||
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
|
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
|
||||||
@@ -245,6 +249,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
|
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
|
||||||
batchDO.setSubmitStatus(1);
|
batchDO.setSubmitStatus(1);
|
||||||
materialBatchMapper.updateById(batchDO);
|
materialBatchMapper.updateById(batchDO);
|
||||||
|
// 提交工段
|
||||||
|
MaterialBatchDO updateBatch = new MaterialBatchDO().setSubmitStatus(1);
|
||||||
|
materialBatchMapper.update(updateBatch, Wrappers.lambdaQuery(MaterialBatchDO.class)
|
||||||
|
.eq(MaterialBatchDO::getParentId, id));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,4 +81,12 @@ public interface MaterialLifecycleDetailService {
|
|||||||
* @param ids 流程ids
|
* @param ids 流程ids
|
||||||
*/
|
*/
|
||||||
void deleteLifecycleDetailListByLfcIds(List<Long> ids);
|
void deleteLifecycleDetailListByLfcIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据流程id 获取流程明细数据
|
||||||
|
*
|
||||||
|
* @param id 流程id
|
||||||
|
* @return 明细列表
|
||||||
|
*/
|
||||||
|
List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id);
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,10 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta
|
|||||||
.in(MaterialLifecycleDetailDO::getLifecycleId, ids));
|
.in(MaterialLifecycleDetailDO::getLifecycleId, ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id) {
|
||||||
|
|
||||||
|
return materialLifecycleDetailMapper.selectListWithPdtBatInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ public interface MaterialLifecycleService {
|
|||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 物料通用流程,物料验收、退换货
|
* @return 物料通用流程,物料验收、退换货
|
||||||
*/
|
*/
|
||||||
MaterialLifecycleDO getMaterialLifecycle(Long id);
|
MaterialLifecycleRespVO getMaterialLifecycle(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得物料通用流程,物料验收、退换货分页
|
* 获得物料通用流程,物料验收、退换货分页
|
||||||
@@ -61,4 +61,11 @@ public interface MaterialLifecycleService {
|
|||||||
*/
|
*/
|
||||||
PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO);
|
PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交(验收等流程)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
Boolean submitLifecycle(Long id);
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,19 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.service;
|
package com.zt.plat.module.qms.resource.material.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.zt.plat.framework.common.exception.ServiceException;
|
import com.zt.plat.framework.common.exception.ServiceException;
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.framework.security.core.LoginUser;
|
||||||
|
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
|
||||||
|
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||||
|
import com.zt.plat.module.bpm.api.task.dto.BpmTaskApproveReqDTO;
|
||||||
|
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||||
|
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO;
|
||||||
@@ -13,7 +22,6 @@ import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycle
|
|||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.jspecify.annotations.NonNull;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -25,6 +33,8 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
|
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.ERROR_CODE_MODULE_COMMON;
|
||||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_NOT_EXISTS;
|
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,6 +55,12 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MaterialLifecycleDetailService materialLifecycleDetailService;
|
private MaterialLifecycleDetailService materialLifecycleDetailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BpmTaskApi bpmTaskApi;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BpmProcessInstanceApi bpmProcessInstanceApi;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
|
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
|
||||||
@@ -150,8 +166,14 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialLifecycleDO getMaterialLifecycle(Long id) {
|
public MaterialLifecycleRespVO getMaterialLifecycle(Long id) {
|
||||||
return materialLifecycleMapper.selectById(id);
|
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
|
||||||
|
if (lifecycleDO == null) return null;
|
||||||
|
MaterialLifecycleRespVO respVO = BeanUtils.toBean(lifecycleDO, MaterialLifecycleRespVO.class);
|
||||||
|
// 获取明细
|
||||||
|
List<MaterialLifecycleDetailRespVO> detailRespVOS = materialLifecycleDetailService.getMaterialLifecycleDetailListByLfcId(id);
|
||||||
|
respVO.setDetailList(detailRespVOS);
|
||||||
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,4 +181,116 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
|
|||||||
return materialLifecycleMapper.selectPage(pageReqVO);
|
return materialLifecycleMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean submitLifecycle(Long id) {
|
||||||
|
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
|
||||||
|
if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
|
||||||
|
Integer submitStatus = lifecycleDO.getSubmitStatus();
|
||||||
|
if (submitStatus == 1) throw new ServiceException(1_032_160_000, "申请已经提交过");
|
||||||
|
|
||||||
|
// 发起流程
|
||||||
|
this.createProcessInstance(lifecycleDO);
|
||||||
|
|
||||||
|
lifecycleDO.setSubmitStatus(1);
|
||||||
|
materialLifecycleMapper.updateById(lifecycleDO);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createProcessInstance(MaterialLifecycleDO lifecycleDO) {
|
||||||
|
/*
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
//当前登录用户昵称
|
||||||
|
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
|
||||||
|
Long id = param.getId();
|
||||||
|
SupplierEvaluationDO entity = getSupplierEvaluation(id);
|
||||||
|
String flowInsId = entity.getFlowInstanceId();
|
||||||
|
|
||||||
|
if(!ObjectUtils.isEmpty(flowInsId)){
|
||||||
|
CommonResult<List<BpmTaskRespDTO>> taskRet = bpmTaskApi.getTaskListByProcessInstanceId(flowInsId);
|
||||||
|
List<BpmTaskRespDTO> taskList = taskRet.getData();
|
||||||
|
if(taskList.isEmpty())
|
||||||
|
throw exception0(ERROR_CODE_MODULE_COMMON, "流程任务查询失败,请联系管理员处理");
|
||||||
|
String taskId = taskList.get(taskList.size() - 1).getId();
|
||||||
|
//驳回后重新提交
|
||||||
|
BpmTaskApproveReqDTO reqVO = new BpmTaskApproveReqDTO();
|
||||||
|
reqVO.setId(taskId);
|
||||||
|
CommonResult<Boolean> result = bpmProcessInstanceApi.approveTask(reqVO);
|
||||||
|
if(!result.isSuccess()){
|
||||||
|
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||||
|
}
|
||||||
|
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||||
|
//todo 生成报告编号 documentCode
|
||||||
|
supplierEvaluationMapper.updateById(entity);
|
||||||
|
SupplierEvaluationRespVO respVO = BeanUtils.toBean(entity, SupplierEvaluationRespVO.class);
|
||||||
|
return CommonResult.success(respVO);
|
||||||
|
}
|
||||||
|
JSONObject formData = new JSONObject();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
formData.put("mainId", id);
|
||||||
|
formData.put("applyUser", nickName);
|
||||||
|
formData.put("applyUserId", loginUser.getId());
|
||||||
|
formData.put("applyDepartment", loginUser.getVisitDeptName());
|
||||||
|
formData.put("applyDepartmentId", loginUser.getVisitDeptId());
|
||||||
|
formData.put("applyTime", sdf.format(new Date()));
|
||||||
|
Map<String, Object> variables = formData.toJavaObject(Map.class);
|
||||||
|
variables.put(BPM_CALLBACK_BEAN_NAME, "supplierEvaluationService"); //流程回调时使用的service
|
||||||
|
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||||
|
reqDTO.setBusinessKey(String.valueOf(id));
|
||||||
|
reqDTO.setProcessDefinitionKey(QmsSupplierConstant.EVALUATION_FLOW_KEY);
|
||||||
|
reqDTO.setVariables(variables);
|
||||||
|
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUser.getId(), reqDTO);
|
||||||
|
if(!result.isSuccess()){
|
||||||
|
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||||
|
}
|
||||||
|
String wfInsId = result.getData();
|
||||||
|
entity.setFlowInstanceId(wfInsId);
|
||||||
|
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||||
|
entity.setEvaluationDate(LocalDateTime.now());
|
||||||
|
entity.setEvaluator(nickName);
|
||||||
|
supplierEvaluationMapper.updateById(entity);
|
||||||
|
SupplierEvaluationRespVO respVO = BeanUtils.toBean(entity, SupplierEvaluationRespVO.class);
|
||||||
|
return CommonResult.success(respVO);
|
||||||
|
*/
|
||||||
|
// 发起人及其部门
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||||
|
if (loginUser != null) {
|
||||||
|
lifecycleDO.setApplyUser(loginUserNickname)
|
||||||
|
.setApplyUserId(loginUser.getId())
|
||||||
|
.setApplyDepartment(loginUser.getVisitDeptName())
|
||||||
|
.setApplyDepartmentId(loginUser.getVisitDeptId());
|
||||||
|
}
|
||||||
|
String flowInstanceId = lifecycleDO.getFlowInstanceId();
|
||||||
|
// 创建流程
|
||||||
|
if (StrUtil.isEmpty(flowInstanceId)) {
|
||||||
|
CommonResult<List<BpmTaskRespDTO>> taskRet = bpmTaskApi.getTaskListByProcessInstanceId(flowInstanceId);
|
||||||
|
List<BpmTaskRespDTO> taskList = taskRet.getData();
|
||||||
|
if(CollUtil.isEmpty(taskList))
|
||||||
|
throw exception0(ERROR_CODE_MODULE_COMMON, "流程任务查询失败,请联系管理员处理");
|
||||||
|
String taskId = taskList.get(taskList.size() - 1).getId();
|
||||||
|
//驳回后重新提交
|
||||||
|
BpmTaskApproveReqDTO reqVO = new BpmTaskApproveReqDTO();
|
||||||
|
reqVO.setId(taskId);
|
||||||
|
CommonResult<Boolean> result = bpmProcessInstanceApi.approveTask(reqVO);
|
||||||
|
if(!result.isSuccess()){
|
||||||
|
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||||
|
}
|
||||||
|
lifecycleDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (lifecycleDO.getBusinessType()) {
|
||||||
|
case "acceptance":
|
||||||
|
// 发起验收流程
|
||||||
|
break;
|
||||||
|
case "return_exchange":
|
||||||
|
// 发起退换货流程
|
||||||
|
break;
|
||||||
|
case "config_apply":
|
||||||
|
// 配置申请
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user