diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/constant/MaterialConstants.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/constant/MaterialConstants.java new file mode 100644 index 0000000..7b179b2 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/constant/MaterialConstants.java @@ -0,0 +1,9 @@ +package com.zt.plat.module.qms.resource.material.constant; + +/** + * 物料常量 + */ +public class MaterialConstants { + // 字典 类型 + public static final String DICT_MATERIAL_FLOW_TYPE = "jy_material_lifecycle_bsn_type"; +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInfomationController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInfomationController.java index 3824ad9..000c79f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInfomationController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInfomationController.java @@ -88,10 +88,10 @@ public class MaterialInfomationController implements BusinessControllerMarker { @GetMapping("/page") @Operation(summary = "获得物料实例分页") - @PreAuthorize("@ss.hasPermission('qms:material-infomation:query')") +// @PreAuthorize("@ss.hasPermission('qms:material-infomation:query')") public CommonResult> getMaterialInfomationPage(@Valid MaterialInfomationPageReqVO pageReqVO) { - PageResult pageResult = materialInfomationService.getMaterialInfomationPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, MaterialInfomationRespVO.class)); + PageResult pageResult = materialInfomationService.getMaterialInfomationPageWithPdtInfo(pageReqVO); + return success(pageResult); } @GetMapping("/export-excel") 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 11b1481..5f82499 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 @@ -29,7 +29,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-detail") @Validated @@ -85,8 +85,17 @@ public class MaterialInventoryInboundDetailController implements BusinessControl @Operation(summary = "获得入库明细,验收入库、盘盈入库等分页") // @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)); + PageResult pageResult = materialInventoryInboundDetailService.getInventoryInboundDetailPageWithMaterialInfo(pageReqVO); + return success(pageResult); + } + + @GetMapping("/list") + @Operation(summary = "根据入库单id获取物料列表") + @Parameter(name = "inboundId", description = "入库单id", required = true) +// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')") + public CommonResult> getMaterialInfoListByInboundId(@RequestParam("inboundId") Long inboundId) { + List materialInfoList = materialInventoryInboundDetailService.getMaterialInfoListByInboundId(inboundId); + return success(materialInfoList); } @GetMapping("/export-excel") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java index 52ea127..40dc2c2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java @@ -52,8 +52,6 @@ public class MaterialLifecycleController extends AbstractFileUploadController im @Resource private MaterialLifecycleService materialLifecycleService; - // QMS_RESOURCE_MATERIAL_COMMON - @PostMapping("/create") @Operation(summary = "新建物料流程") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLocationController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLocationController.java deleted file mode 100644 index 05bd2f9..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLocationController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.zt.plat.module.qms.resource.material.controller.admin; - -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO; -import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; - -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import jakarta.validation.constraints.*; -import jakarta.validation.*; -import jakarta.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; -import com.zt.plat.framework.common.pojo.PageParam; -import com.zt.plat.framework.common.pojo.PageResult; -import com.zt.plat.framework.common.pojo.CommonResult; -import com.zt.plat.framework.common.util.object.BeanUtils; -import static com.zt.plat.framework.common.pojo.CommonResult.success; - -import com.zt.plat.framework.excel.core.util.ExcelUtils; - -import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; -import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; - -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO; -import com.zt.plat.module.qms.resource.material.service.MaterialLocationService; - -@Tag(name = "管理后台 - 存放位置") -@RestController -@RequestMapping("/qms/material-location") -@Validated -public class MaterialLocationController implements BusinessControllerMarker { - - - @Resource - private MaterialLocationService materialLocationService; - - @PostMapping("/create") - @Operation(summary = "创建存放位置") - @PreAuthorize("@ss.hasPermission('qms:material-location:create')") - public CommonResult createMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO createReqVO) { - return success(materialLocationService.createMaterialLocation(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新存放位置") - @PreAuthorize("@ss.hasPermission('qms:material-location:update')") - public CommonResult updateMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO updateReqVO) { - materialLocationService.updateMaterialLocation(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除存放位置") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('qms:material-location:delete')") - public CommonResult deleteMaterialLocation(@RequestParam("id") Long id) { - materialLocationService.deleteMaterialLocation(id); - return success(true); - } - - @DeleteMapping("/delete-list") - @Parameter(name = "ids", description = "编号", required = true) - @Operation(summary = "批量删除存放位置") - @PreAuthorize("@ss.hasPermission('qms:material-location:delete')") - public CommonResult deleteMaterialLocationList(@RequestBody BatchDeleteReqVO req) { - materialLocationService.deleteMaterialLocationListByIds(req.getIds()); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得存放位置") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('qms:material-location:query')") - public CommonResult getMaterialLocation(@RequestParam("id") Long id) { - MaterialLocationDO materialLocation = materialLocationService.getMaterialLocation(id); - return success(BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得存放位置分页") - @PreAuthorize("@ss.hasPermission('qms:material-location:query')") - public CommonResult> getMaterialLocationPage(@Valid MaterialLocationPageReqVO pageReqVO) { - PageResult pageResult = materialLocationService.getMaterialLocationPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, MaterialLocationRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出存放位置 Excel") - @PreAuthorize("@ss.hasPermission('qms:material-location:export')") - @ApiAccessLog(operateType = EXPORT) - public void exportMaterialLocationExcel(@Valid MaterialLocationPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = materialLocationService.getMaterialLocationPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "存放位置.xls", "数据", MaterialLocationRespVO.class, - BeanUtils.toBean(list, MaterialLocationRespVO.class)); - } - -} \ 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/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 e411569..516d5fa 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 @@ -38,10 +38,30 @@ public class MaterialInfomationRespVO { @ExcelProperty("名称") private String name; + @Schema(description = "型号") + @ExcelProperty("型号") + private String modelNo; + + @Schema(description = "规格") + @ExcelProperty("规格") + private String specification; + @Schema(description = "技术参数") @ExcelProperty("技术参数") private String parameter; + @Schema(description = "制造商") + @ExcelProperty("制造商") + private String manufacturer; + + @Schema(description = "单位") + @ExcelProperty("单位") + private String unit; + + @Schema(description = "保质期(天)") + @ExcelProperty("保质期(天)") + private Integer due; + @Schema(description = "上架状态,0-未上架,1-已上架", example = "2") @ExcelProperty("上架状态,0-未上架,1-已上架") private Integer publishStatus; 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 1350fea..aedcb89 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,6 @@ public class MaterialInventoryInboundDetailRespVO { @ExcelProperty("批次id") private Long batchId; - // 物料名称 - - // 批次编号 - @Schema(description = "批次工段id", example = "1454") @ExcelProperty("批次工段id") private Long batchGongduanId; @@ -38,6 +34,26 @@ public class MaterialInventoryInboundDetailRespVO { @ExcelProperty("物料实例ID") private Long materialInfomationId; + @Schema(description = "物料编码") + @ExcelProperty("物料编码") + private String infomationCode; + + @Schema(description = "物料名称") + @ExcelProperty("物料名称") + private String infomationName; + + @Schema(description = "业务类型,验收入库、盘盈入库等") + @ExcelProperty("业务类型,验收入库、盘盈入库等") + private String businessType; + + @Schema(description = "存放位置名称") + @ExcelProperty("存放位置名称") + private String locationName; + + @Schema(description = "存放位置编码") + @ExcelProperty("存放位置编码") + private String locationCode; + @Schema(description = "入库人", example = "赵六") @ExcelProperty("入库人") private String inboundUserName; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationPageReqVO.java deleted file mode 100644 index b005635..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationPageReqVO.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.zt.plat.module.qms.resource.material.controller.vo; - -import lombok.*; -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.time.LocalDateTime; - -import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 存放位置分页 Request VO") -@Data -public class MaterialLocationPageReqVO extends PageParam { - - @Schema(description = "上级id", example = "9092") - private Long parentId; - - @Schema(description = "名称", example = "赵六") - private String name; - - @Schema(description = "编码") - private String code; - - @Schema(description = "容量") - private String capacity; - - @Schema(description = "位置") - private String location; - - @Schema(description = "所属部门") - private String systemDepartmentCode; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - -} \ 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/MaterialLocationRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationRespVO.java deleted file mode 100644 index 8dd33dc..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationRespVO.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.zt.plat.module.qms.resource.material.controller.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; -import com.alibaba.excel.annotation.*; - -@Schema(description = "管理后台 - 存放位置 Response VO") -@Data -@ExcelIgnoreUnannotated -public class MaterialLocationRespVO { - - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724") - @ExcelProperty("主键") - private Long id; - - @Schema(description = "上级id", example = "9092") - @ExcelProperty("上级id") - private Long parentId; - - @Schema(description = "名称", example = "赵六") - @ExcelProperty("名称") - private String name; - - @Schema(description = "编码") - @ExcelProperty("编码") - private String code; - - @Schema(description = "容量") - @ExcelProperty("容量") - private String capacity; - - @Schema(description = "位置") - @ExcelProperty("位置") - private String location; - - @Schema(description = "所属部门") - @ExcelProperty("所属部门") - private String systemDepartmentCode; - - @Schema(description = "备注") - @ExcelProperty("备注") - private String remark; - - @Schema(description = "创建时间") - @ExcelProperty("创建时间") - private LocalDateTime createTime; - -} \ 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/MaterialLocationSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationSaveReqVO.java deleted file mode 100644 index 1d3b410..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLocationSaveReqVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.zt.plat.module.qms.resource.material.controller.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import jakarta.validation.constraints.*; - -@Schema(description = "管理后台 - 存放位置新增/修改 Request VO") -@Data -public class MaterialLocationSaveReqVO { - - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724") - private Long id; - - @Schema(description = "上级id", example = "9092") - private Long parentId; - - @Schema(description = "名称", example = "赵六") - private String name; - - @Schema(description = "编码") - private String code; - - @Schema(description = "容量") - private String capacity; - - @Schema(description = "位置") - private String location; - - @Schema(description = "所属部门") - private String systemDepartmentCode; - - @Schema(description = "备注") - private String remark; - -} \ 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/dataobject/MaterialLocationDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLocationDO.java deleted file mode 100644 index 726b981..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLocationDO.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.zt.plat.module.qms.resource.material.dal.dataobject; - -import lombok.*; -import com.baomidou.mybatisplus.annotation.*; -import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; -/** -* 存放位置 DO -* -* @author 后台管理 -*/ -@TableName("t_mtrl_loc") -@KeySequence("t_mtrl_loc_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -/** -* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO -*/ -public class MaterialLocationDO extends BusinessBaseDO { - - - - /** - * 主键 - */ - @TableId(type = IdType.ASSIGN_ID) - private Long id; - /** - * 上级id - */ - @TableField("PRN_ID") - private Long parentId; - /** - * 名称 - */ - @TableField("NAME") - private String name; - /** - * 编码 - */ - @TableField("CD") - private String code; - /** - * 容量 - */ - @TableField("CPY") - private String capacity; - /** - * 位置 - */ - @TableField("LOC") - private String location; - /** - * 所属部门 - */ - @TableField("SYS_DEPT_CD") - private String systemDepartmentCode; - /** - * 备注 - */ - @TableField("RMK") - private String remark; - -} \ 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/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 a9b989d..1887002 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 @@ -13,6 +13,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageR 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 com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -92,7 +93,9 @@ public interface MaterialBatchMapper extends BaseMapperX { // 只查询工段 .ne(MaterialBatchDO::getParentId, 0) .eq(MaterialBatchDO::getSubmitStatus, 1) - .notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.DELETED = 0") + .ne(MaterialBatchDO::getAcceptanceStatus, MaterialAcceptStatus.accepted.name()) + // 未处理的不允许再次选择 + .notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.TMT_STS = 0 AND ld.DELETED = 0") // .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()) @@ -129,7 +132,7 @@ public interface MaterialBatchMapper extends BaseMapperX { // 只查询工段 .ne(MaterialBatchDO::getParentId, 0) .eq(MaterialBatchDO::getSubmitStatus, 1) - .eq(MaterialBatchDO::getAcceptanceStatus, QmsCommonConstant.COMPLETED) + .eq(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus()) // .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()) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInfomationMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInfomationMapper.java index 4801b1c..2c23f8f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInfomationMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInfomationMapper.java @@ -1,10 +1,14 @@ package com.zt.plat.module.qms.resource.material.dal.mapper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.zt.plat.framework.common.pojo.PageResult; -import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; 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.MaterialInfomationPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationRespVO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO; import org.apache.ibatis.annotations.Mapper; /** @@ -42,4 +46,42 @@ public interface MaterialInfomationMapper extends BaseMapperX selectPageWithPdtInfo(MaterialInfomationPageReqVO reqVO) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapperX() + .select(MaterialInfomationDO::getId, + MaterialInfomationDO::getProductId, MaterialInfomationDO::getBatchId, MaterialInfomationDO::getGongduanId, + MaterialInfomationDO::getCode, MaterialInfomationDO::getPublishStatus, + MaterialInfomationDO::getUsageStatus, MaterialInfomationDO::getManagerDepartmentId, + MaterialInfomationDO::getManagerDepartmentName, MaterialInfomationDO::getManagerUserId, MaterialInfomationDO::getManagerUserName, + MaterialInfomationDO::getOpenStatus, MaterialInfomationDO::getOpenUserId, MaterialInfomationDO::getOpenUserName, + MaterialInfomationDO::getOpenDate, MaterialInfomationDO::getExpirationDate, MaterialInfomationDO::getExpirationFlag, + MaterialInfomationDO::getRemainingVolume, MaterialInfomationDO::getUseEndFlag, + MaterialInfomationDO::getSystemDepartmentCode, MaterialInfomationDO::getRemark, + MaterialInfomationDO::getCreateTime, MaterialInfomationDO::getUpdateTime) + .select(MaterialProductDO::getName, MaterialProductDO::getSpecification, + MaterialProductDO::getModelNo, MaterialProductDO::getParameter, MaterialProductDO::getManufacturer, + MaterialProductDO::getUnit, MaterialProductDO::getDue) + .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId) + .eqIfExists(MaterialInfomationDO::getProductId, reqVO.getProductId()) + .eqIfExists(MaterialInfomationDO::getBatchId, reqVO.getBatchId()) + .eqIfExists(MaterialInfomationDO::getLocationId, reqVO.getLocationId()) + .eqIfExists(MaterialInfomationDO::getCode, reqVO.getCode()) + .eqIfExists(MaterialProductDO::getParameter, reqVO.getParameter()) + .eqIfExists(MaterialInfomationDO::getPublishStatus, reqVO.getPublishStatus()) + .eqIfExists(MaterialInfomationDO::getUsageStatus, reqVO.getUsageStatus()) + .eqIfExists(MaterialInfomationDO::getManagerDepartmentId, reqVO.getManagerDepartmentId()) + .likeIfExists(MaterialInfomationDO::getManagerDepartmentName, reqVO.getManagerDepartmentName()) + .eqIfExists(MaterialInfomationDO::getManagerUserId, reqVO.getManagerUserId()) + .likeIfExists(MaterialInfomationDO::getManagerUserName, reqVO.getManagerUserName()) + .eqIfExists(MaterialInfomationDO::getOpenStatus, reqVO.getOpenStatus()) + .eqIfExists(MaterialInfomationDO::getOpenUserId, reqVO.getOpenUserId()) + .likeIfExists(MaterialInfomationDO::getOpenUserName, reqVO.getOpenUserName()) + .eqIfExists(MaterialInfomationDO::getExpirationFlag, reqVO.getExpirationFlag()) + .eqIfExists(MaterialInfomationDO::getUseEndFlag, reqVO.getUseEndFlag()) + .eqIfExists(MaterialInfomationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .likeIfExists(MaterialInfomationDO::getRemark, reqVO.getRemark()) + .orderByDesc(MaterialInfomationDO::getId); + return selectJoinPage(reqVO, MaterialInfomationRespVO.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/MaterialInventoryInboundDetailMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryInboundDetailMapper.java index f557ec5..d36e6e2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryInboundDetailMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryInboundDetailMapper.java @@ -3,10 +3,18 @@ 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.business.config.dal.dataobject.ConfigWarehouseLocationDO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailRespVO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 入库明细,验收入库、盘盈入库等 Mapper * @@ -32,4 +40,47 @@ public interface MaterialInventoryInboundDetailMapper extends BaseMapperX selectPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO reqVO){ + MPJLambdaWrapperX wrapperX = new MPJLambdaWrapperX() + .selectAll(MaterialInventoryInboundDetailDO.class) + .selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode) + .selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName) + .selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType) + .selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName) + .selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode) + .leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId) + .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId) + .leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId) + .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId) + .eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getMaterialInfomationId, reqVO.getMaterialInfomationId()) + .likeIfPresent(MaterialInventoryInboundDetailDO::getInboundUserName, reqVO.getInboundUserName()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getInboundUserId, reqVO.getInboundUserId()) + .likeIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentName, reqVO.getInboundDepartmentName()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentId, reqVO.getInboundDepartmentId()) + .betweenIfPresent(MaterialInventoryInboundDetailDO::getInboundTime, reqVO.getInboundTime()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(MaterialInventoryInboundDetailDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(MaterialInventoryInboundDetailDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialInventoryInboundDetailDO::getInboundId); + return selectJoinPage(reqVO, MaterialInventoryInboundDetailRespVO.class, wrapperX); + } + + default List selectMaterialInfoListByInboundId(Long inboundId) { + MPJLambdaWrapperX wrapperX = new MPJLambdaWrapperX() + .selectAll(MaterialInventoryInboundDetailDO.class) + .selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode) + .selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName) + .selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType) + .selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName) + .selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode) + .leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId) + .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId) + .leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId) + .leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId) + .eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, inboundId); + return selectJoinList(MaterialInventoryInboundDetailRespVO.class, 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/dal/mapper/MaterialLocationMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLocationMapper.java deleted file mode 100644 index 44f3779..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLocationMapper.java +++ /dev/null @@ -1,31 +0,0 @@ -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.query.LambdaQueryWrapperX; -import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO; -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 存放位置 Mapper - * - * @author 后台管理 - */ -@Mapper -public interface MaterialLocationMapper extends BaseMapperX { - - default PageResult selectPage(MaterialLocationPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(MaterialLocationDO::getParentId, reqVO.getParentId()) - .likeIfPresent(MaterialLocationDO::getName, reqVO.getName()) - .eqIfPresent(MaterialLocationDO::getCode, reqVO.getCode()) - .eqIfPresent(MaterialLocationDO::getCapacity, reqVO.getCapacity()) - .eqIfPresent(MaterialLocationDO::getLocation, reqVO.getLocation()) - .eqIfPresent(MaterialLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) - .eqIfPresent(MaterialLocationDO::getRemark, reqVO.getRemark()) - .betweenIfPresent(MaterialLocationDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(MaterialLocationDO::getId)); - } - -} \ 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/enums/MaterialAcceptStatus.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/enums/MaterialAcceptStatus.java new file mode 100644 index 0000000..2561069 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/enums/MaterialAcceptStatus.java @@ -0,0 +1,10 @@ +package com.zt.plat.module.qms.resource.material.enums; + +/** + * 物料验收状态 + */ +public enum MaterialAcceptStatus { + accepted, + partAccepted, + notAccepted +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/enums/MaterialFlowType.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/enums/MaterialFlowType.java new file mode 100644 index 0000000..3901180 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/enums/MaterialFlowType.java @@ -0,0 +1,28 @@ +package com.zt.plat.module.qms.resource.material.enums; + +import lombok.Getter; + +@Getter +public enum MaterialFlowType { + + acceptance("验收"), + + return_exchange("退换货"), + + config_apply("配置申请"); + + private final String name; + + MaterialFlowType(String name) { + this.name = name; + } + + public static MaterialFlowType fromName(String name) { + for (MaterialFlowType type : MaterialFlowType.values()) { + if (type.getName().equals(name)) { + return type; + } + } + throw new IllegalArgumentException("No enum constant with name: " + name); + } +} 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 0dc2faa..031e5a5 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 @@ -14,6 +14,7 @@ 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 com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus; import jakarta.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -54,7 +55,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) { // 插入 MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class); - + mtrlBat.setAcceptanceStatus(MaterialAcceptStatus.notAccepted.name()); // 批次编号 mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey)); @@ -162,6 +163,13 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { List voList = pageResult.getList(); if (CollUtil.isNotEmpty(voList)) { List treeVos = this.listTransTree(voList, 0L); + for (MaterialBatchRespVO batch : treeVos) { + List children = batch.getChildren(); + if (CollUtil.isEmpty(children)) continue; + children.forEach(child -> + batch.setInboundEndQuantity(batch.getInboundEndQuantity().add(child.getInboundEndQuantity())) + ); + } pageResult.setList(treeVos); } @@ -271,7 +279,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService { @Override public PageResult getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) { Long pdtId = pageReqVO.getProductId(); - if (QmsCommonConstant.COMPLETED.equals(pageReqVO.getAcceptanceStatus())) { + if (MaterialAcceptStatus.accepted.name().equals(pageReqVO.getAcceptanceStatus())) { // 用于入库 if (pdtId == null) { return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of()); 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 966a0ee..e3f0ea7 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 @@ -75,4 +75,12 @@ public interface MaterialInfomationService { * @param infomationDOS 物料实例 */ void saveBatch(List infomationDOS); + + /** + * 获得物料实例分页 + * + * @param pageReqVO 分页查询 + * @return 物料实例分页 + */ + PageResult getMaterialInfomationPageWithPdtInfo(@Valid MaterialInfomationPageReqVO pageReqVO); } \ 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 feb7e08..b4bd754 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 @@ -10,6 +10,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomation import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper; +import groovy.util.logging.Slf4j; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -27,6 +28,8 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INFOMATIO * * @author 后台管理 */ +@lombok.extern.slf4j.Slf4j +@Slf4j @Service @Validated public class MaterialInfomationServiceImpl implements MaterialInfomationService { @@ -103,7 +106,7 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService return maps.stream().collect(Collectors.toMap( map -> (Long) map.get("PDT_ID"), - map -> ((Long) map.get("quantity")) + map -> (Long) map.get("QUANTITY") )); } @@ -112,4 +115,9 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService materialInfomationMapper.insertBatch(infomationDOS); } + @Override + public PageResult getMaterialInfomationPageWithPdtInfo(MaterialInfomationPageReqVO pageReqVO) { + return materialInfomationMapper.selectPageWithPdtInfo(pageReqVO); + } + } \ 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 f3da3dd..cc51489 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 @@ -67,4 +67,20 @@ public interface MaterialInventoryInboundDetailService { * @param detailList 入库明细 */ void saveBatch(List detailList); + + /** + * 获取包含物料信息的入库明细 + * + * @param pageReqVO 分页查询 + * @return 分页数据 + */ + PageResult getInventoryInboundDetailPageWithMaterialInfo(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO); + + /** + * 根据入库单ID 获取物料列表 + * + * @param inboundId 入库单ID + * @return 物料列表 + */ + List getMaterialInfoListByInboundId(Long inboundId); } \ 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 fa766a2..1db9d58 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 @@ -91,4 +91,17 @@ public class MaterialInventoryInboundDetailServiceImpl implements MaterialInvent materialInventoryInboundDetailMapper.insertBatch(detailList); } + + @Override + public PageResult getInventoryInboundDetailPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO pageReqVO) { + + return materialInventoryInboundDetailMapper.selectPageWithMaterialInfo(pageReqVO); + } + + @Override + public List getMaterialInfoListByInboundId(Long inboundId) { + + return materialInventoryInboundDetailMapper.selectMaterialInfoListByInboundId(inboundId); + } + } \ 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 836dffb..5150e3c 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 @@ -107,6 +107,7 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb .setProductId(productId).setBatchId(batchId) .setLocationId(createReqVO.getLocationId()) .setGongduanId(gongduanId) + .setName(product.getName()) .setSpecification(product.getSpecification()).setModelNo(product.getModelNo()) .setParameter(product.getParameter()) .setManufacturer(product.getManufacturer()).setUnit(product.getUnit()) 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 67ca157..5d8a9de 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 @@ -101,9 +101,9 @@ public interface MaterialLifecycleDetailService { * 更新流程明细状态 * * @param lfcId 流程id - * @param status 状态 + * @param isTreat 是否已处理 */ - void updateDetailTreatStatusByLfcId(Long lfcId, String status); + void updateDetailTreatStatusByLfcId(Long lfcId, Boolean isTreat); /** * 根据流程id 获取流程明细数据 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 52b2b71..26a638c 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 @@ -125,9 +125,8 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta } @Override - public void updateDetailTreatStatusByLfcId(Long lfcId, String status) { - boolean isCompleted = QmsCommonConstant.COMPLETED.equals(status); - MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isCompleted ? 1 : 0); + public void updateDetailTreatStatusByLfcId(Long lfcId, Boolean isTreat) { + MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isTreat ? 1 : 0); materialLifecycleDetailMapper.update(detailUpdate, Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class) .eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId)); } 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 f565ac9..f932c4e 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 @@ -19,13 +19,19 @@ import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO; import com.zt.plat.module.qms.api.task.BMPCallbackInterface; import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO; import com.zt.plat.module.qms.common.data.service.DataKeyCheckService; +import com.zt.plat.module.qms.common.dic.controller.vo.DictionaryBusinessRespVO; +import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO; +import com.zt.plat.module.qms.common.dic.service.DictionaryBusinessService; import com.zt.plat.module.qms.enums.QmsBpmConstant; import com.zt.plat.module.qms.enums.QmsCommonConstant; +import com.zt.plat.module.qms.resource.material.constant.MaterialConstants; import com.zt.plat.module.qms.resource.material.controller.vo.*; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper; +import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus; +import com.zt.plat.module.qms.resource.material.enums.MaterialFlowType; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -76,6 +82,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , @Autowired private DataKeyCheckService dataKeyCheckService; + @Autowired + private DictionaryBusinessService dictionaryBusinessService; + @Transactional @Override public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) { @@ -282,18 +291,15 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO(); reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId())) .setVariables(variables); - // TODO 流程key根据业务类型动态获取 - switch (lifecycleDO.getBusinessType()) { - case "验收": - reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_ACCEPTANCE"); - break; - case "退换货": - reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_RETURN_EXCHANGE"); - break; - case "配置申请": - reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_CONFIG_APPLY"); - break; - } + // 流程key 根据业务类型动态获取 + List items = dictionaryBusinessService.queryDictItemsByKey(MaterialConstants.DICT_MATERIAL_FLOW_TYPE); + if (CollUtil.isEmpty(items)) throw new ServiceException(1_032_160_000, "流程配置不存在"); + Map processKeyMap = items.stream().collect(Collectors.toMap(DictionaryBusinessDO::getName, DictionaryBusinessDO::getCustomConfig)); + MaterialFlowType materialFlowType = MaterialFlowType.fromName(lifecycleDO.getBusinessType()); + Object processKey = JSONUtil.parseObj(processKeyMap.get(materialFlowType.getName())).get("processKey"); + if (processKey == null) throw new ServiceException(1_032_160_000, "流程配置 key 不存在"); + + reqDTO.setProcessDefinitionKey(processKey.toString()); CommonResult result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO); if(!result.isSuccess()){ throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg()); @@ -356,12 +362,15 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , // 根据流程状态处理业务数据 if(("1").equals(returnFlag)){ // 驳回。流程需要配置退回到发起节点 + materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true); entity.setFlowStatus(QmsCommonConstant.REJECTED); } else if("3".equals(PROCESS_STATUS)){ // 拒绝 + materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true); entity.setFlowStatus(QmsCommonConstant.REFUSED); } else if("4".equals(PROCESS_STATUS)){ // 作废 + materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true); entity.setFlowStatus(QmsCommonConstant.VOID); } else if("1".equals(PROCESS_STATUS) || "2".equals(PROCESS_STATUS)){ // 通过 @@ -372,9 +381,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , // 结束审批 entity.setFlowStatus(QmsCommonConstant.COMPLETED); // 更新明细处理状态 - materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED); + materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true); // 更新批次工段验收状态 - materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED); + materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), MaterialAcceptStatus.accepted.name()); } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLocationService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLocationService.java deleted file mode 100644 index 69bc21a..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLocationService.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.zt.plat.module.qms.resource.material.service; - -import java.util.*; - -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO; -import jakarta.validation.*; -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO; -import com.zt.plat.framework.common.pojo.PageResult; - -/** - * 存放位置 Service 接口 - * - * @author 后台管理 - */ -public interface MaterialLocationService { - - /** - * 创建存放位置 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - MaterialLocationRespVO createMaterialLocation(@Valid MaterialLocationSaveReqVO createReqVO); - - /** - * 更新存放位置 - * - * @param updateReqVO 更新信息 - */ - void updateMaterialLocation(@Valid MaterialLocationSaveReqVO updateReqVO); - - /** - * 删除存放位置 - * - * @param id 编号 - */ - void deleteMaterialLocation(Long id); - - /** - * 批量删除存放位置 - * - * @param ids 编号 - */ - void deleteMaterialLocationListByIds(List ids); - - /** - * 获得存放位置 - * - * @param id 编号 - * @return 存放位置 - */ - MaterialLocationDO getMaterialLocation(Long id); - - /** - * 获得存放位置分页 - * - * @param pageReqVO 分页查询 - * @return 存放位置分页 - */ - PageResult getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO); - -} \ 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/MaterialLocationServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLocationServiceImpl.java deleted file mode 100644 index 0b1a656..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLocationServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.zt.plat.module.qms.resource.material.service; - -import cn.hutool.core.collection.CollUtil; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO; -import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO; -import org.springframework.stereotype.Service; -import jakarta.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO; -import com.zt.plat.framework.common.pojo.PageResult; -import com.zt.plat.framework.common.util.object.BeanUtils; - -import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLocationMapper; - -import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; - -/** - * 存放位置 Service 实现类 - * - * @author 后台管理 - */ -@Service -@Validated -public class MaterialLocationServiceImpl implements MaterialLocationService { - - @Resource - private MaterialLocationMapper materialLocationMapper; - - @Override - public MaterialLocationRespVO createMaterialLocation(MaterialLocationSaveReqVO createReqVO) { - // 插入 - MaterialLocationDO materialLocation = BeanUtils.toBean(createReqVO, MaterialLocationDO.class); - materialLocationMapper.insert(materialLocation); - // 返回 - return BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class); - } - - @Override - public void updateMaterialLocation(MaterialLocationSaveReqVO updateReqVO) { - // 校验存在 - validateMaterialLocationExists(updateReqVO.getId()); - // 更新 - MaterialLocationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLocationDO.class); - materialLocationMapper.updateById(updateObj); - } - - @Override - public void deleteMaterialLocation(Long id) { - // 校验存在 - validateMaterialLocationExists(id); - // 删除 - materialLocationMapper.deleteById(id); - } - - @Override - public void deleteMaterialLocationListByIds(List ids) { - // 校验存在 - validateMaterialLocationExists(ids); - // 删除 - materialLocationMapper.deleteByIds(ids); - } - - private void validateMaterialLocationExists(List ids) { - List list = materialLocationMapper.selectByIds(ids); - if (CollUtil.isEmpty(list) || list.size() != ids.size()) { - throw exception(MATERIAL_LOCATION_NOT_EXISTS); - } - } - - private void validateMaterialLocationExists(Long id) { - if (materialLocationMapper.selectById(id) == null) { - throw exception(MATERIAL_LOCATION_NOT_EXISTS); - } - } - - @Override - public MaterialLocationDO getMaterialLocation(Long id) { - return materialLocationMapper.selectById(id); - } - - @Override - public PageResult getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO) { - return materialLocationMapper.selectPage(pageReqVO); - } - -} \ 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 e1a454d..0cdcba2 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 @@ -329,7 +329,8 @@ public class MaterialProductServiceImpl implements MaterialProductService { Map stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds); if (CollUtil.isNotEmpty(stockQuantityMap)) { for (MaterialProductRespVO vo : voList) { - vo.setInventoryQuantity(BigDecimal.valueOf(stockQuantityMap.get(vo.getId()))); + Long val = stockQuantityMap.get(vo.getId()); + vo.setInventoryQuantity(BigDecimal.valueOf(val == null ? 0L : val)); } } diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLocationMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLocationMapper.xml deleted file mode 100644 index bb88adb..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLocationMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file