From c6f4034685ad845fb3417dfcb2d5bc107a59915d Mon Sep 17 00:00:00 2001 From: shusir <497819738@qq.com> Date: Thu, 5 Feb 2026 18:02:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=89=A9=E6=96=99=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/qms/enums/ErrorCodeConstants.java | 1 + .../MaterialInventoryInboundController.java | 12 +- ...erialInventoryInboundDetailController.java | 16 +-- .../controller/vo/MaterialBatchPageReqVO.java | 3 + .../controller/vo/MaterialBatchRespVO.java | 5 + .../vo/MaterialInfomationPageReqVO.java | 4 + .../vo/MaterialInfomationRespVO.java | 5 + .../vo/MaterialInfomationSaveReqVO.java | 7 +- .../MaterialInventoryInboundDetailRespVO.java | 6 + .../vo/MaterialInventoryInboundSaveReqVO.java | 3 +- .../dal/dataobject/MaterialBatchDO.java | 5 + .../dal/dataobject/MaterialInfomationDO.java | 47 +++++++- .../dal/mapper/MaterialBatchMapper.java | 49 +++++++- .../service/MaterialBatchService.java | 15 +++ .../service/MaterialBatchServiceImpl.java | 54 +++++++-- .../service/MaterialInfomationService.java | 7 ++ .../MaterialInfomationServiceImpl.java | 5 + ...MaterialInventoryInboundDetailService.java | 6 + ...rialInventoryInboundDetailServiceImpl.java | 5 + .../MaterialInventoryInboundServiceImpl.java | 112 ++++++++++++++++-- .../MaterialLifecycleDetailService.java | 12 +- .../MaterialLifecycleDetailServiceImpl.java | 18 ++- .../service/MaterialLifecycleServiceImpl.java | 7 +- 23 files changed, 346 insertions(+), 58 deletions(-) diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java index d2effe5..1f38d2a 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java @@ -182,6 +182,7 @@ public interface ErrorCodeConstants { ErrorCode MATERIAL_LIFECYCLE_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料通用流程不存在"); ErrorCode MATERIAL_BATCH_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料批次不存在"); + ErrorCode MATERIAL_BATCH_GONG_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料批次工段不存在"); ErrorCode MATERIAL_BATCH_ASSIGN_END = new ErrorCode(1_032_160_000, "物料批次已拆分,不可操作"); ErrorCode GONGDUAN_BELONG_MATERIAL_BATCH_NOT_EQUAL = new ErrorCode(1_032_160_000, "工段所属的物料批次不一致"); ErrorCode GONGDUAN_QUANTITY_MATERIAL_BATCH_NOT_EQUAL = new ErrorCode(1_032_160_000, "工段累加数量和批次数量不一致"); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundController.java index 50f4da3..de7c1b8 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundController.java @@ -30,7 +30,7 @@ import java.util.List; import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static com.zt.plat.framework.common.pojo.CommonResult.success; -@Tag(name = "管理后台 - 入库") +@Tag(name = "管理后台 - 物料入库") @RestController @RequestMapping("/qms/resource/material-inventory-inbound") @Validated @@ -41,21 +41,13 @@ public class MaterialInventoryInboundController implements BusinessControllerMar @Resource private MaterialInventoryInboundService materialInventoryInboundService; - @PostMapping("/create") + @PostMapping("/add") @Operation(summary = "物料入库") // @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:create')") public CommonResult createMaterialInventoryInbound(@Valid @RequestBody MaterialInventoryInboundSaveReqVO createReqVO) { return success(materialInventoryInboundService.createMaterialInventoryInbound(createReqVO)); } - @PutMapping("/update") - @Operation(summary = "更新入库") - @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:update')") - public CommonResult updateMaterialInventoryInbound(@Valid @RequestBody MaterialInventoryInboundSaveReqVO updateReqVO) { - materialInventoryInboundService.updateMaterialInventoryInbound(updateReqVO); - return success(true); - } - @DeleteMapping("/delete") @Operation(summary = "删除入库") @Parameter(name = "id", description = "编号", required = true) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundDetailController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundDetailController.java index 78b6e86..11b1481 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundDetailController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryInboundDetailController.java @@ -31,7 +31,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 入库明细,验收入库、盘盈入库等") @RestController -@RequestMapping("/t/material-inventory-inbound-detail") +@RequestMapping("/qms/resource/material-inventory-inbound-detail") @Validated public class MaterialInventoryInboundDetailController implements BusinessControllerMarker { @@ -41,14 +41,14 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @PostMapping("/create") @Operation(summary = "创建入库明细,验收入库、盘盈入库等") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:create')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:create')") public CommonResult createMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO createReqVO) { return success(materialInventoryInboundDetailService.createMaterialInventoryInboundDetail(createReqVO)); } @PutMapping("/update") @Operation(summary = "更新入库明细,验收入库、盘盈入库等") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:update')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:update')") public CommonResult updateMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO updateReqVO) { materialInventoryInboundDetailService.updateMaterialInventoryInboundDetail(updateReqVO); return success(true); @@ -57,7 +57,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @DeleteMapping("/delete") @Operation(summary = "删除入库明细,验收入库、盘盈入库等") @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:delete')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')") public CommonResult deleteMaterialInventoryInboundDetail(@RequestParam("id") Long id) { materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetail(id); return success(true); @@ -66,7 +66,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @DeleteMapping("/delete-list") @Parameter(name = "ids", description = "编号", required = true) @Operation(summary = "批量删除入库明细,验收入库、盘盈入库等") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:delete')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')") public CommonResult deleteMaterialInventoryInboundDetailList(@RequestBody BatchDeleteReqVO req) { materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetailListByIds(req.getIds()); return success(true); @@ -75,7 +75,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @GetMapping("/get") @Operation(summary = "获得入库明细,验收入库、盘盈入库等") @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:query')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')") public CommonResult getMaterialInventoryInboundDetail(@RequestParam("id") Long id) { MaterialInventoryInboundDetailDO materialInventoryInboundDetail = materialInventoryInboundDetailService.getMaterialInventoryInboundDetail(id); return success(BeanUtils.toBean(materialInventoryInboundDetail, MaterialInventoryInboundDetailRespVO.class)); @@ -83,7 +83,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @GetMapping("/page") @Operation(summary = "获得入库明细,验收入库、盘盈入库等分页") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:query')") +// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')") public CommonResult> getMaterialInventoryInboundDetailPage(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) { PageResult pageResult = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPage(pageReqVO); return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundDetailRespVO.class)); @@ -91,7 +91,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @GetMapping("/export-excel") @Operation(summary = "导出入库明细,验收入库、盘盈入库等 Excel") - @PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:export')") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:export')") @ApiAccessLog(operateType = EXPORT) public void exportMaterialInventoryInboundDetailExcel(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO, HttpServletResponse response) throws IOException { 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 37287c3..ef09a6e 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 @@ -25,6 +25,9 @@ public class MaterialBatchPageReqVO extends PageParam { @Schema(description = "是否只需要工段") private Boolean onlyGong = false; + @Schema(description = "true-已处理,false-未处理") + private Boolean treatment = 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 482b37b..f7f8291 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 @@ -1,5 +1,6 @@ package com.zt.plat.module.qms.resource.material.controller.vo; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; @@ -48,6 +49,10 @@ public class MaterialBatchRespVO { @ExcelProperty("总数量") private BigDecimal inboundQuantity; + @Schema(description = "已入库数量") + @ExcelProperty("已入库数量") + private BigDecimal inboundEndQuantity; + @Schema(description = "存放位置描述") @ExcelProperty("存放位置描述") private String location; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationPageReqVO.java index 215b82b..5cac762 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationPageReqVO.java @@ -1,5 +1,6 @@ package com.zt.plat.module.qms.resource.material.controller.vo; +import com.alibaba.excel.annotation.ExcelProperty; import lombok.*; import io.swagger.v3.oas.annotations.media.Schema; import com.zt.plat.framework.common.pojo.PageParam; @@ -26,6 +27,9 @@ public class MaterialInfomationPageReqVO extends PageParam { @Schema(description = "编码") private String code; + @Schema(description = "名称") + private String name; + @Schema(description = "技术参数") private String parameter; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationRespVO.java index 663cf72..e411569 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationRespVO.java @@ -1,5 +1,6 @@ package com.zt.plat.module.qms.resource.material.controller.vo; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; @@ -33,6 +34,10 @@ public class MaterialInfomationRespVO { @ExcelProperty("编码") private String code; + @Schema(description = "名称") + @ExcelProperty("名称") + private String name; + @Schema(description = "技术参数") @ExcelProperty("技术参数") private String parameter; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationSaveReqVO.java index 45d85b0..585bc03 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInfomationSaveReqVO.java @@ -1,9 +1,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import jakarta.validation.constraints.*; -import org.springframework.format.annotation.DateTimeFormat; +import lombok.Data; import java.time.LocalDate; import java.time.LocalDateTime; @@ -27,6 +25,9 @@ public class MaterialInfomationSaveReqVO { @Schema(description = "编码") private String code; + @Schema(description = "名称") + private String name; + @Schema(description = "技术参数") private String parameter; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundDetailRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundDetailRespVO.java index 4aa17bf..1350fea 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundDetailRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundDetailRespVO.java @@ -24,10 +24,16 @@ public class MaterialInventoryInboundDetailRespVO { @ExcelProperty("批次id") private Long batchId; + // 物料名称 + + // 批次编号 + @Schema(description = "批次工段id", example = "1454") @ExcelProperty("批次工段id") private Long batchGongduanId; + // 工段名 + @Schema(description = "物料实例ID", example = "17457") @ExcelProperty("物料实例ID") private Long materialInfomationId; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundSaveReqVO.java index e283109..5580326 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryInboundSaveReqVO.java @@ -1,7 +1,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo; -import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; import lombok.Data; import java.math.BigDecimal; @@ -48,6 +48,7 @@ public class MaterialInventoryInboundSaveReqVO { private Long gongduanId; @Schema(description = "入库数量") + @Min(value = 0, message = "入库数量不能小于0") private BigDecimal quantity; @Schema(description = "库位id") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialBatchDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialBatchDO.java index 15fcdd7..a543a43 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialBatchDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialBatchDO.java @@ -53,6 +53,11 @@ public class MaterialBatchDO extends BusinessBaseDO { @TableField("INB_QTY") private BigDecimal inboundQuantity; /** + * 已入库数量 + */ + @TableField("INB_END_QTY") + private BigDecimal inboundEndQuantity; + /** * 存放位置描述 */ @TableField("LOC") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInfomationDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInfomationDO.java index 4184d26..768b00a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInfomationDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInfomationDO.java @@ -46,17 +46,57 @@ public class MaterialInfomationDO extends BusinessBaseDO { * 存放位置 */ @TableField("LOC_ID") - private String locationId; + private Long locationId; + /** + * 工段id + */ + @TableField("GONG_ID") + private Long gongduanId; /** * 编码 */ @TableField("CD") private String code; /** + * 名称 + */ + @TableField("NAME") + private String name; + /** + * 型号 + */ + @TableField("MDL_NO") + private String modelNo; + /** + * 规格 + */ + @TableField("SPEC") + private String specification; + /** * 技术参数 */ @TableField("PRM") private String parameter; + /** + * 制造商 + */ + @TableField("MFR") + private String manufacturer; + /** + * 单位 + */ + @TableField("UNT") + private String unit; + /** + * 保质期(天) + */ + @TableField("DUE") + private Integer due; + /** + * 开封后保质期(天) + */ + @TableField("OPN_DUE_AFT") + private Integer openDueAfter; /** * 上架状态,0-未上架,1-已上架 */ @@ -107,6 +147,11 @@ public class MaterialInfomationDO extends BusinessBaseDO { */ @TableField("OPN_DT") private LocalDateTime openDate; + /** + * 生产日期 + */ + @TableField("MFR_DT") + private LocalDate manufacturerDate; /** * 到期日期 */ 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 6033e2b..a9b989d 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 @@ -8,6 +8,7 @@ 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.enums.QmsCommonConstant; 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; @@ -74,7 +75,6 @@ public interface MaterialBatchMapper extends BaseMapperX { default PageResult selectGongPage(MaterialBatchPageReqVO reqVO, List pdtIds) { - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); Long visitDeptId = null; if (loginUser != null) { @@ -99,8 +99,6 @@ public interface MaterialBatchMapper extends BaseMapperX { .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()) @@ -108,7 +106,50 @@ public interface MaterialBatchMapper extends BaseMapperX { .eqIfExists(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus()) .eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark()) -// .betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialBatchDO::getParentId); + return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper); + } + + default PageResult selectAcceptedGongPage(MaterialBatchPageReqVO reqVO, List pdtIds) { + + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + Long visitDeptId = null; + if (loginUser != null) { + visitDeptId = loginUser.getVisitDeptId(); + } + MPJLambdaWrapper wrapper = new MPJLambdaWrapperX() + .selectAll(MaterialBatchDO.class) + .selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName) + .selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode) + .selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo) + .selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate) + .selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate) + .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId) + .leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialBatchDO::getParentId) + // 只查询工段 + .ne(MaterialBatchDO::getParentId, 0) + .eq(MaterialBatchDO::getSubmitStatus, 1) + .eq(MaterialBatchDO::getAcceptanceStatus, QmsCommonConstant.COMPLETED) + // .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()) + .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()) + // 已处理 + .le(reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity) + // 未处理 + .gt(!reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity) +// .between(reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2, MaterialBatchDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1]) .orderByDesc(MaterialBatchDO::getParentId); return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper); } 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 65895e5..c1fa058 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 @@ -124,4 +124,19 @@ public interface MaterialBatchService { * @return 分页数据 */ PageResult getMaterialBatchGongPageWithPdtInfo(@Valid MaterialBatchPageReqVO pageReqVO); + + /** + * 更新批次工段入库数量 + * + * @param gongDO 批次工段信息 + */ + void updateMaterialBatchInbEndQty(MaterialBatchDO gongDO); + + /** + * 更新批次工段验收状态 + * + * @param lfcId 流程id + * @param status 验收状态 + */ + void updateMaterialBatchAcceptStatusByLfcId(Long lfcId, String status); } \ 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 be6ff11..0dc2faa 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 @@ -6,10 +6,12 @@ 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.QmsCommonConstant; 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.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 com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper; import jakarta.annotation.Resource; @@ -43,7 +45,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { @Autowired private MaterialProductService materialProductService; - private final String sequenceKey = "QMS_MATERIAL_BATCH_NO"; + @Autowired + private MaterialLifecycleDetailService materialLifecycleDetailService; + + private final String batchSequenceKey = "QMS_MATERIAL_BATCH_NO"; @Override public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) { @@ -51,7 +56,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class); // 批次编号 - mtrlBat.setBatchNo(sequenceUtil.genCode(sequenceKey)); + mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey)); mtrlBat.setParentId(0L); materialBatchMapper.insert(mtrlBat); @@ -265,21 +270,46 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { @Override public PageResult getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) { - // 需要排除已经被选择的工段 Long pdtId = pageReqVO.getProductId(); - PageResult pageResult; - if (pdtId == null) { - pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of()); - } else { + if (QmsCommonConstant.COMPLETED.equals(pageReqVO.getAcceptanceStatus())) { + // 用于入库 + if (pdtId == null) { + return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of()); + } List mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId); if (CollUtil.isEmpty(mtrlDos)) { - pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of()); - } else { - List pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList(); - pageResult = materialBatchMapper.selectGongPage(pageReqVO, pdtIds); + return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of()); } + List pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList(); + return materialBatchMapper.selectAcceptedGongPage(pageReqVO, pdtIds); } - return pageResult; + // 用于验收 + // 需要排除已经被选择的工段 + if (pdtId == null) { + return materialBatchMapper.selectGongPage(pageReqVO, List.of()); + } + List mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId); + if (CollUtil.isEmpty(mtrlDos)) { + return materialBatchMapper.selectGongPage(pageReqVO, List.of()); + } + List pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList(); + return materialBatchMapper.selectGongPage(pageReqVO, pdtIds); + } + + @Override + public void updateMaterialBatchInbEndQty(MaterialBatchDO gongDO) { + materialBatchMapper.updateById(gongDO); + } + + @Override + public void updateMaterialBatchAcceptStatusByLfcId(Long lfcId, String status) { + List detailList = materialLifecycleDetailService.getDetailListByLfcId(lfcId); + if (CollUtil.isEmpty(detailList)) return; + List gongIds = detailList.stream().map(MaterialLifecycleDetailDO::getBatchGongduanId).toList(); + if (CollUtil.isEmpty(gongIds)) return; + MaterialBatchDO updateEntity = new MaterialBatchDO().setAcceptanceStatus(status); + materialBatchMapper.update(updateEntity, Wrappers.lambdaQuery(MaterialBatchDO.class) + .in(MaterialBatchDO::getId, gongIds)); } /** diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationService.java index 7239403..966a0ee 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationService.java @@ -68,4 +68,11 @@ public interface MaterialInfomationService { * @return 大类id-库存数量 */ Map getStockQuantityByPdtIds(List mtrlIds); + + /** + * 批量保存物料实例 + * + * @param infomationDOS 物料实例 + */ + void saveBatch(List infomationDOS); } \ 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/MaterialInfomationServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationServiceImpl.java index a0f5238..feb7e08 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInfomationServiceImpl.java @@ -107,4 +107,9 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService )); } + @Override + public void saveBatch(List infomationDOS) { + materialInfomationMapper.insertBatch(infomationDOS); + } + } \ 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/MaterialInventoryInboundDetailService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailService.java index 9adf95f..f3da3dd 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailService.java @@ -61,4 +61,10 @@ public interface MaterialInventoryInboundDetailService { */ PageResult getMaterialInventoryInboundDetailPage(MaterialInventoryInboundDetailPageReqVO pageReqVO); + /** + * 批量保存入库明细 + * + * @param detailList 入库明细 + */ + void saveBatch(List detailList); } \ 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/MaterialInventoryInboundDetailServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailServiceImpl.java index 24b0e55..fa766a2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundDetailServiceImpl.java @@ -86,4 +86,9 @@ public class MaterialInventoryInboundDetailServiceImpl implements MaterialInvent return materialInventoryInboundDetailMapper.selectPage(pageReqVO); } + @Override + public void saveBatch(List detailList) { + materialInventoryInboundDetailMapper.insertBatch(detailList); + } + } \ 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/MaterialInventoryInboundServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundServiceImpl.java index 453cb2b..836dffb 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryInboundServiceImpl.java @@ -1,23 +1,34 @@ package com.zt.plat.module.qms.resource.material.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +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.framework.security.core.LoginUser; +import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; +import com.zt.plat.module.qms.core.code.SequenceUtil; +import com.zt.plat.module.qms.core.constant.DataTypeConstant; +import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO; -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO; -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.*; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper; import jakarta.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INVENTORY_INBOUND_NOT_EXISTS; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; +import static com.zt.plat.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS; /** @@ -34,21 +45,104 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb @Autowired private MaterialLifecycleDetailService materialLifecycleDetailService; + @Autowired + private MaterialBatchService materialBatchService; + @Autowired + private MaterialProductService materialProductService; + @Autowired + private SequenceUtil sequenceUtil; + @Autowired + private MaterialInfomationService materialInfomationService; + @Autowired + private MaterialInventoryInboundDetailService materialInventoryInboundDetailService; + private final String infSequenceKey = "QMS_MATERIAL_INF_NO"; + + @Transactional @Override public MaterialInventoryInboundRespVO createMaterialInventoryInbound(MaterialInventoryInboundSaveReqVO createReqVO) { - // 1.校验工段是否已经验收 Long gongduanId = createReqVO.getGongduanId(); - MaterialLifecycleDetailDO lifecycleDetail = materialLifecycleDetailService.getMaterialLifecycleDetailByGongId(gongduanId); + BigDecimal reqQuantity = createReqVO.getQuantity(); + if (reqQuantity.compareTo(BigDecimal.ZERO) <= 0) throw new ServiceException(1_032_160_000, "入库数量不能小于等于0"); + MaterialBatchDO gongDO = materialBatchService.getMaterialBatch(gongduanId); + if (gongDO == null) throw exception(MATERIAL_BATCH_GONG_NOT_EXISTS); + // 1.检查工段是否已经验收 + if (!QmsCommonConstant.COMPLETED.equals(gongDO.getAcceptanceStatus())) + throw new ServiceException(1_032_160_000, "工段未验收,不能入库"); + // 2.入库数量不大于批次工段数量 + if (reqQuantity.compareTo(gongDO.getInboundQuantity()) > 0) throw new ServiceException(1_032_160_000, "入库数量不能大于批次工段数量"); + // TODO 这儿应该调整为去物料实例统计出此工段的入库数量 + List inboundDOS = materialInventoryInboundMapper.selectList(Wrappers.lambdaQuery(MaterialInventoryInboundDO.class) + .eq(MaterialInventoryInboundDO::getGongduanId, gongduanId)); + if (CollUtil.isNotEmpty(inboundDOS)) { + BigDecimal totalQuantity = reqQuantity; + for (MaterialInventoryInboundDO inboundDO : inboundDOS) { + totalQuantity = totalQuantity.add(inboundDO.getQuantity()); + } + if (totalQuantity.compareTo(gongDO.getInboundQuantity()) > 0) throw new ServiceException(1_032_160_000, "入库数量不能大于批次工段数量"); + } // 3.保存入库记录 + MaterialInventoryInboundDO inbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class); + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + if (loginUser == null) throw exception(USER_NOT_EXISTS); + String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname(); + inbound.setApplyUser(loginUserNickname).setApplyUserId(loginUser.getId()) + .setApplyDepartment(loginUser.getVisitDeptName()).setApplyDepartmentId(loginUser.getVisitDeptId()) + .setApplyTime(LocalDateTime.now()) + .setRemark(gongDO.getRemark()); + materialInventoryInboundMapper.insert(inbound); // 4.生成物料实例 + Long productId = gongDO.getProductId(); + MaterialProductDO product = materialProductService.getMaterialProduct(productId); + if (product == null || !DataTypeConstant.DATA_TYPE_DATA.equals(product.getNodeType())) + throw exception(MATERIAL_PRODUCT_NOT_EXISTS); + Long batchId = gongDO.getParentId(); + MaterialBatchDO batch = materialBatchService.getMaterialBatch(batchId); + if (batch == null || batch.getParentId() != 0) throw exception(MATERIAL_BATCH_NOT_EXISTS); + List infomationDOS = new ArrayList<>(); + for (int i = 0; i < reqQuantity.intValue(); i++) { + MaterialInfomationDO infomationDO = new MaterialInfomationDO(); + infomationDO + .setProductId(productId).setBatchId(batchId) + .setLocationId(createReqVO.getLocationId()) + .setGongduanId(gongduanId) + .setSpecification(product.getSpecification()).setModelNo(product.getModelNo()) + .setParameter(product.getParameter()) + .setManufacturer(product.getManufacturer()).setUnit(product.getUnit()) + .setDue(product.getDue()).setOpenDueAfter(product.getOpenDueAfter()) + .setPublishStatus(0) + .setUsageStatus(0) + .setOpenStatus(0) + .setManufacturerDate(batch.getManufacturerDate()).setExpirationDate(batch.getDueDate()); + // 生成编号 + String code = sequenceUtil.genCode(infSequenceKey); + infomationDO.setCode(code); + infomationDOS.add(infomationDO); + } + materialInfomationService.saveBatch(infomationDOS); // 5.保存入库明细 - // 插入 - MaterialInventoryInboundDO materialInventoryInbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class); - materialInventoryInboundMapper.insert(materialInventoryInbound); + List detailList = new ArrayList<>(); + for (MaterialInfomationDO infomationDO : infomationDOS) { + MaterialInventoryInboundDetailDO detail = new MaterialInventoryInboundDetailDO(); + detail + .setInboundId(inbound.getId()) + .setBatchId(batchId) + .setBatchGongduanId(gongduanId) + .setMaterialInfomationId(infomationDO.getId()) + .setInboundUserName(loginUserNickname) + .setInboundUserId(loginUser.getId()) + .setInboundDepartmentName(loginUser.getVisitDeptName()) + .setInboundDepartmentId(loginUser.getVisitDeptId()) + .setInboundTime(inbound.getApplyTime()); + detailList.add(detail); + } + materialInventoryInboundDetailService.saveBatch(detailList); + // 更新工段已入库数量 + gongDO.setInboundEndQuantity(gongDO.getInboundEndQuantity().add(reqQuantity)); + materialBatchService.updateMaterialBatchInbEndQty(gongDO); // 返回 - return BeanUtils.toBean(materialInventoryInbound, MaterialInventoryInboundRespVO.class); + return BeanUtils.toBean(inbound, MaterialInventoryInboundRespVO.class); } @Override diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java index 26a269d..67ca157 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java @@ -88,7 +88,7 @@ public interface MaterialLifecycleDetailService { * @param id 流程id * @return 明细列表 */ - List getMaterialLifecycleDetailListByLfcId(Long id); + List getDetailListWithPdtInfoByLfcId(Long id); /** * 根据工段id 获取流程明细数据 @@ -103,5 +103,13 @@ public interface MaterialLifecycleDetailService { * @param lfcId 流程id * @param status 状态 */ - void updateDetailStatus(Long lfcId, String status); + void updateDetailTreatStatusByLfcId(Long lfcId, String status); + + /** + * 根据流程id 获取流程明细数据 + * + * @param lfcId 流程id + * @return 明细列表 + */ + List getDetailListByLfcId(Long lfcId); } \ 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/MaterialLifecycleDetailServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java index 8ca618f..52b2b71 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java @@ -109,7 +109,7 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta } @Override - public List getMaterialLifecycleDetailListByLfcId(Long id) { + public List getDetailListWithPdtInfoByLfcId(Long id) { return materialLifecycleDetailMapper.selectListWithPdtBatInfo(id); } @@ -117,18 +117,26 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta @Override public MaterialLifecycleDetailDO getMaterialLifecycleDetailByGongId(Long gongduanId) { - - return materialLifecycleDetailMapper.selectOne(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class) + List detailDOS = materialLifecycleDetailMapper.selectList(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class) .eq(MaterialLifecycleDetailDO::getBatchGongduanId, gongduanId) - .eq(MaterialLifecycleDetailDO::getTreatmentStatus, QmsCommonConstant.COMPLETED)); + .last("limit 1")); + if (CollUtil.isEmpty(detailDOS)) return null; + return detailDOS.get(0); } @Override - public void updateDetailStatus(Long lfcId, String status) { + public void updateDetailTreatStatusByLfcId(Long lfcId, String status) { boolean isCompleted = QmsCommonConstant.COMPLETED.equals(status); MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isCompleted ? 1 : 0); materialLifecycleDetailMapper.update(detailUpdate, Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class) .eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId)); } + @Override + public List getDetailListByLfcId(Long lfcId) { + + return materialLifecycleDetailMapper.selectList(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class) + .eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId)); + } + } \ 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/MaterialLifecycleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java index 52d47ee..f565ac9 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java @@ -208,7 +208,7 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , if (lifecycleDO == null) return null; MaterialLifecycleRespVO respVO = BeanUtils.toBean(lifecycleDO, MaterialLifecycleRespVO.class); // 获取明细 - List detailRespVOS = materialLifecycleDetailService.getMaterialLifecycleDetailListByLfcId(id); + List detailRespVOS = materialLifecycleDetailService.getDetailListWithPdtInfoByLfcId(id); respVO.setDetailList(detailRespVOS); return respVO; } @@ -372,8 +372,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , // 结束审批 entity.setFlowStatus(QmsCommonConstant.COMPLETED); // 更新明细处理状态 - materialLifecycleDetailService.updateDetailStatus(entity.getId(), QmsCommonConstant.COMPLETED); - // TODO 物料入库 + materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED); + // 更新批次工段验收状态 + materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED); } }