fix:调整物料验收接口
This commit is contained in:
@@ -94,14 +94,6 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
||||
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
|
||||
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,18 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
||||
@Resource
|
||||
private MaterialLifecycleService materialLifecycleService;
|
||||
|
||||
// QMS_RESOURCE_MATERIAL_COMMON
|
||||
|
||||
@PostMapping("/create")
|
||||
@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) {
|
||||
return success(materialLifecycleService.createMaterialLifecycle(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@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) {
|
||||
materialLifecycleService.updateMaterialLifecycle(updateReqVO);
|
||||
return success(true);
|
||||
@@ -70,7 +72,7 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除物料流程")
|
||||
@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) {
|
||||
materialLifecycleService.deleteMaterialLifecycle(id);
|
||||
return success(true);
|
||||
@@ -86,25 +88,33 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得物料通用流程")
|
||||
@Operation(summary = "获得物料流程")
|
||||
@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) {
|
||||
MaterialLifecycleDO materialLifecycle = materialLifecycleService.getMaterialLifecycle(id);
|
||||
return success(BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class));
|
||||
MaterialLifecycleRespVO lifecycleRespVO = materialLifecycleService.getMaterialLifecycle(id);
|
||||
return success(lifecycleRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得物料通用流程,物料验收、退换货分页")
|
||||
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')")
|
||||
@Operation(summary = "获得物料流程分页")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
|
||||
public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) {
|
||||
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO);
|
||||
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")
|
||||
@Operation(summary = "导出物料通用流程,物料验收、退换货 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:export')")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-lifecycle:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
@@ -22,6 +22,9 @@ public class MaterialBatchPageReqVO extends PageParam {
|
||||
@Schema(description = "是否需要组装 children")
|
||||
private Boolean children = false;
|
||||
|
||||
@Schema(description = "是否只需要工段")
|
||||
private Boolean onlyGong = false;
|
||||
|
||||
@Schema(description = "批次编号")
|
||||
private String batchNo;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MaterialLifecyclePageReqVO extends PageParam {
|
||||
@Schema(description = "流程实例id", example = "12151")
|
||||
private String flowInstanceId;
|
||||
|
||||
@Schema(description = "提交状态,提交状态,0-未提交,1-已提交", example = "1")
|
||||
@Schema(description = "提交状态,0-未提交,1-已提交", example = "1")
|
||||
private Integer submitStatus;
|
||||
|
||||
@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.ExcelProperty;
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -63,6 +64,7 @@ public class MaterialLifecycleRespVO {
|
||||
|
||||
@Schema(description = "流程审批状态", example = "1")
|
||||
@ExcelProperty("流程审批状态")
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
|
||||
@@ -23,25 +23,22 @@ public class MaterialLifecycleSaveReqVO {
|
||||
private String title;
|
||||
|
||||
@Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2")
|
||||
@NotNull(groups = AddGroup.class, message = "业务类型不能为空")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "业务类型编码")
|
||||
private String businessTypeCode;
|
||||
|
||||
@Schema(description = "申请人")
|
||||
@NotNull(groups = AddGroup.class, message = "申请人不能为空")
|
||||
private String applyUser;
|
||||
|
||||
@Schema(description = "申请人id", example = "4976")
|
||||
@NotNull(groups = AddGroup.class, message = "申请人id 不能为空")
|
||||
private Long applyUserId;
|
||||
|
||||
@Schema(description = "申请部门")
|
||||
@NotNull(groups = AddGroup.class, message = "申请部门不能为空")
|
||||
private String applyDepartment;
|
||||
|
||||
@Schema(description = "申请部门id", example = "19765")
|
||||
@NotNull(groups = AddGroup.class, message = "申请部门id 不能为空")
|
||||
private Long applyDepartmentId;
|
||||
|
||||
@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.query.LambdaQueryWrapperX;
|
||||
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.MaterialBatchRespVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||
@@ -44,6 +46,11 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
||||
|
||||
// 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>()
|
||||
.selectAll(MaterialBatchDO.class)
|
||||
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
|
||||
@@ -54,6 +61,8 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
||||
.eq(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)
|
||||
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
||||
.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.mybatis.core.mapper.BaseMapperX;
|
||||
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.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.MaterialProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料通用流程明细 Mapper
|
||||
*
|
||||
@@ -32,4 +38,17 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
|
||||
.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) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>()
|
||||
.eqIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
|
||||
.likeIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType())
|
||||
.eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
|
||||
.eqIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
|
||||
.likeIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
|
||||
.eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId())
|
||||
.eqIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
|
||||
.likeIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
|
||||
.eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
|
||||
.betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime())
|
||||
.eqIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
|
||||
.likeIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
|
||||
.eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId())
|
||||
.eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus())
|
||||
.eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus())
|
||||
|
||||
@@ -137,9 +137,12 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
||||
|
||||
@Override
|
||||
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();
|
||||
if (CollUtil.isNotEmpty(batches)) {
|
||||
List<Long> batIds = batches.stream().map(MaterialBatchRespVO::getId).toList();
|
||||
@@ -235,6 +238,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
||||
.ne(MaterialBatchDO::getParentId, 0));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Boolean submitMaterialBatch(Long id) {
|
||||
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
|
||||
@@ -245,6 +249,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
||||
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
|
||||
batchDO.setSubmitStatus(1);
|
||||
materialBatchMapper.updateById(batchDO);
|
||||
// 提交工段
|
||||
MaterialBatchDO updateBatch = new MaterialBatchDO().setSubmitStatus(1);
|
||||
materialBatchMapper.update(updateBatch, Wrappers.lambdaQuery(MaterialBatchDO.class)
|
||||
.eq(MaterialBatchDO::getParentId, id));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user