diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorePlaceController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorePlaceController.java new file mode 100644 index 00000000..72742089 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsPsmStorePlaceController.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.WmsPsmStorePlaceBo; +import org.dromara.wms.domain.vo.WmsPsmStorePlaceVo; +import org.dromara.wms.service.IWmsPsmStorePlaceService; +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/psmStorePlace + * + * @author LionLi + * @date 2025-01-15 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/psmStorePlace") +public class WmsPsmStorePlaceController extends BaseController { + + private final IWmsPsmStorePlaceService wmsPsmStorePlaceService; + + /** + * 查询成品库位管理列表 + */ + @SaCheckPermission("system:psmStorePlace:list") + @GetMapping("/list") + public TableDataInfo list(WmsPsmStorePlaceBo bo, PageQuery pageQuery) { + return wmsPsmStorePlaceService.queryPageList(bo, pageQuery); + } + + /** + * 导出成品库位管理列表 + */ + @SaCheckPermission("system:psmStorePlace:export") + @Log(title = "成品库位管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsPsmStorePlaceBo bo, HttpServletResponse response) { + List list = wmsPsmStorePlaceService.queryList(bo); + ExcelUtil.exportExcel(list, "成品库位管理", WmsPsmStorePlaceVo.class, response); + } + + /** + * 获取成品库位管理详细信息 + * + * @param storePlaceId 主键 + */ + @SaCheckPermission("system:psmStorePlace:query") + @GetMapping("/{storePlaceId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long storePlaceId) { + return R.ok(wmsPsmStorePlaceService.queryById(storePlaceId)); + } + + /** + * 新增成品库位管理 + */ + @SaCheckPermission("system:psmStorePlace:add") + @Log(title = "成品库位管理", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@RequestBody WmsPsmStorePlaceBo bo) { + return toAjax(wmsPsmStorePlaceService.insertByBo(bo)); + } + + /** + * 修改成品库位管理 + */ + @SaCheckPermission("system:psmStorePlace:edit") + @Log(title = "成品库位管理", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@RequestBody WmsPsmStorePlaceBo bo) { + return toAjax(wmsPsmStorePlaceService.updateByBo(bo)); + } + + /** + * 删除成品库位管理 + * + * @param storePlaceIds 主键串 + */ + @SaCheckPermission("system:psmStorePlace:remove") + @Log(title = "成品库位管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{storePlaceIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] storePlaceIds) { + return toAjax(wmsPsmStorePlaceService.deleteWithValidByIds(List.of(storePlaceIds), true)); + } + + + /** + * 下拉框查询成品库位管理列表 + */ + + @GetMapping("getWmsPsmStorePlaceList") + public R> getWmsPsmStorePlacelist(WmsPsmStorePlaceBo bo) { + List list = wmsPsmStorePlaceService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorePlace.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorePlace.java new file mode 100644 index 00000000..1d560674 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsPsmStorePlace.java @@ -0,0 +1,78 @@ +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_store_place + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@TableName("wms_psm_store_place") +public class WmsPsmStorePlace { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @TableId(type = IdType.AUTO) + private Long storePlaceId; + + /** + * 库位编码 + */ + private String storePlaceCode; + + /** + * 库位名称 + */ + private String storePlaceName; + + /** + * 所属仓库 + */ + private Long storeId; + + /** + * sap库区代码 + */ + private String sapCode; + /** + * 租户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; + @TableField(exist = false) + private String storeCode; + + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorePlaceBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorePlaceBo.java new file mode 100644 index 00000000..1489d8b5 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsPsmStorePlaceBo.java @@ -0,0 +1,57 @@ +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.WmsPsmStorePlace; + +/** + * 成品库位管理业务对象 wms_psm_store_place + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsPsmStorePlace.class, reverseConvertGenerate = false) +public class WmsPsmStorePlaceBo extends BaseEntity { + + /** + * 表主键 + */ + @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long storePlaceId; + + /** + * 库位编码 + */ + @NotBlank(message = "库位编码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String storePlaceCode; + + /** + * 库位名称 + */ + @NotBlank(message = "库位名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String storePlaceName; + + /** + * 所属仓库 + */ + @NotNull(message = "所属仓库不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long storeId; + + /** + * sap库区代码 + */ + @NotBlank(message = "sap库区代码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String sapCode; + + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorePlaceVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorePlaceVo.java new file mode 100644 index 00000000..ba86e041 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsPsmStorePlaceVo.java @@ -0,0 +1,91 @@ +package org.dromara.wms.domain.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +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.WmsPsmStorePlace; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 成品库位管理视图对象 wms_psm_store_place + * + * @author LionLi + * @date 2025-01-15 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsPsmStorePlace.class) +public class WmsPsmStorePlaceVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long storePlaceId; + + /** + * 库位编码 + */ + @ExcelProperty(value = "库位编码") + private String storePlaceCode; + + /** + * 库位名称 + */ + @ExcelProperty(value = "库位名称") + private String storePlaceName; + + /** + * 所属仓库 + */ + @ExcelProperty(value = "所属仓库") + private Long storeId; + + /** + * sap库区代码 + */ + @ExcelProperty(value = "sap库区代码") + private String sapCode; + + /** + * 租户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 storeCode; + + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorePlaceMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorePlaceMapper.java new file mode 100644 index 00000000..a32db176 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsPsmStorePlaceMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsPsmStorePlace; +import org.dromara.wms.domain.vo.WmsPsmStorePlaceVo; + +/** + * 成品库位管理Mapper接口 + * + * @author LionLi + * @date 2025-01-15 + */ +public interface WmsPsmStorePlaceMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorePlaceService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorePlaceService.java new file mode 100644 index 00000000..398baf71 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsPsmStorePlaceService.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.WmsPsmStorePlaceBo; +import org.dromara.wms.domain.vo.WmsPsmStorePlaceVo; + +import java.util.Collection; +import java.util.List; + +/** + * 成品库位管理Service接口 + * + * @author LionLi + * @date 2025-01-15 + */ +public interface IWmsPsmStorePlaceService { + + /** + * 查询成品库位管理 + * + * @param storePlaceId 主键 + * @return 成品库位管理 + */ + WmsPsmStorePlaceVo queryById(Long storePlaceId); + + /** + * 分页查询成品库位管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 成品库位管理分页列表 + */ + TableDataInfo queryPageList(WmsPsmStorePlaceBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的成品库位管理列表 + * + * @param bo 查询条件 + * @return 成品库位管理列表 + */ + List queryList(WmsPsmStorePlaceBo bo); + + /** + * 新增成品库位管理 + * + * @param bo 成品库位管理 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsPsmStorePlaceBo bo); + + /** + * 修改成品库位管理 + * + * @param bo 成品库位管理 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsPsmStorePlaceBo 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/WmsPsmStorePlaceServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPsmStorePlaceServiceImpl.java new file mode 100644 index 00000000..35e6e503 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsPsmStorePlaceServiceImpl.java @@ -0,0 +1,138 @@ +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.WmsPsmStore; +import org.dromara.wms.domain.WmsPsmStorePlace; +import org.dromara.wms.domain.bo.WmsPsmStorePlaceBo; +import org.dromara.wms.domain.vo.WmsPsmStorePlaceVo; +import org.dromara.wms.mapper.WmsPsmStorePlaceMapper; +import org.dromara.wms.service.IWmsPsmStorePlaceService; +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 WmsPsmStorePlaceServiceImpl implements IWmsPsmStorePlaceService { + + private final WmsPsmStorePlaceMapper baseMapper; + + /** + * 查询成品库位管理 + * + * @param storePlaceId 主键 + * @return 成品库位管理 + */ + @Override + public WmsPsmStorePlaceVo queryById(Long storePlaceId){ + return baseMapper.selectVoById(storePlaceId); + } + + /** + * 分页查询成品库位管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 成品库位管理分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsPsmStorePlaceBo 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(WmsPsmStorePlaceBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(WmsPsmStorePlaceBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsPsmStorePlace.class) + .selectAll(WmsPsmStorePlace.class).select(WmsPsmStore::getStoreCode) + .leftJoin(WmsPsmStore.class,WmsPsmStore::getStoreId,WmsPsmStorePlace::getStoreId) + .eq(bo.getStorePlaceId() != null, WmsPsmStorePlace::getStorePlaceId, bo.getStorePlaceId()) + .eq(StringUtils.isNotBlank(bo.getStorePlaceCode()), WmsPsmStorePlace::getStorePlaceCode, bo.getStorePlaceCode()) + .like(StringUtils.isNotBlank(bo.getStorePlaceName()), WmsPsmStorePlace::getStorePlaceName, bo.getStorePlaceName()) + .eq(bo.getStoreId() != null, WmsPsmStorePlace::getStoreId, bo.getStoreId()) + .eq(StringUtils.isNotBlank(bo.getSapCode()), WmsPsmStorePlace::getSapCode, bo.getSapCode()) + .orderByDesc(WmsPsmStorePlace::getCreateTime); + return lqw; + } + + /** + * 新增成品库位管理 + * + * @param bo 成品库位管理 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsPsmStorePlaceBo bo) { + WmsPsmStorePlace add = MapstructUtils.convert(bo, WmsPsmStorePlace.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setStorePlaceId(add.getStorePlaceId()); + } + return flag; + } + + /** + * 修改成品库位管理 + * + * @param bo 成品库位管理 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsPsmStorePlaceBo bo) { + WmsPsmStorePlace update = MapstructUtils.convert(bo, WmsPsmStorePlace.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsPsmStorePlace 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/WmsPsmStorePlaceMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPsmStorePlaceMapper.xml new file mode 100644 index 00000000..f9cff765 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsPsmStorePlaceMapper.xml @@ -0,0 +1,7 @@ + + + + +