diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisController.java index ae318b1..2d2ca38 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/admin/SampleAnalysisController.java @@ -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); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataPageReqVO.java index d6041ae..091c459 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataPageReqVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataReqVO.java index 462fcc0..00fdba9 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataReqVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataRespVO.java index c3a55c2..01f7130 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataRespVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataSaveReqVO.java index 191c685..71fb30d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayProjectDataSaveReqVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskPageReqVO.java index 3d62df8..9ede1ae 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskPageReqVO.java @@ -50,6 +50,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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskReqVO.java index 0ae445f..e8bcd07 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskReqVO.java @@ -49,6 +49,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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskRespVO.java index a6c9999..2bb7aa3 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskRespVO.java @@ -61,6 +61,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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskSaveReqVO.java index b00fc07..cbdfef1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/controller/vo/BusinessAssayTaskSaveReqVO.java @@ -59,6 +59,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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayProjectDataDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayProjectDataDO.java index d3bcdbc..3cd1e56 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayProjectDataDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayProjectDataDO.java @@ -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") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayTaskDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayTaskDO.java index 94f1b1d..47c8ac3 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayTaskDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/dataobject/BusinessAssayTaskDO.java @@ -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") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java index 57443c2..92238ab 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/dal/mapper/BusinessAssayProjectDataMapper.java @@ -56,6 +56,9 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX> getDeviceApplyPage(@Valid DeviceApplyPageReqVO pageReqVO) { PageResult pageResult = deviceApplyService.getDeviceApplyPage(pageReqVO); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialBatchController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialBatchController.java index 64dc814..1d4e8d4 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialBatchController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialBatchController.java @@ -93,8 +93,9 @@ public class MaterialBatchController implements BusinessControllerMarker { @Operation(summary = "获得物料批次分页") // @PreAuthorize("@ss.hasPermission('qms:material-batch:query')") public CommonResult> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) { - PageResult pageResult = materialBatchService.getMaterialBatchPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class)); + PageResult 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 submitMaterialBatch(@RequestParam("id") Long id) { + + return success(materialBatchService.submitMaterialBatch(id)); + } + @GetMapping("gongduan-page") @Operation(summary = "获取工段列表") @Parameter(name = "id", description = "物料批次 id", required = true, example = "1054") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchPageReqVO.java index f163611..5794760 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchPageReqVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchRespVO.java index 6c63e9e..482b37b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchRespVO.java @@ -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 children; + } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchSaveReqVO.java index d799a42..739973b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialBatchSaveReqVO.java @@ -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; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialBatchMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialBatchMapper.java index 8e2eafd..814ba55 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialBatchMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialBatchMapper.java @@ -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 { default PageResult selectPage(MaterialBatchPageReqVO reqVO) { - // TODO 需要层级穿透 分类-物料sku-批次 return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(MaterialBatchDO::getProductId, reqVO.getProductId()) .likeIfPresent(MaterialBatchDO::getBatchNo, reqVO.getBatchNo()) @@ -45,4 +43,30 @@ public interface MaterialBatchMapper extends BaseMapperX { .orderByDesc(MaterialBatchDO::getId)); } + default PageResult selectPage(MaterialBatchPageReqVO reqVO, List pdtIds) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapperX() + .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); + } + } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialProductMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialProductMapper.java index a2f67bd..bf3a9a5 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialProductMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialProductMapper.java @@ -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 { .orderByDesc(MaterialProductDO::getId)); } + default boolean checkIsExistsBatchByPdt(Long id){ + MPJLambdaWrapperX wrapperX = new MPJLambdaWrapperX() + .leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId) + .eq(MaterialBatchDO::getProductId, id); + return this.exists(wrapperX); + } + + default boolean checkIsExistsDataByPdts(List ids){ + MPJLambdaWrapperX wrapperX = new MPJLambdaWrapperX() + .leftJoin(MaterialBatchDO.class, MaterialBatchDO::getProductId, MaterialProductDO::getId) + .in(MaterialBatchDO::getProductId, ids); + return this.exists(wrapperX); + } } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchService.java index a185ce0..e20abc1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchService.java @@ -61,6 +61,14 @@ public interface MaterialBatchService { */ PageResult getMaterialBatchPage(MaterialBatchPageReqVO pageReqVO); + /** + * 获得物料批次分页-可根据物料分类和大类级联查询 + * + * @param pageReqVO 分页查询 + * @return 物料批次分页 + */ + PageResult getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO); + /** * 批次工段拆分 * @@ -92,4 +100,12 @@ public interface MaterialBatchService { * @return 工段列表 */ List getMaterialBatchGongduanList(Long batId); + + /** + * 提交物料批次 + * + * @param id 批次id + * @return 是否 + */ + Boolean submitMaterialBatch(Long id); } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchServiceImpl.java index 5d25a2a..0f1f285 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialBatchServiceImpl.java @@ -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 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 ids) { // 校验存在 - validateMaterialBatchExists(ids); - // 已经拆分的批次不可删除 - List asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class) - .in(MaterialBatchDO::getParentId, ids)); - if (CollUtil.isNotEmpty(asnDOs)) throw exception(MATERIAL_BATCH_ASSIGN_END); + List 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 getMaterialBatchPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) { + Long pdtId = pageReqVO.getProductId(); + PageResult pageResult; + if (pdtId == null) { + pageResult = materialBatchMapper.selectPage(pageReqVO, List.of()); + } else { + List mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId); + if (CollUtil.isEmpty(mtrlDos)) { + pageResult = materialBatchMapper.selectPage(pageReqVO, List.of()); + } else { + List pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList(); + pageResult = materialBatchMapper.selectPage(pageReqVO, pdtIds); + } + } + + if (!pageReqVO.getChildren()) return pageResult; + List voList = pageResult.getList(); + if (CollUtil.isNotEmpty(voList)) { + List treeVos = this.listTransTree(voList, 0L); + pageResult.setList(treeVos); + } + + return pageResult; + } + /** * 批次工段拆分 * @@ -134,8 +167,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { public List assignMaterialBatchGongduan(List createReqVOs) { // 是否已经拆分过 Long batId = createReqVOs.get(0).getParentId(); - List asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class) - .eq(MaterialBatchDO::getParentId, batId)); + // 1. 所属的批次需要是同一个 Set 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 gongEts = createReqVOs.stream().map( - batAsn -> BeanUtils.toBean(batAsn, MaterialBatchDO.class)).toList(); + List 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 listTransTree(List voList, Long parentId) { + + // 获取父级节点 + List parentVOs = voList.stream().filter(vo -> + vo.getParentId().equals(parentId)).collect(Collectors.toList()); + // 设置响应的子节点 + parentVOs.forEach(vo -> vo.setChildren(listTransTree(voList, vo.getId()))); + + return parentVOs; + } + } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductService.java index a5b8bdf..cf4063b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductService.java @@ -99,4 +99,11 @@ public interface MaterialProductService { * @return 物料大类分页 */ PageResult getMaterialInventoryPage(@Valid MaterialProductPageReqVO pageReqVO); + + /** + * 获取id在 idPath中的全部数据 + * @param pdtId id + * @return 物料数据 + */ + List getMaterialProductsByLikeIdPath(Long pdtId); } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductServiceImpl.java index 1a8bff6..e1a454d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialProductServiceImpl.java @@ -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 getMaterialProductsByLikeIdPath(Long pdtId) { + + return materialProductMapper.selectList(Wrappers.lambdaQuery(MaterialProductDO.class) + .like(MaterialProductDO::getIdPath, "/" + pdtId + "/") + .eq(MaterialProductDO::getNodeType, DataTypeConstant.DATA_TYPE_DATA)); + } + } \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/assist/MaterialProductBatchService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/assist/MaterialProductBatchService.java new file mode 100644 index 0000000..db8381e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/assist/MaterialProductBatchService.java @@ -0,0 +1,4 @@ +package com.zt.plat.module.qms.resource.material.service.assist; + +public class MaterialProductBatchService { +}