diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorageController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorageController.java new file mode 100644 index 00000000..146ba3a5 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorageController.java @@ -0,0 +1,117 @@ +package org.dromara.wms.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.wms.domain.bo.WmsPsmStorageBo; +import org.dromara.wms.domain.vo.WmsPsmStorageVo; +import org.dromara.wms.service.IWmsPsmStorageService; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 成品库存 + * 前端访问路由地址为:/system/psmStorage + * + * @author LionLi + * @date 2025-01-15 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/psmStorage") +public class WmsPsmStorageController extends BaseController { + + private final IWmsPsmStorageService wmsPsmStorageService; + + /** + * 查询成品库存列表 + */ + @SaCheckPermission("system:psmStorage:list") + @GetMapping("/list") + public TableDataInfo list(WmsPsmStorageBo bo, PageQuery pageQuery) { + return wmsPsmStorageService.queryPageList(bo, pageQuery); + } + + /** + * 导出成品库存列表 + */ + @SaCheckPermission("system:psmStorage:export") + @Log(title = "成品库存", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsPsmStorageBo bo, HttpServletResponse response) { + List list = wmsPsmStorageService.queryList(bo); + ExcelUtil.exportExcel(list, "成品库存", WmsPsmStorageVo.class, response); + } + + /** + * 获取成品库存详细信息 + * + * @param objid 主键 + */ + @SaCheckPermission("system:psmStorage:query") + @GetMapping("/{objid}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long objid) { + return R.ok(wmsPsmStorageService.queryById(objid)); + } + + /** + * 新增成品库存 + */ + @SaCheckPermission("system:psmStorage:add") + @Log(title = "成品库存", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody WmsPsmStorageBo bo) { + return toAjax(wmsPsmStorageService.insertByBo(bo)); + } + + /** + * 修改成品库存 + */ + @SaCheckPermission("system:psmStorage:edit") + @Log(title = "成品库存", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsPsmStorageBo bo) { + return toAjax(wmsPsmStorageService.updateByBo(bo)); + } + + /** + * 删除成品库存 + * + * @param objids 主键串 + */ + @SaCheckPermission("system:psmStorage:remove") + @Log(title = "成品库存", businessType = BusinessType.DELETE) + @DeleteMapping("/{objids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] objids) { + return toAjax(wmsPsmStorageService.deleteWithValidByIds(List.of(objids), true)); + } + + + /** + * 下拉框查询成品库存列表 + */ + + @GetMapping("getWmsPsmStorageList") + public R> getWmsPsmStoragelist(WmsPsmStorageBo bo) { + List list = wmsPsmStorageService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorage.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorage.java new file mode 100644 index 00000000..a5111973 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorage.java @@ -0,0 +1,90 @@ +package org.dromara.wms.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.util.Date; + +/** + * 成品库存对象 wms_psm_storage + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@TableName("wms_psm_storage") +public class WmsPsmStorage{ + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + private Long objid; + + /** + * 物料ID + */ + private Long materialId; + + /** + * 轮胎规格 + */ + private String materialSpe; + + /** + * 硫化条码 + */ + private String tyreNo; + + /** + * 品级编号 + */ + private String checkGradeCode; + + /** + * 仓库名称 + */ + private String storeName; + + /** + * 库位条码 + */ + private String storePlaceCode; + + /** + * 工装条码 + */ + private String toolingBarcode; + /** + * 租户id + */ + private String tenantId; + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + private String materialCode; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorageBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorageBo.java new file mode 100644 index 00000000..336b4a30 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorageBo.java @@ -0,0 +1,74 @@ +package org.dromara.wms.domain.bo; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import org.dromara.wms.domain.WmsPsmStorage; + +/** + * 成品库存业务对象 wms_psm_storage + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsPsmStorage.class, reverseConvertGenerate = false) +public class WmsPsmStorageBo extends BaseEntity { + + /** + * 表主键 + */ + @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long objid; + + /** + * 物料ID + */ + @NotNull(message = "物料ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 轮胎规格 + */ + @NotBlank(message = "轮胎规格不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialSpe; + + /** + * 硫化条码 + */ + @NotBlank(message = "硫化条码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String tyreNo; + + /** + * 品级编号 + */ + @NotBlank(message = "品级编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String checkGradeCode; + + /** + * 仓库名称 + */ + @NotBlank(message = "仓库名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String storeName; + + /** + * 库位条码 + */ + @NotBlank(message = "库位条码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String storePlaceCode; + + /** + * 工装条码 + */ + @NotBlank(message = "工装条码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String toolingBarcode; + private String tenantId; + private String materialCode; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorageVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorageVo.java new file mode 100644 index 00000000..dc0a9cdf --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorageVo.java @@ -0,0 +1,108 @@ +package org.dromara.wms.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.wms.domain.WmsPsmStorage; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 成品库存视图对象 wms_psm_storage + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsPsmStorage.class) +public class WmsPsmStorageVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long objid; + + /** + * 物料ID + */ + @ExcelProperty(value = "物料ID") + private Long materialId; + + /** + * 轮胎规格 + */ + @ExcelProperty(value = "轮胎规格") + private String materialSpe; + + /** + * 硫化条码 + */ + @ExcelProperty(value = "硫化条码") + private String tyreNo; + + /** + * 品级编号 + */ + @ExcelProperty(value = "品级编号") + private String checkGradeCode; + + /** + * 仓库名称 + */ + @ExcelProperty(value = "仓库名称") + private String storeName; + + /** + * 库位条码 + */ + @ExcelProperty(value = "库位条码") + private String storePlaceCode; + + /** + * 工装条码 + */ + @ExcelProperty(value = "工装条码") + private String toolingBarcode; + + /** + * 租户id + */ + private String tenantId; + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + private String materialCode; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorageMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorageMapper.java new file mode 100644 index 00000000..b8407b41 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorageMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsPsmStorage; +import org.dromara.wms.domain.vo.WmsPsmStorageVo; + +/** + * 成品库存Mapper接口 + * + * @author LionLi + * @date 2025-01-15 + */ +public interface WmsPsmStorageMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorageService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorageService.java new file mode 100644 index 00000000..83a1727b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorageService.java @@ -0,0 +1,68 @@ +package org.dromara.wms.service; + +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.wms.domain.bo.WmsPsmStorageBo; +import org.dromara.wms.domain.vo.WmsPsmStorageVo; + +import java.util.Collection; +import java.util.List; + +/** + * 成品库存Service接口 + * + * @author LionLi + * @date 2025-01-15 + */ +public interface IWmsPsmStorageService { + + /** + * 查询成品库存 + * + * @param objid 主键 + * @return 成品库存 + */ + WmsPsmStorageVo queryById(Long objid); + + /** + * 分页查询成品库存列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 成品库存分页列表 + */ + TableDataInfo queryPageList(WmsPsmStorageBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的成品库存列表 + * + * @param bo 查询条件 + * @return 成品库存列表 + */ + List queryList(WmsPsmStorageBo bo); + + /** + * 新增成品库存 + * + * @param bo 成品库存 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsPsmStorageBo bo); + + /** + * 修改成品库存 + * + * @param bo 成品库存 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsPsmStorageBo bo); + + /** + * 校验并批量删除成品库存信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPsmStorageServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPsmStorageServiceImpl.java new file mode 100644 index 00000000..1146d56b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPsmStorageServiceImpl.java @@ -0,0 +1,139 @@ +package org.dromara.wms.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.wms.domain.WmsPsmStorage; +import org.dromara.wms.domain.bo.WmsPsmStorageBo; +import org.dromara.wms.domain.vo.WmsPsmStorageVo; +import org.dromara.wms.mapper.WmsPsmStorageMapper; +import org.dromara.wms.service.IWmsPsmStorageService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 成品库存Service业务层处理 + * + * @author LionLi + * @date 2025-01-15 + */ +@RequiredArgsConstructor +@Service +public class WmsPsmStorageServiceImpl implements IWmsPsmStorageService { + + private final WmsPsmStorageMapper baseMapper; + + /** + * 查询成品库存 + * + * @param objid 主键 + * @return 成品库存 + */ + @Override + public WmsPsmStorageVo queryById(Long objid){ + return baseMapper.selectVoById(objid); + } + + /** + * 分页查询成品库存列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 成品库存分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsPsmStorageBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的成品库存列表 + * + * @param bo 查询条件 + * @return 成品库存列表 + */ + @Override + public List queryList(WmsPsmStorageBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(WmsPsmStorageBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsPsmStorage.class) + .selectAll(WmsPsmStorage.class) + .eq(bo.getObjid() != null, WmsPsmStorage::getObjid, bo.getObjid()) + .eq(bo.getMaterialId() != null, WmsPsmStorage::getMaterialId, bo.getMaterialId()) + .eq(StringUtils.isNotBlank(bo.getMaterialSpe()), WmsPsmStorage::getMaterialSpe, bo.getMaterialSpe()) + .eq(StringUtils.isNotBlank(bo.getTyreNo()), WmsPsmStorage::getTyreNo, bo.getTyreNo()) + .eq(StringUtils.isNotBlank(bo.getCheckGradeCode()), WmsPsmStorage::getCheckGradeCode, bo.getCheckGradeCode()) + .like(StringUtils.isNotBlank(bo.getStoreName()), WmsPsmStorage::getStoreName, bo.getStoreName()) + .eq(StringUtils.isNotBlank(bo.getStorePlaceCode()), WmsPsmStorage::getStorePlaceCode, bo.getStorePlaceCode()) + .eq(StringUtils.isNotBlank(bo.getToolingBarcode()), WmsPsmStorage::getToolingBarcode, bo.getToolingBarcode()) + .orderByDesc(WmsPsmStorage::getCreateTime); + return lqw; + } + + /** + * 新增成品库存 + * + * @param bo 成品库存 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsPsmStorageBo bo) { + WmsPsmStorage add = MapstructUtils.convert(bo, WmsPsmStorage.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setObjid(add.getObjid()); + } + return flag; + } + + /** + * 修改成品库存 + * + * @param bo 成品库存 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsPsmStorageBo bo) { + WmsPsmStorage update = MapstructUtils.convert(bo, WmsPsmStorage.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsPsmStorage entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除成品库存信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPsmStorageMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPsmStorageMapper.xml new file mode 100644 index 00000000..f958440a --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPsmStorageMapper.xml @@ -0,0 +1,7 @@ + + + + +