Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
FCL
2026-01-30 14:09:44 +08:00
29 changed files with 323 additions and 44 deletions

View File

@@ -57,13 +57,20 @@ public class SampleAnalysisController implements BusinessControllerMarker {
return success("成功");
}
//下发配料
//下发配料(自动火试金配料)
@PostMapping("/issuedIngredients")
public CommonResult<?> issuedIngredients(Long businessAssayTaskId) {
sampleAnalysisService.issuedIngredients(businessAssayTaskId);
return success("成功");
}
//人工配料
@PostMapping("/manualIngredients")
public CommonResult<?> manualIngredients(Long businessAssayTaskId) {
sampleAnalysisService.manualIngredients(businessAssayTaskId);
return success("成功");
}
@PostMapping("/submitSampleAnalysisByTaskId")
public CommonResult<?> submitSampleAnalysisByTaskId(Long businessAssayTaskId) {
sampleAnalysisService.submitSampleAnalysisByTaskId(businessAssayTaskId);

View File

@@ -5,6 +5,8 @@ import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -31,6 +33,15 @@ public class BusinessAssayProjectDataPageReqVO extends PageParam {
@Schema(description = "")
private String value;
@Schema(description = "补正系数ID", example = "1008")
private Long configAssayMethodProjectCoefficientId;
@Schema(description = "补正系数")
private BigDecimal coefficient;
@Schema(description = "补正后的值")
private String valueAfter;
@Schema(description = "数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间", example = "2")
private String dataType;

View File

@@ -5,6 +5,8 @@ import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -37,6 +39,15 @@ public class BusinessAssayProjectDataReqVO {
@Schema(description = "")
private String value;
@Schema(description = "补正系数ID", example = "1008")
private Long configAssayMethodProjectCoefficientId;
@Schema(description = "补正系数")
private BigDecimal coefficient;
@Schema(description = "补正后的值")
private String valueAfter;
@Schema(description = "数据类型,【字典】【jy_sample_data_type】string-字符串int-整数decimal-小数,date-日期datetime-时间", example = "1")
private String dataType;

View File

@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@@ -38,6 +40,15 @@ public class BusinessAssayProjectDataRespVO {
@ExcelProperty("")
private String value;
@Schema(description = "补正系数ID", example = "1008")
private Long configAssayMethodProjectCoefficientId;
@Schema(description = "补正系数")
private BigDecimal coefficient;
@Schema(description = "补正后的值")
private String valueAfter;
@Schema(description = "数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间")
private String dataType;

View File

@@ -2,6 +2,8 @@ package com.zt.plat.module.qms.business.bus.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import jakarta.validation.constraints.*;
@@ -27,6 +29,15 @@ public class BusinessAssayProjectDataSaveReqVO {
@Schema(description = "")
private String value;
@Schema(description = "补正系数ID", example = "1008")
private Long configAssayMethodProjectCoefficientId;
@Schema(description = "补正系数")
private BigDecimal coefficient;
@Schema(description = "补正后的值")
private String valueAfter;
@Schema(description = "数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间不能为空")
private String dataType;

View File

@@ -51,6 +51,9 @@ public class BusinessAssayTaskPageReqVO extends PageParam {
@Schema(description = "是否配料,1-是0-否")
private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus;

View File

@@ -50,6 +50,9 @@ public class BusinessAssayTaskReqVO {
@Schema(description = "是否配料,1-是0-否")
private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus;

View File

@@ -62,6 +62,9 @@ public class BusinessAssayTaskRespVO {
@Schema(description = "是否配料,1-是0-否")
private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus;

View File

@@ -60,6 +60,9 @@ public class BusinessAssayTaskSaveReqVO {
@Schema(description = "是否配料,1-是0-否")
private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus;

View File

@@ -2,8 +2,8 @@ package com.zt.plat.module.qms.business.bus.dal.dataobject;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
/**
@@ -62,6 +62,21 @@ public class BusinessAssayProjectDataDO extends BusinessBaseDO {
@TableField(value = "VAL", updateStrategy = FieldStrategy.ALWAYS)
private String value;
/**
* 补正系数ID
*/
@TableField(value = "CFG_ASY_MTHD_PRJ_COEF_ID", updateStrategy = FieldStrategy.ALWAYS)
private Long configAssayMethodProjectCoefficientId;
/**
* 补正系数
*/
@TableField(value = "COEF", updateStrategy = FieldStrategy.ALWAYS)
private BigDecimal coefficient;
/**
* 补正后的值
*/
@TableField(value = "VAL_AFT", updateStrategy = FieldStrategy.ALWAYS)
private String valueAfter;
/**
* 数据类型,字典表【T_DIC_BSN】string-字符串int-整数decimal-小数,date-日期datetime-时间
*/
@TableField("DAT_TP")

View File

@@ -90,6 +90,11 @@ public class BusinessAssayTaskDO extends BusinessBaseDO {
@TableField("IS_IGDT")
private Integer isIngredients;
/**
* 配料方式,初始状态-initial、自动配料-automatic、人工配料-manual
*/
@TableField("IGDT_WY")
private String ingredientsWay;
/**
* 配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit
*/
@TableField("IGDT_STS")

View File

@@ -56,6 +56,9 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
.eqIfPresent(BusinessAssayProjectDataDO::getUsage, reqVO.getUsage())
.eqIfPresent(BusinessAssayProjectDataDO::getSymbol, reqVO.getSymbol())
.eqIfPresent(BusinessAssayProjectDataDO::getValue, reqVO.getValue())
.eqIfPresent(BusinessAssayProjectDataDO::getConfigAssayMethodProjectCoefficientId, reqVO.getConfigAssayMethodProjectCoefficientId())
.eqIfPresent(BusinessAssayProjectDataDO::getCoefficient, reqVO.getCoefficient())
.eqIfPresent(BusinessAssayProjectDataDO::getValueAfter, reqVO.getValueAfter())
.eqIfPresent(BusinessAssayProjectDataDO::getDataType, reqVO.getDataType())
.eqIfPresent(BusinessAssayProjectDataDO::getDecimalPosition, reqVO.getDecimalPosition())
.eqIfPresent(BusinessAssayProjectDataDO::getIsNotAssessment, reqVO.getIsNotAssessment())
@@ -75,6 +78,9 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
.eqIfPresent(BusinessAssayProjectDataDO::getUsage, reqVO.getUsage())
.eqIfPresent(BusinessAssayProjectDataDO::getSymbol, reqVO.getSymbol())
.eqIfPresent(BusinessAssayProjectDataDO::getValue, reqVO.getValue())
.eqIfPresent(BusinessAssayProjectDataDO::getConfigAssayMethodProjectCoefficientId, reqVO.getConfigAssayMethodProjectCoefficientId())
.eqIfPresent(BusinessAssayProjectDataDO::getCoefficient, reqVO.getCoefficient())
.eqIfPresent(BusinessAssayProjectDataDO::getValueAfter, reqVO.getValueAfter())
.eqIfPresent(BusinessAssayProjectDataDO::getDataType, reqVO.getDataType())
.eqIfPresent(BusinessAssayProjectDataDO::getDecimalPosition, reqVO.getDecimalPosition())
.eqIfPresent(BusinessAssayProjectDataDO::getIsNotAssessment, reqVO.getIsNotAssessment())

View File

@@ -42,6 +42,7 @@ public interface BusinessAssayTaskMapper extends BaseMapperX<BusinessAssayTaskDO
.eqIfPresent(BusinessAssayTaskDO::getTaskAssignStatus, reqVO.getTaskAssignStatus())
.betweenIfPresent(BusinessAssayTaskDO::getTaskAssignSubmitTime, reqVO.getTaskAssignSubmitTime())
.eqIfPresent(BusinessAssayTaskDO::getIsIngredients, reqVO.getIsIngredients())
.eqIfPresent(BusinessAssayTaskDO::getIngredientsWay, reqVO.getIngredientsWay())
.eqIfPresent(BusinessAssayTaskDO::getIngredientsStatus, reqVO.getIngredientsStatus())
.eqIfPresent(BusinessAssayTaskDO::getAssayOperator, reqVO.getAssayOperator())
.eqIfPresent(BusinessAssayTaskDO::getAssayOperatorId, reqVO.getAssayOperatorId())
@@ -89,6 +90,7 @@ public interface BusinessAssayTaskMapper extends BaseMapperX<BusinessAssayTaskDO
.eqIfPresent(BusinessAssayTaskDO::getTaskAssignStatus, reqVO.getTaskAssignStatus())
.betweenIfPresent(BusinessAssayTaskDO::getTaskAssignSubmitTime, reqVO.getTaskAssignSubmitTime())
.eqIfPresent(BusinessAssayTaskDO::getIsIngredients, reqVO.getIsIngredients())
.eqIfPresent(BusinessAssayTaskDO::getIngredientsWay, reqVO.getIngredientsWay())
.eqIfPresent(BusinessAssayTaskDO::getIngredientsStatus, reqVO.getIngredientsStatus())
.eqIfPresent(BusinessAssayTaskDO::getAssayOperator, reqVO.getAssayOperator())
.eqIfPresent(BusinessAssayTaskDO::getAssayOperatorId, reqVO.getAssayOperatorId())

View File

@@ -30,11 +30,17 @@ public interface SampleAnalysisService {
BusinessAssayTaskAnalysisSampleAndQcProjectRespVO batchSampleAndQcAnalysisByTaskId(Long businessAssayTaskId);
/**
* 下发配料
* 下发配料(自动火试金配料)
* @param businessAssayTaskId
*/
void issuedIngredients(Long businessAssayTaskId);
/**
* 人工配料
* @param businessAssayTaskId
*/
void manualIngredients(Long businessAssayTaskId);
/**
* 根据任务单id提交分析数据
* @param businessAssayTaskId 任务单id
@@ -57,4 +63,5 @@ public interface SampleAnalysisService {
void rollbackAnalysisSample(BusinessAssayTaskBackSampleReqVO req);
}

View File

@@ -1433,8 +1433,18 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
}
}
businessAssayTaskDO.setIngredientsWay(QmsCommonConstant.AUTOMATIC);//自动火试金配料
businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS);
businessAssayTaskMapper.updateById(businessAssayTaskDO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void manualIngredients(Long businessAssayTaskId) {
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
businessAssayTaskDO.setIngredientsWay(QmsCommonConstant.MANUAL);//人工配料
businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS);//表示为允许提交
businessAssayTaskMapper.updateById(businessAssayTaskDO);
}
}

View File

@@ -444,7 +444,7 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
businessAssayTaskDataDO.setAssayType(assayType);
businessAssayTaskDataDO.setTaskType("复测");
businessAssayTaskDataDO.setConfigSampleFlowId(businessSubSampleDO.getConfigSampleFlowId());
businessAssayTaskDataDO.setSampleFlowNodeKey(businessSubSampleDO.getSampleFlowNodeKey());
businessAssayTaskDataDO.setSampleFlowNodeKey(QmsCommonConstant.FLOW_NODE_ANALYSIS);
businessAssayTaskDataDO.setSampleFlowNodeTime(LocalDateTime.now());
businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId());
businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName());

View File

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
import com.alibaba.qlexpress4.Express4Runner;
import com.alibaba.qlexpress4.QLOptions;
import com.alibaba.qlexpress4.QLResult;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@@ -87,8 +88,8 @@ public class AllowanceCalculatorComponent {
try {
// Object result = expressRunner.execute(formula, context, null, true, false);
Object result = express4Runner.execute(formula, context, QLOptions.builder().precise(true).build());
QLResult execute = express4Runner.execute(formula, context, QLOptions.builder().precise(true).build());
Object result = execute.getResult();
if (result == null) {
throw new RuntimeException("Express 公式返回结果为 null");
}

View File

@@ -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);

View File

@@ -93,8 +93,9 @@ public class MaterialBatchController implements BusinessControllerMarker {
@Operation(summary = "获得物料批次分页")
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) {
PageResult<MaterialBatchDO> pageResult = materialBatchService.getMaterialBatchPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class));
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
// return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class));
return success(pageResult);
}
@GetMapping("/export-excel")
@@ -117,6 +118,14 @@ public class MaterialBatchController implements BusinessControllerMarker {
return success(materialBatchService.assignMaterialBatchGongduan(createReqVOs));
}
@PutMapping("/submit")
@Operation(summary = "提交物料批次")
@Parameter(name = "id", required = true)
public CommonResult<Boolean> submitMaterialBatch(@RequestParam("id") Long id) {
return success(materialBatchService.submitMaterialBatch(id));
}
@GetMapping("gongduan-page")
@Operation(summary = "获取工段列表")
@Parameter(name = "id", description = "物料批次 id", required = true, example = "1054")

View File

@@ -19,6 +19,9 @@ public class MaterialBatchPageReqVO extends PageParam {
@Schema(description = "物料大类id", example = "9381")
private Long productId;
@Schema(description = "是否需要组装 children")
private Boolean children = false;
@Schema(description = "批次编号")
private String batchNo;

View File

@@ -7,6 +7,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 物料批次 Response VO")
@@ -26,6 +28,18 @@ public class MaterialBatchRespVO {
@ExcelProperty("物料大类id")
private Long productId;
@Schema(description = "物料大类名称")
@ExcelProperty("物料大类名称")
private String productName;
@Schema(description = "物料大类编码")
@ExcelProperty("物料大类编码")
private String productCode;
@Schema(description = "物料大类型号")
@ExcelProperty("物料大类型号")
private String productModelNo;
@Schema(description = "批次编号")
@ExcelProperty("批次编号")
private String batchNo;
@@ -44,11 +58,11 @@ public class MaterialBatchRespVO {
@Schema(description = "生产日期")
@ExcelProperty("生产日期")
private LocalDate manufacturerDate;
private LocalDateTime manufacturerDate;
@Schema(description = "到期日期")
@ExcelProperty("到期日期")
private LocalDate dueDate;
private LocalDateTime dueDate;
@Schema(description = "分配部门id")
@ExcelProperty("分配部门id")
@@ -90,4 +104,7 @@ public class MaterialBatchRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "子批次-工段")
private List<MaterialBatchRespVO> children;
}

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zt.plat.module.qms.resource.material.valid.AddGroup;
import com.zt.plat.module.qms.resource.material.valid.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -10,6 +11,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 物料批次新增/修改 Request VO")
@Data
@@ -43,10 +45,10 @@ public class MaterialBatchSaveReqVO {
@Schema(description = "生产日期")
@NotNull(groups = AddGroup.class, message = "生产日期不能为空")
private LocalDate manufacturerDate;
private LocalDateTime manufacturerDate;
@Schema(description = "到期日期")
private LocalDate dueDate;
private LocalDateTime dueDate;
@Schema(description = "分配部门id")
private Long assignDepartmentId;

View File

@@ -1,19 +1,18 @@
package com.zt.plat.module.qms.resource.material.dal.mapper;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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.MaterialBatchPageReqVO;
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.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Arrays;
import java.util.List;
/**
@@ -25,7 +24,6 @@ import java.util.List;
public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
default PageResult<MaterialBatchDO> selectPage(MaterialBatchPageReqVO reqVO) {
// TODO 需要层级穿透 分类-物料sku-批次
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialBatchDO>()
.eqIfPresent(MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfPresent(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
@@ -45,4 +43,30 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.orderByDesc(MaterialBatchDO::getId));
}
default PageResult<MaterialBatchRespVO> selectPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
.selectAll(MaterialBatchDO.class)
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
.likeIfExists(MaterialBatchDO::getLocation, reqVO.getLocation())
.likeIfExists(MaterialBatchDO::getSupplierId, reqVO.getSupplierId())
// .betweenIfPresent(MaterialBatchDO::getManufacturerDate, reqVO.getManufacturerDate())
// .betweenIfPresent(MaterialBatchDO::getDueDate, reqVO.getDueDate())
.eqIfExists(MaterialBatchDO::getAssignDepartmentId, reqVO.getAssignDepartmentId())
.likeIfExists(MaterialBatchDO::getAssignDepartmentName, reqVO.getAssignDepartmentName())
.eqIfExists(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.eqIfExists(MaterialBatchDO::getAssayFlag, reqVO.getAssayFlag())
.eqIfExists(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus())
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark())
// .betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialBatchDO::getId);
return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper);
}
}

View File

@@ -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);
}
}

View File

@@ -61,6 +61,14 @@ public interface MaterialBatchService {
*/
PageResult<MaterialBatchDO> getMaterialBatchPage(MaterialBatchPageReqVO pageReqVO);
/**
* 获得物料批次分页-可根据物料分类和大类级联查询
*
* @param pageReqVO 分页查询
* @return 物料批次分页
*/
PageResult<MaterialBatchRespVO> getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO);
/**
* 批次工段拆分
*
@@ -92,4 +100,12 @@ public interface MaterialBatchService {
* @return 工段列表
*/
List<MaterialBatchDO> getMaterialBatchGongduanList(Long batId);
/**
* 提交物料批次
*
* @param id 批次id
* @return 是否
*/
Boolean submitMaterialBatch(Long id);
}

View File

@@ -3,14 +3,16 @@ package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.protobuf.ServiceException;
import com.zt.plat.framework.common.exception.ErrorCode;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.core.code.SequenceUtil;
import com.zt.plat.module.qms.enums.ErrorCodeConstants;
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.MaterialBatchSaveReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
@@ -44,6 +46,9 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Autowired
private SequenceUtil sequenceUtil;
@Autowired
private MaterialProductService materialProductService;
private final String sequenceKey = "QMS_MATERIAL_BATCH_NO";
@Override
@@ -79,13 +84,11 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Override
public void deleteMaterialBatch(Long id) {
// 校验存在
validateMaterialBatchExists(id);
// 已经拆分的批次不可删除
List<MaterialBatchDO> asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, id));
if (CollUtil.isNotEmpty(asnDOs)) throw exception(MATERIAL_BATCH_ASSIGN_END);
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
if (batchDO == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
if (batchDO.getSubmitStatus() == 1)
throw new ServiceException(1_032_160_000, "批次已经提交,不可删除");
// 删除
materialBatchMapper.deleteById(id);
@@ -94,11 +97,15 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Override
public void deleteMaterialBatchListByIds(List<Long> ids) {
// 校验存在
validateMaterialBatchExists(ids);
// 已经拆分的批次不可删除
List<MaterialBatchDO> asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class)
.in(MaterialBatchDO::getParentId, ids));
if (CollUtil.isNotEmpty(asnDOs)) throw exception(MATERIAL_BATCH_ASSIGN_END);
List<MaterialBatchDO> list = materialBatchMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(MATERIAL_BATCH_NOT_EXISTS);
}
// 存在已经提交的批次时,不可删除
for (MaterialBatchDO batch : list) {
if (batch.getSubmitStatus() == 1)
throw new ServiceException(1_032_160_000, "存在已经提交的批次,不可删除");
}
// 删除
materialBatchMapper.deleteByIds(ids);
}
@@ -126,6 +133,32 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
return materialBatchMapper.selectPage(pageReqVO);
}
@Override
public PageResult<MaterialBatchRespVO> getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
Long pdtId = pageReqVO.getProductId();
PageResult<MaterialBatchRespVO> pageResult;
if (pdtId == null) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of());
} else {
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of());
} else {
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
pageResult = materialBatchMapper.selectPage(pageReqVO, pdtIds);
}
}
if (!pageReqVO.getChildren()) return pageResult;
List<MaterialBatchRespVO> voList = pageResult.getList();
if (CollUtil.isNotEmpty(voList)) {
List<MaterialBatchRespVO> treeVos = this.listTransTree(voList, 0L);
pageResult.setList(treeVos);
}
return pageResult;
}
/**
* 批次工段拆分
*
@@ -134,8 +167,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
public List<MaterialBatchRespVO> assignMaterialBatchGongduan(List<MaterialBatchSaveReqVO> createReqVOs) {
// 是否已经拆分过
Long batId = createReqVOs.get(0).getParentId();
List<MaterialBatchDO> asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId));
// 1. 所属的批次需要是同一个
Set<Long> pIds = createReqVOs.stream().map(MaterialBatchSaveReqVO::getParentId).collect(Collectors.toSet());
if (pIds.size() > 1) throw exception(GONGDUAN_BELONG_MATERIAL_BATCH_NOT_EQUAL);
@@ -148,18 +180,24 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
for (MaterialBatchSaveReqVO batAsn : createReqVOs) {
total = total.add(batAsn.getInboundQuantity());
}
if (!total.equals(mtrlBat.getInboundQuantity()))
if (total.compareTo(mtrlBat.getInboundQuantity()) != 0)
throw exception(GONGDUAN_QUANTITY_MATERIAL_BATCH_NOT_EQUAL);
// 修改工段
if (CollUtil.isNotEmpty(asnDOs)) {
// 删除之前的拆分数据TODO 需要检查是否可以删除
boolean exists = materialBatchMapper.exists(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId));
if (exists) {
if (mtrlBat.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,禁止修改");
// 删除之前的拆分数据
materialBatchMapper.delete(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId));
}
// 3. 保存工段
List<MaterialBatchDO> gongEts = createReqVOs.stream().map(
batAsn -> BeanUtils.toBean(batAsn, MaterialBatchDO.class)).toList();
List<MaterialBatchDO> gongEts = createReqVOs.stream().map(batAsn -> {
MaterialBatchDO bean = BeanUtils.toBean(batAsn, MaterialBatchDO.class);
bean.setProductId(mtrlBat.getProductId());
return bean;
}).toList();
materialBatchMapper.insertBatch(gongEts);
return gongEts.stream().map(
@@ -194,4 +232,32 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
.ne(MaterialBatchDO::getParentId, 0));
}
@Override
public Boolean submitMaterialBatch(Long id) {
MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
if (batchDO == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
if (batchDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交过");
boolean exists = materialBatchMapper.exists(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, id));
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
batchDO.setSubmitStatus(1);
materialBatchMapper.updateById(batchDO);
return true;
}
/**
* 组装物料批次树
*
*/
private List<MaterialBatchRespVO> listTransTree(List<MaterialBatchRespVO> voList, Long parentId) {
// 获取父级节点
List<MaterialBatchRespVO> parentVOs = voList.stream().filter(vo ->
vo.getParentId().equals(parentId)).collect(Collectors.toList());
// 设置响应的子节点
parentVOs.forEach(vo -> vo.setChildren(listTransTree(voList, vo.getId())));
return parentVOs;
}
}

View File

@@ -99,4 +99,11 @@ public interface MaterialProductService {
* @return 物料大类分页
*/
PageResult<MaterialProductRespVO> getMaterialInventoryPage(@Valid MaterialProductPageReqVO pageReqVO);
/**
* 获取id在 idPath中的全部数据
* @param pdtId id
* @return 物料数据
*/
List<MaterialProductDO> getMaterialProductsByLikeIdPath(Long pdtId);
}

View File

@@ -40,8 +40,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
@Resource
private MaterialProductMapper materialProductMapper;
@Autowired
private MaterialBatchService materialBatchService;
// @Autowired
// private MaterialBatchService materialBatchService;
@Autowired
private MaterialInfomationService materialInfomationService;
@@ -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,7 +246,7 @@ public class MaterialProductServiceImpl implements MaterialProductService {
else {
// 大类下有批次时不可删除
// TODO 以及其他不可删除的情况,如库存记录、物料实例、使用记录等
boolean exists = materialBatchService.checkIsExistsDataByPdt(id);
boolean exists = materialProductMapper.checkIsExistsBatchByPdt(id);
if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
}
materialProductMapper.deleteById(id);
@@ -267,7 +264,7 @@ public class MaterialProductServiceImpl implements MaterialProductService {
if (CollUtil.isNotEmpty(mtCtgList)) throw exception(MATERIAL_PRODUCTS_EXISTS_CATEGORY);
// 检查是否可删除 大类下有批次时不可删除
// TODO 以及其他不可删除的情况,如库存记录、物料实例、使用记录等
boolean exists = materialBatchService.checkIsExistsDataByPdts(ids);
boolean exists = materialProductMapper.checkIsExistsDataByPdts(ids);
if (exists) throw exception(MATERIAL_PRODUCT_EXISTS_BATCH);
// 删除
materialProductMapper.deleteByIds(ids);
@@ -339,4 +336,12 @@ public class MaterialProductServiceImpl implements MaterialProductService {
return new PageResult<>(voList, pageResult.getTotal());
}
@Override
public List<MaterialProductDO> getMaterialProductsByLikeIdPath(Long pdtId) {
return materialProductMapper.selectList(Wrappers.lambdaQuery(MaterialProductDO.class)
.like(MaterialProductDO::getIdPath, "/" + pdtId + "/")
.eq(MaterialProductDO::getNodeType, DataTypeConstant.DATA_TYPE_DATA));
}
}

View File

@@ -0,0 +1,4 @@
package com.zt.plat.module.qms.resource.material.service.assist;
public class MaterialProductBatchService {
}