feat:物料管理出库相关
This commit is contained in:
@@ -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<MaterialInventoryOutboundRespVO> createMaterialInventoryOutbound(@Valid @RequestBody MaterialInventoryOutboundSaveReqVO createReqVO) {
|
||||
return success(materialInventoryOutboundService.createMaterialInventoryOutbound(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新出库")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-inventory-outbound:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<Boolean> 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<MaterialInventoryOutboundRespVO> 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<PageResult<MaterialInventoryOutboundRespVO>> getMaterialInventoryOutboundPage(@Valid MaterialInventoryOutboundPageReqVO pageReqVO) {
|
||||
PageResult<MaterialInventoryOutboundDO> 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<MaterialInventoryOutboundDO> list = materialInventoryOutboundService.getMaterialInventoryOutboundPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "出库.xls", "数据", MaterialInventoryOutboundRespVO.class,
|
||||
BeanUtils.toBean(list, MaterialInventoryOutboundRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<MaterialInventoryOutboundDetailRespVO> 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<Boolean> 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<Boolean> 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<Boolean> 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<MaterialInventoryOutboundDetailRespVO> 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<PageResult<MaterialInventoryOutboundDetailRespVO>> getMaterialInventoryOutboundDetailPage(@Valid MaterialInventoryOutboundDetailPageReqVO pageReqVO) {
|
||||
PageResult<MaterialInventoryOutboundDetailDO> 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<MaterialInventoryOutboundDetailDO> list = materialInventoryOutboundDetailService.getMaterialInventoryOutboundDetailPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等.xls", "数据", MaterialInventoryOutboundDetailRespVO.class,
|
||||
BeanUtils.toBean(list, MaterialInventoryOutboundDetailRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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<MaterialInventoryOutboundDetailDO> {
|
||||
|
||||
default PageResult<MaterialInventoryOutboundDetailDO> selectPage(MaterialInventoryOutboundDetailPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInventoryOutboundDetailDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<MaterialInventoryOutboundDO> {
|
||||
|
||||
default PageResult<MaterialInventoryOutboundDO> selectPage(MaterialInventoryOutboundPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInventoryOutboundDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等
|
||||
*/
|
||||
MaterialInventoryOutboundDetailDO getMaterialInventoryOutboundDetail(Long id);
|
||||
|
||||
/**
|
||||
* 获得出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等分页
|
||||
*/
|
||||
PageResult<MaterialInventoryOutboundDetailDO> getMaterialInventoryOutboundDetailPage(MaterialInventoryOutboundDetailPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -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<Long> ids) {
|
||||
// 校验存在
|
||||
validateMaterialInventoryOutboundDetailExists(ids);
|
||||
// 删除
|
||||
materialInventoryOutboundDetailMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMaterialInventoryOutboundDetailExists(List<Long> ids) {
|
||||
List<MaterialInventoryOutboundDetailDO> 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<MaterialInventoryOutboundDetailDO> getMaterialInventoryOutboundDetailPage(MaterialInventoryOutboundDetailPageReqVO pageReqVO) {
|
||||
return materialInventoryOutboundDetailMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得出库
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 出库
|
||||
*/
|
||||
MaterialInventoryOutboundDO getMaterialInventoryOutbound(Long id);
|
||||
|
||||
/**
|
||||
* 获得出库分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 出库分页
|
||||
*/
|
||||
PageResult<MaterialInventoryOutboundDO> getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -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<Long> ids) {
|
||||
// 校验存在
|
||||
validateMaterialInventoryOutboundExists(ids);
|
||||
// 删除
|
||||
materialInventoryOutboundMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMaterialInventoryOutboundExists(List<Long> ids) {
|
||||
List<MaterialInventoryOutboundDO> 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<MaterialInventoryOutboundDO> getMaterialInventoryOutboundPage(MaterialInventoryOutboundPageReqVO pageReqVO) {
|
||||
return materialInventoryOutboundMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryOutboundDetailMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryOutboundMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user