新增成品库位页面

master
maxw@mesnac.com 4 days ago
parent 73e74e0683
commit 4ebc55bfd4

@ -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<WmsPsmStorePlaceVo> 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<WmsPsmStorePlaceVo> list = wmsPsmStorePlaceService.queryList(bo);
ExcelUtil.exportExcel(list, "成品库位管理", WmsPsmStorePlaceVo.class, response);
}
/**
*
*
* @param storePlaceId
*/
@SaCheckPermission("system:psmStorePlace:query")
@GetMapping("/{storePlaceId}")
public R<WmsPsmStorePlaceVo> 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<Void> add(@RequestBody WmsPsmStorePlaceBo bo) {
return toAjax(wmsPsmStorePlaceService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("system:psmStorePlace:edit")
@Log(title = "成品库位管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@RequestBody WmsPsmStorePlaceBo bo) {
return toAjax(wmsPsmStorePlaceService.updateByBo(bo));
}
/**
*
*
* @param storePlaceIds
*/
@SaCheckPermission("system:psmStorePlace:remove")
@Log(title = "成品库位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{storePlaceIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] storePlaceIds) {
return toAjax(wmsPsmStorePlaceService.deleteWithValidByIds(List.of(storePlaceIds), true));
}
/**
*
*/
@GetMapping("getWmsPsmStorePlaceList")
public R<List<WmsPsmStorePlaceVo>> getWmsPsmStorePlacelist(WmsPsmStorePlaceBo bo) {
List<WmsPsmStorePlaceVo> list = wmsPsmStorePlaceService.queryList(bo);
return R.ok(list);
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<WmsPsmStorePlace, WmsPsmStorePlaceVo> {
}

@ -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<WmsPsmStorePlaceVo> queryPageList(WmsPsmStorePlaceBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<WmsPsmStorePlaceVo> 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<Long> ids, Boolean isValid);
}

@ -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<WmsPsmStorePlaceVo> queryPageList(WmsPsmStorePlaceBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<WmsPsmStorePlace> lqw = buildQueryWrapper(bo);
Page<WmsPsmStorePlaceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<WmsPsmStorePlaceVo> queryList(WmsPsmStorePlaceBo bo) {
MPJLambdaWrapper<WmsPsmStorePlace> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<WmsPsmStorePlace> buildQueryWrapper(WmsPsmStorePlaceBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsPsmStorePlace> 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<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

@ -0,0 +1,7 @@
<?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="org.dromara.wms.mapper.WmsPsmStorePlaceMapper">
</mapper>
Loading…
Cancel
Save