新增成品库存页面

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

@ -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<WmsPsmStorageVo> 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<WmsPsmStorageVo> list = wmsPsmStorageService.queryList(bo);
ExcelUtil.exportExcel(list, "成品库存", WmsPsmStorageVo.class, response);
}
/**
*
*
* @param objid
*/
@SaCheckPermission("system:psmStorage:query")
@GetMapping("/{objid}")
public R<WmsPsmStorageVo> 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<Void> 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<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] objids) {
return toAjax(wmsPsmStorageService.deleteWithValidByIds(List.of(objids), true));
}
/**
*
*/
@GetMapping("getWmsPsmStorageList")
public R<List<WmsPsmStorageVo>> getWmsPsmStoragelist(WmsPsmStorageBo bo) {
List<WmsPsmStorageVo> list = wmsPsmStorageService.queryList(bo);
return R.ok(list);
}
}

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

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

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

@ -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<WmsPsmStorage, WmsPsmStorageVo> {
}

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

@ -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<WmsPsmStorageVo> queryPageList(WmsPsmStorageBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<WmsPsmStorage> lqw = buildQueryWrapper(bo);
Page<WmsPsmStorageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<WmsPsmStorageVo> queryList(WmsPsmStorageBo bo) {
MPJLambdaWrapper<WmsPsmStorage> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<WmsPsmStorage> buildQueryWrapper(WmsPsmStorageBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsPsmStorage> 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<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.WmsPsmStorageMapper">
</mapper>
Loading…
Cancel
Save