fix:新增物料批次提交,物料大类删除校验。
This commit is contained in:
@@ -115,7 +115,7 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
|
||||
return success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备通用流程,验收、降级、停用、报废、还原、启用分页")
|
||||
public CommonResult<PageResult<DeviceApplyRespVO>> getDeviceApplyPage(@Valid DeviceApplyPageReqVO pageReqVO) {
|
||||
PageResult<DeviceApplyDO> pageResult = deviceApplyService.getDeviceApplyPage(pageReqVO);
|
||||
|
||||
@@ -122,8 +122,8 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
||||
@Operation(summary = "提交物料批次")
|
||||
@Parameter(name = "id", required = true)
|
||||
public CommonResult<Boolean> submitMaterialBatch(@RequestParam("id") Long id) {
|
||||
// return success(materialBatchService.submitMaterialBatch(id));
|
||||
return null;
|
||||
|
||||
return success(materialBatchService.submitMaterialBatch(id));
|
||||
}
|
||||
|
||||
@GetMapping("gongduan-page")
|
||||
|
||||
@@ -3,11 +3,15 @@ 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.core.constant.DataTypeConstant;
|
||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料大类 Mapper
|
||||
*
|
||||
@@ -52,4 +56,17 @@ public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
|
||||
.orderByDesc(MaterialProductDO::getId));
|
||||
}
|
||||
|
||||
default boolean checkIsExistsBatchByPdt(Long id){
|
||||
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>()
|
||||
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
|
||||
.eq(MaterialBatchDO::getProductId, id);
|
||||
return this.exists(wrapperX);
|
||||
}
|
||||
|
||||
default boolean checkIsExistsDataByPdts(List<Long> ids){
|
||||
MPJLambdaWrapperX<MaterialProductDO> wrapperX = new MPJLambdaWrapperX<MaterialProductDO>()
|
||||
.leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId)
|
||||
.in(MaterialBatchDO::getProductId, ids);
|
||||
return this.exists(wrapperX);
|
||||
}
|
||||
}
|
||||
@@ -100,4 +100,12 @@ public interface MaterialBatchService {
|
||||
* @return 工段列表
|
||||
*/
|
||||
List<MaterialBatchDO> getMaterialBatchGongduanList(Long batId);
|
||||
|
||||
/**
|
||||
* 提交物料批次
|
||||
*
|
||||
* @param id 批次id
|
||||
* @return 是否
|
||||
*/
|
||||
Boolean submitMaterialBatch(Long id);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -238,9 +238,6 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
||||
// 分类
|
||||
if (DataTypeConstant.DATA_TYPE_CATEGORY.equals(pdtDo.getNodeType())) {
|
||||
// 分类下有子分类或大类时不可删除
|
||||
// boolean exists = materialProductMapper.exists(Wrappers.lambdaQuery(MaterialProductDO.class)
|
||||
// .like(MaterialProductDO::getIdPath, id)
|
||||
// .ne(MaterialProductDO::getId, id));
|
||||
boolean exists = materialProductMapper.exists(Wrappers.lambdaQuery(MaterialProductDO.class)
|
||||
.eq(MaterialProductDO::getParentId, id));
|
||||
if (exists) throw exception(MATERIAL_CATEGORY_EXISTS_CHILDREN);
|
||||
@@ -249,8 +246,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
||||
else {
|
||||
// 大类下有批次时不可删除
|
||||
// TODO 以及其他不可删除的情况,如库存记录、物料实例、使用记录等
|
||||
// boolean exists = materialBatchService.checkIsExistsDataByPdt(id);
|
||||
// if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
|
||||
boolean exists = materialProductMapper.checkIsExistsBatchByPdt(id);
|
||||
if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
|
||||
}
|
||||
materialProductMapper.deleteById(id);
|
||||
}
|
||||
@@ -267,8 +264,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
||||
if (CollUtil.isNotEmpty(mtCtgList)) throw exception(MATERIAL_PRODUCTS_EXISTS_CATEGORY);
|
||||
// 检查是否可删除 大类下有批次时不可删除
|
||||
// TODO 以及其他不可删除的情况,如库存记录、物料实例、使用记录等
|
||||
// boolean exists = materialBatchService.checkIsExistsDataByPdts(ids);
|
||||
// if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
|
||||
boolean exists = materialProductMapper.checkIsExistsDataByPdts(ids);
|
||||
if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
|
||||
// 删除
|
||||
materialProductMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user