wms新增物料wms_instock_print模块

master
maxw@mesnac.com 1 week ago
parent 303a1bc364
commit dcf6c749dd

@ -0,0 +1,112 @@
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.WmsInstockPrintBo;
import org.dromara.wms.domain.vo.WmsInstockPrintVo;
import org.dromara.wms.service.IWmsInstockPrintService;
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/instockPrint
*
* @author LionLi
* @date 2025-01-07
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/instockPrint")
public class WmsInstockPrintController extends BaseController {
private final IWmsInstockPrintService wmsInstockPrintService;
/**
* -
*/
@SaCheckPermission("system:instockPrint:list")
@GetMapping("/list")
public TableDataInfo<WmsInstockPrintVo> list(WmsInstockPrintBo bo, PageQuery pageQuery) {
return wmsInstockPrintService.queryPageList(bo, pageQuery);
}
/**
* -
*/
@SaCheckPermission("system:instockPrint:export")
@Log(title = "入库单-物料打印条码", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsInstockPrintBo bo, HttpServletResponse response) {
List<WmsInstockPrintVo> list = wmsInstockPrintService.queryList(bo);
ExcelUtil.exportExcel(list, "入库单-物料打印条码", WmsInstockPrintVo.class, response);
}
/**
* -
*
* @param instockPrintId
*/
@SaCheckPermission("system:instockPrint:query")
@GetMapping("/{instockPrintId}")
public R<WmsInstockPrintVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long instockPrintId) {
return R.ok(wmsInstockPrintService.queryById(instockPrintId));
}
/**
* -
*/
@SaCheckPermission("system:instockPrint:add")
@Log(title = "入库单-物料打印条码", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsInstockPrintBo bo) {
return toAjax(wmsInstockPrintService.insertByBo(bo));
}
/**
* -
*/
@SaCheckPermission("system:instockPrint:edit")
@Log(title = "入库单-物料打印条码", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsInstockPrintBo bo) {
return toAjax(wmsInstockPrintService.updateByBo(bo));
}
/**
* -
*
* @param instockPrintIds
*/
@SaCheckPermission("system:instockPrint:remove")
@Log(title = "入库单-物料打印条码", businessType = BusinessType.DELETE)
@DeleteMapping("/{instockPrintIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] instockPrintIds) {
return toAjax(wmsInstockPrintService.deleteWithValidByIds(List.of(instockPrintIds), true));
}
@PostMapping("/print")
public R<String> print(@RequestBody WmsInstockPrintBo bo){
List<WmsInstockPrintVo> vos = bo.getVos();
return null;
}
}

@ -0,0 +1,112 @@
package org.dromara.wms.domain;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.Date;
/**
* - wms_instock_print
*
* @author LionLi
* @date 2025-01-07
*/
@Data
//@EqualsAndHashCode(callSuper = true)
@TableName("wms_instock_print")
public class WmsInstockPrint{
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.AUTO)
private Long instockPrintId;
/**
*
*/
private String instockCode;
/**
*
*/
private String batchCode;
/**
*
*/
private Long materialQty;
/**
*
*/
private Long apportionQty;
/**
* id
*/
private Long materialId;
/**
*
*/
private String materialCode;
/**
*
*/
private String materialName;
/**
*
*/
private String materialSpe;
/**
*
*/
private String unitName;
/**
*
*/
private String codeYesNo;
/**
*
*/
private String materialCategories;
@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;
/**
* id
*/
private String tenantId;
}

@ -0,0 +1,101 @@
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.WmsInstockPrint;
import org.dromara.wms.domain.vo.WmsInstockPrintVo;
import java.util.List;
/**
* - wms_instock_print
*
* @author LionLi
* @date 2025-01-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WmsInstockPrint.class, reverseConvertGenerate = false)
public class WmsInstockPrintBo extends BaseEntity {
/**
*
*/
// @NotNull(message = "入库单子表主键不能为空", groups = { AddGroup.class, EditGroup.class })
private Long instockPrintId;
/**
*
*/
// @NotBlank(message = "入库单号不能为空", groups = { AddGroup.class, EditGroup.class })
private String instockCode;
/**
*
*/
// @NotBlank(message = "批次码不能为空", groups = { AddGroup.class, EditGroup.class })
private String batchCode;
/**
*
*/
// @NotNull(message = "条码数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long materialQty;
/**
*
*/
// @NotNull(message = "分包数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long apportionQty;
/**
* id
*/
// @NotNull(message = "物料id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long materialId;
/**
*
*/
// @NotBlank(message = "物料编码不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialCode;
/**
*
*/
// @NotBlank(message = "物料名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialName;
/**
*
*/
// @NotBlank(message = "物料规格不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialSpe;
/**
*
*/
// @NotBlank(message = "计量单位名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String unitName;
/**
*
*/
// @NotBlank(message = "是否有条码不能为空", groups = { AddGroup.class, EditGroup.class })
private String codeYesNo;
/**
*
*/
// @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialCategories;
private String tenantId;
private List<WmsInstockPrintVo> vos;
}

@ -0,0 +1,110 @@
package org.dromara.wms.domain.vo;
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.WmsInstockPrint;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* - wms_instock_print
*
* @author LionLi
* @date 2025-01-07
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WmsInstockPrint.class)
public class WmsInstockPrintVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "入库单子表主键")
private Long instockPrintId;
/**
*
*/
@ExcelProperty(value = "入库单号")
private String instockCode;
/**
*
*/
@ExcelProperty(value = "批次码")
private String batchCode;
/**
*
*/
@ExcelProperty(value = "条码数量")
private Long materialQty;
/**
*
*/
@ExcelProperty(value = "分包数量")
private Long apportionQty;
/**
* id
*/
@ExcelProperty(value = "物料id")
private Long materialId;
/**
*
*/
@ExcelProperty(value = "物料编码")
private String materialCode;
/**
*
*/
@ExcelProperty(value = "物料名称")
private String materialName;
/**
*
*/
@ExcelProperty(value = "物料规格")
private String materialSpe;
/**
*
*/
@ExcelProperty(value = "计量单位名称")
private String unitName;
/**
*
*/
@ExcelProperty(value = "是否有条码")
private String codeYesNo;
/**
*
*/
@ExcelProperty(value = "物料大类")
private String materialCategories;
/**
* id
*/
private String tenantId;
}

@ -0,0 +1,15 @@
package org.dromara.wms.mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.wms.domain.WmsInstockPrint;
import org.dromara.wms.domain.vo.WmsInstockPrintVo;
/**
* -Mapper
*
* @author LionLi
* @date 2025-01-07
*/
public interface WmsInstockPrintMapper extends BaseMapperPlus<WmsInstockPrint, WmsInstockPrintVo> {
}

@ -0,0 +1,73 @@
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.WmsInstockPrint;
import org.dromara.wms.domain.bo.WmsInstockDetailBo;
import org.dromara.wms.domain.bo.WmsInstockPrintBo;
import org.dromara.wms.domain.vo.WmsInstockPrintVo;
import java.util.Collection;
import java.util.List;
/**
* -Service
*
* @author LionLi
* @date 2025-01-07
*/
public interface IWmsInstockPrintService {
/**
* -
*
* @param instockPrintId
* @return -
*/
WmsInstockPrintVo queryById(Long instockPrintId);
/**
* -
*
* @param bo
* @param pageQuery
* @return -
*/
TableDataInfo<WmsInstockPrintVo> queryPageList(WmsInstockPrintBo bo, PageQuery pageQuery);
/**
* -
*
* @param bo
* @return -
*/
List<WmsInstockPrintVo> queryList(WmsInstockPrintBo bo);
long queryPrintNum(WmsInstockDetailBo bo);
/**
* -
*
* @param bo -
* @return
*/
Boolean insertByBo(WmsInstockPrintBo bo);
int insertWmsInstockPrint(WmsInstockPrint wmsInstockPrint);
/**
* -
*
* @param bo -
* @return
*/
Boolean updateByBo(WmsInstockPrintBo bo);
/**
* -
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -0,0 +1,154 @@
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.wms.domain.WmsInstockDetail;
import org.dromara.wms.domain.WmsInstockPrint;
import org.dromara.wms.domain.bo.WmsInstockDetailBo;
import org.dromara.wms.domain.bo.WmsInstockPrintBo;
import org.dromara.wms.domain.vo.WmsInstockPrintVo;
import org.dromara.wms.mapper.WmsInstockPrintMapper;
import org.dromara.wms.service.IWmsInstockPrintService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* -Service
*
* @author LionLi
* @date 2025-01-07
*/
@RequiredArgsConstructor
@Service
public class WmsInstockPrintServiceImpl implements IWmsInstockPrintService {
private final WmsInstockPrintMapper baseMapper;
/**
* -
*
* @param instockPrintId
* @return -
*/
@Override
public WmsInstockPrintVo queryById(Long instockPrintId){
return baseMapper.selectVoById(instockPrintId);
}
/**
* -
*
* @param bo
* @param pageQuery
* @return -
*/
@Override
public TableDataInfo<WmsInstockPrintVo> queryPageList(WmsInstockPrintBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsInstockPrint> lqw = buildQueryWrapper(bo);
lqw.orderByDesc(WmsInstockPrint::getCreateTime);
Page<WmsInstockPrintVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* -
*
* @param bo
* @return -
*/
@Override
public List<WmsInstockPrintVo> queryList(WmsInstockPrintBo bo) {
LambdaQueryWrapper<WmsInstockPrint> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
public long queryPrintNum(WmsInstockDetailBo bo){
LambdaQueryWrapper<WmsInstockPrint> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(WmsInstockPrint::getInstockCode,bo.getInstockCode());
wrapper.eq(WmsInstockPrint::getMaterialCode,bo.getMaterialCode());
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper<WmsInstockPrint> buildQueryWrapper(WmsInstockPrintBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<WmsInstockPrint> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getInstockPrintId() != null, WmsInstockPrint::getInstockPrintId, bo.getInstockPrintId());
lqw.eq(StringUtils.isNotBlank(bo.getInstockCode()), WmsInstockPrint::getInstockCode, bo.getInstockCode());
lqw.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsInstockPrint::getBatchCode, bo.getBatchCode());
lqw.eq(bo.getMaterialQty() != null, WmsInstockPrint::getMaterialQty, bo.getMaterialQty());
lqw.eq(bo.getApportionQty() != null, WmsInstockPrint::getApportionQty, bo.getApportionQty());
lqw.eq(bo.getMaterialId() != null, WmsInstockPrint::getMaterialId, bo.getMaterialId());
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsInstockPrint::getMaterialCode, bo.getMaterialCode());
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsInstockPrint::getMaterialName, bo.getMaterialName());
lqw.eq(StringUtils.isNotBlank(bo.getMaterialSpe()), WmsInstockPrint::getMaterialSpe, bo.getMaterialSpe());
lqw.like(StringUtils.isNotBlank(bo.getUnitName()), WmsInstockPrint::getUnitName, bo.getUnitName());
lqw.eq(StringUtils.isNotBlank(bo.getCodeYesNo()), WmsInstockPrint::getCodeYesNo, bo.getCodeYesNo());
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInstockPrint::getMaterialCategories, bo.getMaterialCategories());
return lqw;
}
/**
* -
*
* @param bo -
* @return
*/
@Override
public Boolean insertByBo(WmsInstockPrintBo bo) {
WmsInstockPrint add = MapstructUtils.convert(bo, WmsInstockPrint.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setInstockPrintId(add.getInstockPrintId());
}
return flag;
}
public int insertWmsInstockPrint(WmsInstockPrint wmsInstockPrint){
return baseMapper.insert(wmsInstockPrint);
}
/**
* -
*
* @param bo -
* @return
*/
@Override
public Boolean updateByBo(WmsInstockPrintBo bo) {
WmsInstockPrint update = MapstructUtils.convert(bo, WmsInstockPrint.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(WmsInstockPrint 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.WmsInstockPrintMapper">
</mapper>
Loading…
Cancel
Save