diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index fb1821b4..2dcec43c 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -39,6 +39,7 @@ public interface ErrorCodeConstants { ErrorCode RG_NOT_EXISTS = new ErrorCode(1_003_002, "库区不存在"); ErrorCode PN_NOT_EXISTS = new ErrorCode(1_003_003, "库位不存在"); ErrorCode STORAGE_NOT_EXISTS = new ErrorCode(1_003_004,"库存不存在"); + ErrorCode STORAGE_MAT_NOT_EXISTS = new ErrorCode(1_003_005, "物料不存在"); /************订单管理***********/ ErrorCode PROJECT_ORDER_NOT_EXISTS = new ErrorCode(1_004_001, "项目订单不存在"); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageRespVO.java index d76592ab..97202674 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageRespVO.java @@ -55,6 +55,11 @@ public class StorageRespVO { @ExcelProperty("仓库Id,对应 wms_wh 表中的Id") private Long whId; + @Schema(description = "创建人") + @ExcelProperty("创建人") + private Long creator; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageSaveReqVO.java index d64efb6f..6615ea69 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/vo/StorageSaveReqVO.java @@ -1,63 +1,62 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; - -@Schema(description = "管理后台 - 入/出库新增/修改 Request VO") -@Data -public class StorageSaveReqVO { - - @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890") - private Long id; - - @Schema(description = "入库出库大类型:1为入库,2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") - @NotNull(message = "入库出库大类型:1为入库,2为出库不能为空") - private Integer stockType; - - @Schema(description = "入库类型(字典):1为采购入库,2为盘盈入库,3为其他入库", example = "1") - private Integer stockInType; - - @Schema(description = "出库类型(字典):1为领料出库,2为销售出库,3为盘亏出库,4为其他出库", example = "2") - private Integer stockOutType; - - @Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "入/出库单号不能为空") - private String stockNo; - - @Schema(description = "上游单号") - private Long headerNo; - - @Schema(description = "备注", example = "你说的对") - private String description; - - @Schema(description = "状态:1为保存;2为提交;3为作废", example = "1") - private Integer status; - - @Schema(description = "仓库Id,对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079") - @NotNull(message = "仓库Id,对应 wms_wh 表中的Id不能为空") - private Long whId; - - @Schema(description = "入库人") - private Long keeper; - - @Schema(description = "入库时间") - private LocalDateTime keeperTime; - - @Schema(description = "出库人") - private Long outbound; - - @Schema(description = "出库时间") - private LocalDateTime outboundTime; - - @Schema(description = "作废人") - private Long cancel; - - @Schema(description = "作废时间") - private LocalDateTime cancelTime; - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 入/出库新增/修改 Request VO") +@Data +public class StorageSaveReqVO { + + @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890") + private Long id; + + @Schema(description = "入库出库大类型:1为入库,2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "入库出库大类型:1为入库,2为出库不能为空") + private Integer stockType; + + @Schema(description = "入库类型(字典):1为采购入库,2为盘盈入库,3为其他入库", example = "1") + private Integer stockInType; + + @Schema(description = "出库类型(字典):1为领料出库,2为销售出库,3为盘亏出库,4为其他出库", example = "2") + private Integer stockOutType; + + @Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String stockNo; + + @Schema(description = "上游单号") + private Long headerNo; + + @Schema(description = "备注", example = "你说的对") + private String description; + + @Schema(description = "状态:1为保存;2为提交;3为作废", example = "1") + private Integer status; + + @Schema(description = "仓库Id,对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079") + @NotNull(message = "仓库Id,对应 wms_wh 表中的Id不能为空") + private Long whId; + + @Schema(description = "入库人") + private Long keeper; + + @Schema(description = "入库时间") + private LocalDateTime keeperTime; + + @Schema(description = "出库人") + private Long outbound; + + @Schema(description = "出库时间") + private LocalDateTime outboundTime; + + @Schema(description = "作废人") + private Long cancel; + + @Schema(description = "作废时间") + private LocalDateTime cancelTime; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/StorageMatController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/StorageMatController.java new file mode 100644 index 00000000..a2f778f9 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/StorageMatController.java @@ -0,0 +1,105 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import com.chanko.yunxi.mes.module.heli.service.storagemat.StorageMatService; + +@Tag(name = "管理后台 - 入/出库物料") +@RestController +@RequestMapping("/heli/storage-mat") +@Validated +public class StorageMatController { + + @Resource + private StorageMatService storageMatService; + + @PostMapping("/create") + @Operation(summary = "创建入/出库物料") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:create')") + public CommonResult createStorageMat(@Valid @RequestBody StorageMatSaveReqVO createReqVO) { + return success(storageMatService.createStorageMat(createReqVO)); + } + + @PostMapping("/create-batch") + @Operation(summary = "批量创建入/出库物料") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:create')") + public CommonResult createStorageMat(@Valid @RequestBody List createReqVO) { + for (StorageMatSaveReqVO item :createReqVO){ + storageMatService.createStorageMat(item); + }; + return success(1L); + } + + @PutMapping("/update") + @Operation(summary = "更新入/出库物料") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:update')") + public CommonResult updateStorageMat(@Valid @RequestBody StorageMatSaveReqVO updateReqVO) { + storageMatService.updateStorageMat(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除入/出库物料") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:storage-mat:delete')") + public CommonResult deleteStorageMat(@RequestParam("id") Long id) { + storageMatService.deleteStorageMat(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得入/出库物料") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:query')") + public CommonResult getStorageMat(@RequestParam("id") Long id) { + StorageMatDO storageMat = storageMatService.getStorageMat(id); + return success(BeanUtils.toBean(storageMat, StorageMatRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得入/出库物料分页") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:query')") + public CommonResult> getStorageMatPage(@Valid StorageMatPageReqVO pageReqVO) { + PageResult pageResult = storageMatService.getStorageMatPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, StorageMatRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出入/出库物料 Excel") + @PreAuthorize("@ss.hasPermission('heli:storage-mat:export')") + @OperateLog(type = EXPORT) + public void exportStorageMatExcel(@Valid StorageMatPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = storageMatService.getStorageMatPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "入/出库物料.xls", "数据", StorageMatRespVO.class, + BeanUtils.toBean(list, StorageMatRespVO.class)); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatPageReqVO.java new file mode 100644 index 00000000..a206c427 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatPageReqVO.java @@ -0,0 +1,57 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 入/出库物料分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class StorageMatPageReqVO extends PageParam { + + @Schema(description = "入/出库Id", example = "19477") + private Long stockId; + + @Schema(description = "物料 Id,对应 base_material表中的 Id 列", example = "3400") + private Long matId; + + @Schema(description = "仓库 Id,对应 wms_wh 表中的Id", example = "31860") + private Long whId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", example = "13060") + private Long rgId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", example = "25544") + private Long pnId; + + @Schema(description = "库存良品数量") + private BigDecimal storageOkQty; + + @Schema(description = "批次号") + private String lotNo; + + @Schema(description = "备注", example = "你猜") + private String description; + + @Schema(description = "记录的创建人,对应员工表中的 Id") + private String creator; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "记录的修改人,对应员工表中的 Id") + private String updater; + + @Schema(description = "更新时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] updateTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java new file mode 100644 index 00000000..4c5fe5ec --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java @@ -0,0 +1,57 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 入/出库物料 Response VO") +@Data +@ExcelIgnoreUnannotated +public class StorageMatRespVO { + + @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29383") + @ExcelProperty("主键id") + private Long id; + + @Schema(description = "入/出库Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19477") + @ExcelProperty("入/出库Id") + private Long stockId; + + @Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "3400") + @ExcelProperty("物料 Id,对应 base_material表中的 Id 列") + private Long matId; + + @Schema(description = "仓库 Id,对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860") + @ExcelProperty("仓库 Id,对应 wms_wh 表中的Id") + private Long whId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13060") + @ExcelProperty("库区 Id,对应 wms_rg 表中的Id") + private Long rgId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25544") + @ExcelProperty("库区 Id,对应 wms_rg 表中的Id") + private Long pnId; + + @Schema(description = "库存良品数量") + @ExcelProperty("库存良品数量") + private BigDecimal storageOkQty; + + @Schema(description = "批次号") + @ExcelProperty("批次号") + private String lotNo; + + @Schema(description = "备注", example = "你猜") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java new file mode 100644 index 00000000..311d31b1 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java @@ -0,0 +1,46 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; + +@Schema(description = "管理后台 - 入/出库物料新增/修改 Request VO") +@Data +public class StorageMatSaveReqVO { + + @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29383") + private Long id; + + @Schema(description = "入/出库Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19477") + @NotNull(message = "入/出库Id不能为空") + private Long stockId; + + @Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "3400") + @NotNull(message = "物料 Id,对应 base_material表中的 Id 列不能为空") + private Long matId; + + @Schema(description = "仓库 Id,对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860") + @NotNull(message = "仓库 Id,对应 wms_wh 表中的Id不能为空") + private Long whId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13060") + @NotNull(message = "库区 Id,对应 wms_rg 表中的Id不能为空") + private Long rgId; + + @Schema(description = "库区 Id,对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25544") + @NotNull(message = "库区 Id,对应 wms_rg 表中的Id不能为空") + private Long pnId; + + @Schema(description = "库存良品数量") + private BigDecimal storageOkQty; + + @Schema(description = "批次号") + private String lotNo; + + @Schema(description = "备注", example = "你猜") + private String description; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java new file mode 100644 index 00000000..051e0773 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java @@ -0,0 +1,64 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 入/出库物料 DO + * + * @author 管理员 + */ +@TableName("wms_storage_mat") +@KeySequence("wms_storage_mat_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StorageMatDO extends BaseDO { + + /** + * 主键id + */ + @TableId + private Long id; + /** + * 入/出库Id + */ + private Long stockId; + /** + * 物料 Id,对应 base_material表中的 Id 列 + */ + private Long matId; + /** + * 仓库 Id,对应 wms_wh 表中的Id + */ + private Long whId; + /** + * 库区 Id,对应 wms_rg 表中的Id + */ + private Long rgId; + /** + * 库区 Id,对应 wms_rg 表中的Id + */ + private Long pnId; + /** + * 库存良品数量 + */ + private BigDecimal storageOkQty; + /** + * 批次号 + */ + private String lotNo; + /** + * 备注 + */ + private String description; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagemat/StorageMatMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagemat/StorageMatMapper.java new file mode 100644 index 00000000..18c84920 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagemat/StorageMatMapper.java @@ -0,0 +1,37 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*; + +/** + * 入/出库物料 Mapper + * + * @author 管理员 + */ +@Mapper +public interface StorageMatMapper extends BaseMapperX { + + default PageResult selectPage(StorageMatPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(StorageMatDO::getStockId, reqVO.getStockId()) + .eqIfPresent(StorageMatDO::getMatId, reqVO.getMatId()) + .eqIfPresent(StorageMatDO::getWhId, reqVO.getWhId()) + .eqIfPresent(StorageMatDO::getRgId, reqVO.getRgId()) + .eqIfPresent(StorageMatDO::getPnId, reqVO.getPnId()) + .eqIfPresent(StorageMatDO::getStorageOkQty, reqVO.getStorageOkQty()) + .eqIfPresent(StorageMatDO::getLotNo, reqVO.getLotNo()) + .eqIfPresent(StorageMatDO::getDescription, reqVO.getDescription()) + .eqIfPresent(StorageMatDO::getCreator, reqVO.getCreator()) + .betweenIfPresent(StorageMatDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(StorageMatDO::getUpdater, reqVO.getUpdater()) + .betweenIfPresent(StorageMatDO::getUpdateTime, reqVO.getUpdateTime()) + .orderByDesc(StorageMatDO::getId)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storage/StorageServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storage/StorageServiceImpl.java index 4393d948..b5ce293c 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storage/StorageServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storage/StorageServiceImpl.java @@ -1,74 +1,81 @@ -package com.chanko.yunxi.mes.module.heli.service.storage; - -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; - -import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper; - -import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; - -/** - * 入/出库 Service 实现类 - * - * @author 管理员 - */ -@Service -@Validated -public class StorageServiceImpl implements StorageService { - - @Resource - private StorageMapper storageMapper; - - @Override - public Long createStorage(StorageSaveReqVO createReqVO) { - // 插入 - StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class); - storageMapper.insert(storage); - // 返回 - return storage.getId(); - } - - @Override - public void updateStorage(StorageSaveReqVO updateReqVO) { - // 校验存在 - validateStorageExists(updateReqVO.getId()); - // 更新 - StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class); - storageMapper.updateById(updateObj); - } - - @Override - public void deleteStorage(Long id) { - // 校验存在 - validateStorageExists(id); - // 删除 - storageMapper.deleteById(id); - } - - private void validateStorageExists(Long id) { - if (storageMapper.selectById(id) == null) { - throw exception(STORAGE_NOT_EXISTS); - } - } - - @Override - public StorageDO getStorage(Long id) { - return storageMapper.selectById(id); - } - - @Override - public PageResult getStoragePage(StoragePageReqVO pageReqVO) { - return storageMapper.selectPage(pageReqVO); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.storage; + +import cn.hutool.core.lang.UUID; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.STOCK_IN; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WAREHOUSE; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 入/出库 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class StorageServiceImpl implements StorageService { + + @Resource + private StorageMapper storageMapper; + + @Override + public Long createStorage(StorageSaveReqVO createReqVO) { + // 插入 + StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class); + storage.setStockNo(UUID.fastUUID().toString(true)); + storageMapper.insert(storage); + + storage.setStockNo(STOCK_IN.getCode(storage.getId().toString())); + storageMapper.updateById(storage); + // 返回 + return storage.getId(); + } + + @Override + public void updateStorage(StorageSaveReqVO updateReqVO) { + // 校验存在 + validateStorageExists(updateReqVO.getId()); + // 更新 + StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class); + storageMapper.updateById(updateObj); + } + + @Override + public void deleteStorage(Long id) { + // 校验存在 + validateStorageExists(id); + // 删除 + storageMapper.deleteById(id); + } + + private void validateStorageExists(Long id) { + if (storageMapper.selectById(id) == null) { + throw exception(STORAGE_NOT_EXISTS); + } + } + + @Override + public StorageDO getStorage(Long id) { + return storageMapper.selectById(id); + } + + @Override + public PageResult getStoragePage(StoragePageReqVO pageReqVO) { + return storageMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatService.java new file mode 100644 index 00000000..69cb544a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.storagemat; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 入/出库物料 Service 接口 + * + * @author 管理员 + */ +public interface StorageMatService { + + /** + * 创建入/出库物料 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createStorageMat(@Valid StorageMatSaveReqVO createReqVO); + + /** + * 更新入/出库物料 + * + * @param updateReqVO 更新信息 + */ + void updateStorageMat(@Valid StorageMatSaveReqVO updateReqVO); + + /** + * 删除入/出库物料 + * + * @param id 编号 + */ + void deleteStorageMat(Long id); + + /** + * 获得入/出库物料 + * + * @param id 编号 + * @return 入/出库物料 + */ + StorageMatDO getStorageMat(Long id); + + /** + * 获得入/出库物料分页 + * + * @param pageReqVO 分页查询 + * @return 入/出库物料分页 + */ + PageResult getStorageMatPage(StorageMatPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatServiceImpl.java new file mode 100644 index 00000000..00bd5029 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagemat/StorageMatServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.storagemat; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 入/出库物料 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class StorageMatServiceImpl implements StorageMatService { + + @Resource + private StorageMatMapper storageMatMapper; + + @Override + public Long createStorageMat(StorageMatSaveReqVO createReqVO) { + // 插入 + StorageMatDO storageMat = BeanUtils.toBean(createReqVO, StorageMatDO.class); + storageMatMapper.insert(storageMat); + // 返回 + return storageMat.getId(); + } + + @Override + public void updateStorageMat(StorageMatSaveReqVO updateReqVO) { + // 校验存在 + validateStorageMatExists(updateReqVO.getId()); + // 更新 + StorageMatDO updateObj = BeanUtils.toBean(updateReqVO, StorageMatDO.class); + storageMatMapper.updateById(updateObj); + } + + @Override + public void deleteStorageMat(Long id) { + // 校验存在 + validateStorageMatExists(id); + // 删除 + storageMatMapper.deleteById(id); + } + + private void validateStorageMatExists(Long id) { + if (storageMatMapper.selectById(id) == null) { + throw exception(STORAGE_MAT_NOT_EXISTS); + } + } + + @Override + public StorageMatDO getStorageMat(Long id) { + return storageMatMapper.selectById(id); + } + + @Override + public PageResult getStorageMatPage(StorageMatPageReqVO pageReqVO) { + return storageMatMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/storagemat/StorageMatMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/storagemat/StorageMatMapper.xml new file mode 100644 index 00000000..4eb2a07b --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/storagemat/StorageMatMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/storage/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/storage/index.ts index e9b16e1a..c8aaf646 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/storage/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/storage/index.ts @@ -1,49 +1,49 @@ -import request from '@/config/axios' - -export interface StorageVO { - id: number - stockType: number - stockInType: number - stockOutType: number - stockNo: string - headerNo: number - description: string - status: number - whId: number - keeper: number - keeperTime: Date - outbound: number - outboundTime: Date - cancel: number - cancelTime: Date -} - -// 查询入/出库分页 -export const getStoragePage = async (params) => { - return await request.get({ url: `/heli/storage/page`, params }) -} - -// 查询入/出库详情 -export const getStorage = async (id: number) => { - return await request.get({ url: `/heli/storage/get?id=` + id }) -} - -// 新增入/出库 -export const createStorage = async (data: StorageVO) => { - return await request.post({ url: `/heli/storage/create`, data }) -} - -// 修改入/出库 -export const updateStorage = async (data: StorageVO) => { - return await request.put({ url: `/heli/storage/update`, data }) -} - -// 删除入/出库 -export const deleteStorage = async (id: number) => { - return await request.delete({ url: `/heli/storage/delete?id=` + id }) -} - -// 导出入/出库 Excel -export const exportStorage = async (params) => { - return await request.download({ url: `/heli/storage/export-excel`, params }) -} \ No newline at end of file +import request from '@/config/axios' + +export interface StorageVO { + id: number + stockType: number + stockInType: number + stockOutType: number + stockNo: string + headerNo: number + description: string + status: number + whId: number + keeper: number + keeperTime: Date + outbound: number + outboundTime: Date + cancel: number + cancelTime: Date +} + +// 查询入/出库分页 +export const getStoragePage = async (params) => { + return await request.get({ url: `/heli/storage/page`, params }) +} + +// 查询入/出库详情 +export const getStorage = async (id: number) => { + return await request.get({ url: `/heli/storage/get?id=` + id }) +} + +// 新增入/出库 +export const createStorage = async (data: StorageVO) => { + return await request.post({ url: `/heli/storage/create`, data }) +} + +// 修改入/出库 +export const updateStorage = async (data: StorageVO) => { + return await request.put({ url: `/heli/storage/update`, data }) +} + +// 删除入/出库 +export const deleteStorage = async (id: number) => { + return await request.delete({ url: `/heli/storage/delete?id=` + id }) +} + +// 导出入/出库 Excel +export const exportStorage = async (params) => { + return await request.download({ url: `/heli/storage/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts new file mode 100644 index 00000000..552e5b43 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts @@ -0,0 +1,49 @@ +import request from '@/config/axios' + +export interface StorageMatVO { + id: number + stockId: number + matId: number + whId: number + rgId: number + pnId: number + storageOkQty: number + lotNo: string + description: string +} + +// 查询入/出库物料分页 +export const getStorageMatPage = async (params) => { + return await request.get({ url: `/heli/storage-mat/page`, params }) +} + +// 查询入/出库物料详情 +export const getStorageMat = async (id: number) => { + return await request.get({ url: `/heli/storage-mat/get?id=` + id }) +} + +// 新增入/出库物料 +export const createStorageMat = async (data: StorageMatVO) => { + return await request.post({ url: `/heli/storage-mat/create`, data }) +} + +// 批量新增入/出库物料 +export const createStorageMatBatch = async (data: StorageMatVO[]) => { + return await request.post({ url: `/heli/storage-mat/create-batch`, data }) +} + + +// 修改入/出库物料 +export const updateStorageMat = async (data: StorageMatVO) => { + return await request.put({ url: `/heli/storage-mat/update`, data }) +} + +// 删除入/出库物料 +export const deleteStorageMat = async (id: number) => { + return await request.delete({ url: `/heli/storage-mat/delete?id=` + id }) +} + +// 导出入/出库物料 Excel +export const exportStorageMat = async (params) => { + return await request.download({ url: `/heli/storage-mat/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue index 25bd407b..a29fc7f2 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue @@ -39,8 +39,8 @@ - - + + @@ -91,7 +91,7 @@ - +