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 383a589..5e060a5 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 @@ -165,6 +165,13 @@ public interface ErrorCodeConstants { ErrorCode MATERIAL_INVENTORY_CHECK_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点不存在"); ErrorCode MATERIAL_INVENTORY_CHECK_BATCH_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点项不存在"); ErrorCode MATERIAL_INVENTORY_CHECK_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "库存盘点明细不存在"); + ErrorCode MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS = new ErrorCode(1_032_150_000, "出库不存在"); + ErrorCode MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等不存在"); + + + + + /*================================= tx 1_032_200_000 ~ 1_032_249_999 ==================================*/ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryOutboundController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryOutboundController.java new file mode 100644 index 0000000..f32ca5e --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryOutboundController.java @@ -0,0 +1,118 @@ +package com.zt.plat.module.qms.resource.material.controller.admin; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundSaveReqVO; +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 com.zt.plat.framework.business.annotation.FileUploadController; +import com.zt.plat.framework.business.controller.AbstractFileUploadController; + +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.*; +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.MaterialInventoryOutboundDO; +import com.zt.plat.module.qms.resource.material.service.MaterialInventoryOutboundService; + +@Tag(name = "管理后台 - 出库") +@RestController +@RequestMapping("/qms/material-inventory-outbound") +@Validated +@FileUploadController(source = "qms.materialinventoryoutbound") +public class MaterialInventoryOutboundController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = MaterialInventoryOutboundController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private MaterialInventoryOutboundService materialInventoryOutboundService; + + @PostMapping("/create") + @Operation(summary = "创建出库") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:create')") + public CommonResult createMaterialInventoryOutbound(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO createReqVO) { + return success(materialInventoryOutboundService.createMaterialInventoryOutbound(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新出库") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:update')") + public CommonResult updateMaterialInventoryOutbound(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO updateReqVO) { + materialInventoryOutboundService.updateMaterialInventoryOutbound(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除出库") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:delete')") + public CommonResult deleteMaterialInventoryOutbound(@RequestParam("id") Long id) { + materialInventoryOutboundService.deleteMaterialInventoryOutbound(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除出库") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:delete')") + public CommonResult deleteMaterialInventoryOutboundList(@RequestBody BatchDeleteReqVO req) { + materialInventoryOutboundService.deleteMaterialInventoryOutboundListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得出库") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:query')") + public CommonResult getMaterialInventoryOutbound(@RequestParam("id") Long id) { + MaterialInventoryOutboundDO materialInventoryOutbound = materialInventoryOutboundService.getMaterialInventoryOutbound(id); + return success(BeanUtils.toBean(materialInventoryOutbound, MaterialInventoryOutboundRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得出库分页") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:query')") + public CommonResult> getMaterialInventoryOutboundPage(@Valid MaterialInventoryOutboundPageReqVO pageReqVO) { + PageResult pageResult = materialInventoryOutboundService.getMaterialInventoryOutboundPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialInventoryOutboundRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出出库 Excel") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportMaterialInventoryOutboundExcel(@Valid MaterialInventoryOutboundPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialInventoryOutboundService.getMaterialInventoryOutboundPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "出库.xls", "数据", MaterialInventoryOutboundRespVO.class, + BeanUtils.toBean(list, MaterialInventoryOutboundRespVO.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/admin/MaterialInventoryOutboundDetailController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryOutboundDetailController.java new file mode 100644 index 0000000..eef01d7 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialInventoryOutboundDetailController.java @@ -0,0 +1,118 @@ +package com.zt.plat.module.qms.resource.material.controller.admin; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailSaveReqVO; +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 com.zt.plat.framework.business.annotation.FileUploadController; +import com.zt.plat.framework.business.controller.AbstractFileUploadController; + +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.*; +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.MaterialInventoryOutboundDetailDO; +import com.zt.plat.module.qms.resource.material.service.MaterialInventoryOutboundDetailService; + +@Tag(name = "管理后台 - 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") +@RestController +@RequestMapping("/qms/material-inventory-outbound-detail") +@Validated +@FileUploadController(source = "qms.materialinventoryoutbounddetail") +public class MaterialInventoryOutboundDetailController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = MaterialInventoryOutboundDetailController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private MaterialInventoryOutboundDetailService materialInventoryOutboundDetailService; + + @PostMapping("/create") + @Operation(summary = "创建出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:create')") + public CommonResult createMaterialInventoryOutboundDetail(@Valid @RequestBody MaterialInventoryOutboundDetailSaveReqVO createReqVO) { + return success(materialInventoryOutboundDetailService.createMaterialInventoryOutboundDetail(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:update')") + public CommonResult updateMaterialInventoryOutboundDetail(@Valid @RequestBody MaterialInventoryOutboundDetailSaveReqVO updateReqVO) { + materialInventoryOutboundDetailService.updateMaterialInventoryOutboundDetail(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:delete')") + public CommonResult deleteMaterialInventoryOutboundDetail(@RequestParam("id") Long id) { + materialInventoryOutboundDetailService.deleteMaterialInventoryOutboundDetail(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:delete')") + public CommonResult deleteMaterialInventoryOutboundDetailList(@RequestBody BatchDeleteReqVO req) { + materialInventoryOutboundDetailService.deleteMaterialInventoryOutboundDetailListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:query')") + public CommonResult getMaterialInventoryOutboundDetail(@RequestParam("id") Long id) { + MaterialInventoryOutboundDetailDO materialInventoryOutboundDetail = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetail(id); + return success(BeanUtils.toBean(materialInventoryOutboundDetail, MaterialInventoryOutboundDetailRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:query')") + public CommonResult> getMaterialInventoryOutboundDetailPage(@Valid MaterialInventoryOutboundDetailPageReqVO pageReqVO) { + PageResult pageResult = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetailPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialInventoryOutboundDetailRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Excel") + @PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound-detail:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportMaterialInventoryOutboundDetailExcel(@Valid MaterialInventoryOutboundDetailPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetailPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等.xls", "数据", MaterialInventoryOutboundDetailRespVO.class, + BeanUtils.toBean(list, MaterialInventoryOutboundDetailRespVO.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/MaterialInventoryOutboundDetailPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailPageReqVO.java new file mode 100644 index 0000000..6fab815 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailPageReqVO.java @@ -0,0 +1,34 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import lombok.*; +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 MaterialInventoryOutboundDetailPageReqVO extends PageParam { + + @Schema(description = "出库单id", example = "21793") + private Long parentId; + + @Schema(description = "物料实例id", example = "13656") + private Long infomationId; + + @Schema(description = "数量") + private String quantity; + + @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/MaterialInventoryOutboundDetailRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailRespVO.java new file mode 100644 index 0000000..7d9aeda --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailRespVO.java @@ -0,0 +1,42 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialInventoryOutboundDetailRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20579") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "出库单id", example = "21793") + @ExcelProperty("出库单id") + private Long parentId; + + @Schema(description = "物料实例id", example = "13656") + @ExcelProperty("物料实例id") + private Long infomationId; + + @Schema(description = "数量") + @ExcelProperty("数量") + private String quantity; + + @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/MaterialInventoryOutboundDetailSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailSaveReqVO.java new file mode 100644 index 0000000..f935063 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundDetailSaveReqVO.java @@ -0,0 +1,28 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等新增/修改 Request VO") +@Data +public class MaterialInventoryOutboundDetailSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20579") + private Long id; + + @Schema(description = "出库单id", example = "21793") + private Long parentId; + + @Schema(description = "物料实例id", example = "13656") + private Long infomationId; + + @Schema(description = "数量") + private String quantity; + + @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/controller/vo/MaterialInventoryOutboundPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundPageReqVO.java new file mode 100644 index 0000000..bb2f7fd --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundPageReqVO.java @@ -0,0 +1,65 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import lombok.*; +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 MaterialInventoryOutboundPageReqVO extends PageParam { + + @Schema(description = "标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_out_bsn_type】领用出库、盘亏出库、损坏出库等", example = "1") + private String businessType; + + @Schema(description = "业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "22585") + private Long applyUserId; + + @Schema(description = "申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "22046") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] applyTime; + + @Schema(description = "监督人") + private String checkUser; + + @Schema(description = "监督人id", example = "30131") + private Long checkUserId; + + @Schema(description = "流程实例id", example = "4828") + private String flowInstanceId; + + @Schema(description = "意见json") + private String commentJson; + + @Schema(description = "流程审批状态", example = "1") + private String flowStatus; + + @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/MaterialInventoryOutboundRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundRespVO.java new file mode 100644 index 0000000..780e1ce --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundRespVO.java @@ -0,0 +1,82 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 出库 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialInventoryOutboundRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28833") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "标题") + @ExcelProperty("标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_out_bsn_type】领用出库、盘亏出库、损坏出库等", example = "1") + @ExcelProperty("业务类型,【字典】【jy_material_out_bsn_type】领用出库、盘亏出库、损坏出库等") + private String businessType; + + @Schema(description = "业务类型编码") + @ExcelProperty("业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + @ExcelProperty("申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "22585") + @ExcelProperty("申请人id") + private Long applyUserId; + + @Schema(description = "申请部门") + @ExcelProperty("申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "22046") + @ExcelProperty("申请部门id") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + @ExcelProperty("申请时间") + private LocalDateTime applyTime; + + @Schema(description = "监督人") + @ExcelProperty("监督人") + private String checkUser; + + @Schema(description = "监督人id", example = "30131") + @ExcelProperty("监督人id") + private Long checkUserId; + + @Schema(description = "流程实例id", example = "4828") + @ExcelProperty("流程实例id") + private String flowInstanceId; + + @Schema(description = "意见json") + @ExcelProperty("意见json") + private String commentJson; + + @Schema(description = "流程审批状态", example = "1") + @ExcelProperty("流程审批状态") + private String flowStatus; + + @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/MaterialInventoryOutboundSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundSaveReqVO.java new file mode 100644 index 0000000..eba6157 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialInventoryOutboundSaveReqVO.java @@ -0,0 +1,60 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 出库新增/修改 Request VO") +@Data +public class MaterialInventoryOutboundSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28833") + private Long id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_out_bsn_type】领用出库、盘亏出库、损坏出库等", example = "1") + private String businessType; + + @Schema(description = "业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "22585") + private Long applyUserId; + + @Schema(description = "申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "22046") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + private LocalDateTime applyTime; + + @Schema(description = "监督人") + private String checkUser; + + @Schema(description = "监督人id", example = "30131") + private Long checkUserId; + + @Schema(description = "流程实例id", example = "4828") + private String flowInstanceId; + + @Schema(description = "意见json") + private String commentJson; + + @Schema(description = "流程审批状态", example = "1") + private String flowStatus; + + @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/MaterialInventoryOutboundDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInventoryOutboundDO.java new file mode 100644 index 0000000..3dc7a8d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInventoryOutboundDO.java @@ -0,0 +1,110 @@ +package com.zt.plat.module.qms.resource.material.dal.dataobject; + +import lombok.*; + +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 出库 DO +* +* @author 后台管理 +*/ +@TableName("t_mtrl_invt_outb") +@KeySequence("t_mtrl_invt_outb_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class MaterialInventoryOutboundDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 标题 + */ + @TableField("TTL") + private String title; + /** + * 业务类型,【字典】【jy_material_out_bsn_type】领用出库、盘亏出库、损坏出库等 + */ + @TableField("BSN_TP") + private String businessType; + /** + * 业务类型编码 + */ + @TableField("BSN_TP_CD") + private String businessTypeCode; + /** + * 申请人 + */ + @TableField("APL_USER") + private String applyUser; + /** + * 申请人id + */ + @TableField("APL_USER_ID") + private Long applyUserId; + /** + * 申请部门 + */ + @TableField("APL_DEPT") + private String applyDepartment; + /** + * 申请部门id + */ + @TableField("APL_DEPT_ID") + private Long applyDepartmentId; + /** + * 申请时间 + */ + @TableField("APL_TM") + private LocalDateTime applyTime; + /** + * 监督人 + */ + @TableField("CHK_USER") + private String checkUser; + /** + * 监督人id + */ + @TableField("CHK_USER_ID") + private Long checkUserId; + /** + * 流程实例id + */ + @TableField("FLW_INSC_ID") + private String flowInstanceId; + /** + * 意见json + */ + @TableField("CMT_JSON") + private String commentJson; + /** + * 流程审批状态 + */ + @TableField("FLW_STS") + private String flowStatus; + /** + * 所属部门 + */ + @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/dataobject/MaterialInventoryOutboundDetailDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInventoryOutboundDetailDO.java new file mode 100644 index 0000000..d83121c --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialInventoryOutboundDetailDO.java @@ -0,0 +1,57 @@ +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_invt_outb_dtl") +@KeySequence("t_mtrl_invt_outb_dtl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class MaterialInventoryOutboundDetailDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 出库单id + */ + @TableField("PRN_ID") + private Long parentId; + /** + * 物料实例id + */ + @TableField("INF_ID") + private Long infomationId; + /** + * 数量 + */ + @TableField("QTY") + private String quantity; + /** + * 所属部门 + */ + @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/MaterialInventoryOutboundDetailMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryOutboundDetailMapper.java new file mode 100644 index 0000000..ace8f14 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryOutboundDetailMapper.java @@ -0,0 +1,29 @@ +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.MaterialInventoryOutboundDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDetailDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface MaterialInventoryOutboundDetailMapper extends BaseMapperX { + + default PageResult selectPage(MaterialInventoryOutboundDetailPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MaterialInventoryOutboundDetailDO::getParentId, reqVO.getParentId()) + .eqIfPresent(MaterialInventoryOutboundDetailDO::getInfomationId, reqVO.getInfomationId()) + .eqIfPresent(MaterialInventoryOutboundDetailDO::getQuantity, reqVO.getQuantity()) + .eqIfPresent(MaterialInventoryOutboundDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(MaterialInventoryOutboundDetailDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(MaterialInventoryOutboundDetailDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialInventoryOutboundDetailDO::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/dal/mapper/MaterialInventoryOutboundMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryOutboundMapper.java new file mode 100644 index 0000000..dcfbbcf --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialInventoryOutboundMapper.java @@ -0,0 +1,39 @@ +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.MaterialInventoryOutboundPageReqVO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 出库 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface MaterialInventoryOutboundMapper extends BaseMapperX { + + default PageResult selectPage(MaterialInventoryOutboundPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MaterialInventoryOutboundDO::getTitle, reqVO.getTitle()) + .eqIfPresent(MaterialInventoryOutboundDO::getBusinessType, reqVO.getBusinessType()) + .eqIfPresent(MaterialInventoryOutboundDO::getBusinessTypeCode, reqVO.getBusinessTypeCode()) + .eqIfPresent(MaterialInventoryOutboundDO::getApplyUser, reqVO.getApplyUser()) + .eqIfPresent(MaterialInventoryOutboundDO::getApplyUserId, reqVO.getApplyUserId()) + .eqIfPresent(MaterialInventoryOutboundDO::getApplyDepartment, reqVO.getApplyDepartment()) + .eqIfPresent(MaterialInventoryOutboundDO::getApplyDepartmentId, reqVO.getApplyDepartmentId()) + .betweenIfPresent(MaterialInventoryOutboundDO::getApplyTime, reqVO.getApplyTime()) + .eqIfPresent(MaterialInventoryOutboundDO::getCheckUser, reqVO.getCheckUser()) + .eqIfPresent(MaterialInventoryOutboundDO::getCheckUserId, reqVO.getCheckUserId()) + .eqIfPresent(MaterialInventoryOutboundDO::getFlowInstanceId, reqVO.getFlowInstanceId()) + .eqIfPresent(MaterialInventoryOutboundDO::getCommentJson, reqVO.getCommentJson()) + .eqIfPresent(MaterialInventoryOutboundDO::getFlowStatus, reqVO.getFlowStatus()) + .eqIfPresent(MaterialInventoryOutboundDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(MaterialInventoryOutboundDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(MaterialInventoryOutboundDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialInventoryOutboundDO::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/service/MaterialInventoryOutboundDetailService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundDetailService.java new file mode 100644 index 0000000..ab949c0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundDetailService.java @@ -0,0 +1,64 @@ +package com.zt.plat.module.qms.resource.material.service; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDetailDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Service 接口 + * + * @author 后台管理 + */ +public interface MaterialInventoryOutboundDetailService { + + /** + * 创建出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + MaterialInventoryOutboundDetailRespVO createMaterialInventoryOutboundDetail(@Valid MaterialInventoryOutboundDetailSaveReqVO createReqVO); + + /** + * 更新出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialInventoryOutboundDetail(@Valid MaterialInventoryOutboundDetailSaveReqVO updateReqVO); + + /** + * 删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + * + * @param id 编号 + */ + void deleteMaterialInventoryOutboundDetail(Long id); + + /** + * 批量删除出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + * + * @param ids 编号 + */ + void deleteMaterialInventoryOutboundDetailListByIds(List ids); + + /** + * 获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + * + * @param id 编号 + * @return 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 + */ + MaterialInventoryOutboundDetailDO getMaterialInventoryOutboundDetail(Long id); + + /** + * 获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页 + * + * @param pageReqVO 分页查询 + * @return 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页 + */ + PageResult getMaterialInventoryOutboundDetailPage(MaterialInventoryOutboundDetailPageReqVO 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/MaterialInventoryOutboundDetailServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundDetailServiceImpl.java new file mode 100644 index 0000000..f671f57 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundDetailServiceImpl.java @@ -0,0 +1,92 @@ +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.MaterialInventoryOutboundDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundDetailSaveReqVO; +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.MaterialInventoryOutboundDetailDO; +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.MaterialInventoryOutboundDetailMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; + +/** + * 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class MaterialInventoryOutboundDetailServiceImpl implements MaterialInventoryOutboundDetailService { + + @Resource + private MaterialInventoryOutboundDetailMapper materialInventoryOutboundDetailMapper; + + @Override + public MaterialInventoryOutboundDetailRespVO createMaterialInventoryOutboundDetail(MaterialInventoryOutboundDetailSaveReqVO createReqVO) { + // 插入 + MaterialInventoryOutboundDetailDO materialInventoryOutboundDetail = BeanUtils.toBean(createReqVO, MaterialInventoryOutboundDetailDO.class); + materialInventoryOutboundDetailMapper.insert(materialInventoryOutboundDetail); + // 返回 + return BeanUtils.toBean(materialInventoryOutboundDetail, MaterialInventoryOutboundDetailRespVO.class); + } + + @Override + public void updateMaterialInventoryOutboundDetail(MaterialInventoryOutboundDetailSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialInventoryOutboundDetailExists(updateReqVO.getId()); + // 更新 + MaterialInventoryOutboundDetailDO updateObj = BeanUtils.toBean(updateReqVO, MaterialInventoryOutboundDetailDO.class); + materialInventoryOutboundDetailMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialInventoryOutboundDetail(Long id) { + // 校验存在 + validateMaterialInventoryOutboundDetailExists(id); + // 删除 + materialInventoryOutboundDetailMapper.deleteById(id); + } + + @Override + public void deleteMaterialInventoryOutboundDetailListByIds(List ids) { + // 校验存在 + validateMaterialInventoryOutboundDetailExists(ids); + // 删除 + materialInventoryOutboundDetailMapper.deleteByIds(ids); + } + + private void validateMaterialInventoryOutboundDetailExists(List ids) { + List list = materialInventoryOutboundDetailMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS); + } + } + + private void validateMaterialInventoryOutboundDetailExists(Long id) { + if (materialInventoryOutboundDetailMapper.selectById(id) == null) { + throw exception(MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS); + } + } + + @Override + public MaterialInventoryOutboundDetailDO getMaterialInventoryOutboundDetail(Long id) { + return materialInventoryOutboundDetailMapper.selectById(id); + } + + @Override + public PageResult getMaterialInventoryOutboundDetailPage(MaterialInventoryOutboundDetailPageReqVO pageReqVO) { + return materialInventoryOutboundDetailMapper.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/MaterialInventoryOutboundService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundService.java new file mode 100644 index 0000000..7c550ee --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundService.java @@ -0,0 +1,64 @@ +package com.zt.plat.module.qms.resource.material.service; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryOutboundDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 出库 Service 接口 + * + * @author 后台管理 + */ +public interface MaterialInventoryOutboundService { + + /** + * 创建出库 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + MaterialInventoryOutboundRespVO createMaterialInventoryOutbound(@Valid MaterialInventoryOutboundSaveReqVO createReqVO); + + /** + * 更新出库 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialInventoryOutbound(@Valid MaterialInventoryOutboundSaveReqVO updateReqVO); + + /** + * 删除出库 + * + * @param id 编号 + */ + void deleteMaterialInventoryOutbound(Long id); + + /** + * 批量删除出库 + * + * @param ids 编号 + */ + void deleteMaterialInventoryOutboundListByIds(List ids); + + /** + * 获得出库 + * + * @param id 编号 + * @return 出库 + */ + MaterialInventoryOutboundDO getMaterialInventoryOutbound(Long id); + + /** + * 获得出库分页 + * + * @param pageReqVO 分页查询 + * @return 出库分页 + */ + PageResult getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO 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/MaterialInventoryOutboundServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundServiceImpl.java new file mode 100644 index 0000000..71bb837 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialInventoryOutboundServiceImpl.java @@ -0,0 +1,92 @@ +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.MaterialInventoryOutboundPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryOutboundSaveReqVO; +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.MaterialInventoryOutboundDO; +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.MaterialInventoryOutboundMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; + +/** + * 出库 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class MaterialInventoryOutboundServiceImpl implements MaterialInventoryOutboundService { + + @Resource + private MaterialInventoryOutboundMapper materialInventoryOutboundMapper; + + @Override + public MaterialInventoryOutboundRespVO createMaterialInventoryOutbound(MaterialInventoryOutboundSaveReqVO createReqVO) { + // 插入 + MaterialInventoryOutboundDO materialInventoryOutbound = BeanUtils.toBean(createReqVO, MaterialInventoryOutboundDO.class); + materialInventoryOutboundMapper.insert(materialInventoryOutbound); + // 返回 + return BeanUtils.toBean(materialInventoryOutbound, MaterialInventoryOutboundRespVO.class); + } + + @Override + public void updateMaterialInventoryOutbound(MaterialInventoryOutboundSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialInventoryOutboundExists(updateReqVO.getId()); + // 更新 + MaterialInventoryOutboundDO updateObj = BeanUtils.toBean(updateReqVO, MaterialInventoryOutboundDO.class); + materialInventoryOutboundMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialInventoryOutbound(Long id) { + // 校验存在 + validateMaterialInventoryOutboundExists(id); + // 删除 + materialInventoryOutboundMapper.deleteById(id); + } + + @Override + public void deleteMaterialInventoryOutboundListByIds(List ids) { + // 校验存在 + validateMaterialInventoryOutboundExists(ids); + // 删除 + materialInventoryOutboundMapper.deleteByIds(ids); + } + + private void validateMaterialInventoryOutboundExists(List ids) { + List list = materialInventoryOutboundMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS); + } + } + + private void validateMaterialInventoryOutboundExists(Long id) { + if (materialInventoryOutboundMapper.selectById(id) == null) { + throw exception(MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS); + } + } + + @Override + public MaterialInventoryOutboundDO getMaterialInventoryOutbound(Long id) { + return materialInventoryOutboundMapper.selectById(id); + } + + @Override + public PageResult getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO pageReqVO) { + return materialInventoryOutboundMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundDetailMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundDetailMapper.xml new file mode 100644 index 0000000..b9650aa --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundDetailMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundMapper.xml new file mode 100644 index 0000000..49373b9 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialInventoryOutboundMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file