Compare commits

...

2 Commits

@ -10,7 +10,7 @@ import org.dromara.wms.domain.BaseMaterialInfo;
import org.dromara.wms.domain.bo.BaseMaterialInfoBo;
import org.dromara.wms.domain.vo.BaseMaterialInfoVo;
import org.dromara.wms.service.IBaseMaterialInfoService;
import org.dromara.wms.utils.BarcodePrintUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;

@ -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.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.wms.domain.vo.WmsOutstockRecordVo;
import org.dromara.wms.domain.bo.WmsOutstockRecordBo;
import org.dromara.wms.service.IWmsOutstockRecordService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
* 访:/wms/outstockRecord
*
* @author Yinq
* @date 2025-01-09
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/outstockRecord")
public class WmsOutstockRecordController extends BaseController {
private final IWmsOutstockRecordService wmsOutstockRecordService;
/**
*
*/
@SaCheckPermission("wms:outstockRecord:list")
@GetMapping("/list")
public TableDataInfo<WmsOutstockRecordVo> list(WmsOutstockRecordBo bo, PageQuery pageQuery) {
return wmsOutstockRecordService.queryPageList(bo, pageQuery);
}
/**
*
*/
@SaCheckPermission("wms:outstockRecord:export")
@Log(title = "出库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsOutstockRecordBo bo, HttpServletResponse response) {
List<WmsOutstockRecordVo> list = wmsOutstockRecordService.queryList(bo);
ExcelUtil.exportExcel(list, "出库记录", WmsOutstockRecordVo.class, response);
}
/**
*
*
* @param outstockRecordId
*/
@SaCheckPermission("wms:outstockRecord:query")
@GetMapping("/{outstockRecordId}")
public R<WmsOutstockRecordVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long outstockRecordId) {
return R.ok(wmsOutstockRecordService.queryById(outstockRecordId));
}
/**
*
*/
@SaCheckPermission("wms:outstockRecord:add")
@Log(title = "出库记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsOutstockRecordBo bo) {
return toAjax(wmsOutstockRecordService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("wms:outstockRecord:edit")
@Log(title = "出库记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsOutstockRecordBo bo) {
return toAjax(wmsOutstockRecordService.updateByBo(bo));
}
/**
*
*
* @param outstockRecordIds
*/
@SaCheckPermission("wms:outstockRecord:remove")
@Log(title = "出库记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{outstockRecordIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] outstockRecordIds) {
return toAjax(wmsOutstockRecordService.deleteWithValidByIds(List.of(outstockRecordIds), true));
}
/**
*
*/
@GetMapping("getWmsOutstockRecordList")
public R<List<WmsOutstockRecordVo>> getWmsOutstockRecordlist(WmsOutstockRecordBo bo) {
List<WmsOutstockRecordVo> list = wmsOutstockRecordService.queryList(bo);
return R.ok(list);
}
}

@ -0,0 +1,87 @@
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;
/**
* wms_outstock_record
*
* @author Yinq
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_outstock_record")
public class WmsOutstockRecord extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.AUTO,value = "outstock_record_id")
private Long outstockRecordId;
/**
*
*/
private String outstockCode;
/**
*
*/
private Long outstockId;
/**
*
*/
private String batchCode;
/**
* id
*/
private Long materialId;
/**
*
*/
private String locationCode;
/**
*
*/
private Long outstockQty;
/**
*
*/
private String materialCategories;
/**
* erp
*/
private String erpSynchronousStatus;
/**
* erp
*/
private Long erpSynchronousQty;
/**
*
*/
@TableField(exist = false)
private String materialCode;
@TableField(exist = false)
private String materialName;
@TableField(exist = false)
private String materialUnit;
@TableField(exist = false)
private String materialSpec;
}

@ -0,0 +1,74 @@
package org.dromara.wms.domain.bo;
import org.dromara.wms.domain.WmsOutstockRecord;
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.*;
/**
* wms_outstock_record
*
* @author Yinq
* @date 2025-01-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WmsOutstockRecord.class, reverseConvertGenerate = false)
public class WmsOutstockRecordBo extends BaseEntity {
/**
*
*/
private Long outstockRecordId;
/**
*
*/
private String outstockCode;
/**
*
*/
private Long outstockId;
/**
*
*/
private String batchCode;
/**
* id
*/
private Long materialId;
/**
*
*/
private String locationCode;
/**
*
*/
private Long outstockQty;
/**
*
*/
private String materialCategories;
/**
* erp
*/
private String erpSynchronousStatus;
/**
* erp
*/
private Long erpSynchronousQty;
}

@ -0,0 +1,111 @@
package org.dromara.wms.domain.vo;
import org.dromara.wms.domain.WmsOutstockRecord;
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 java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* wms_outstock_record
*
* @author Yinq
* @date 2025-01-09
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WmsOutstockRecord.class)
public class WmsOutstockRecordVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "出库记录主键")
private Long outstockRecordId;
/**
*
*/
@ExcelProperty(value = "出库单号")
private String outstockCode;
/**
*
*/
@ExcelProperty(value = "出库单 主键")
private Long outstockId;
/**
*
*/
@ExcelProperty(value = "批次码")
private String batchCode;
/**
* id
*/
@ExcelProperty(value = "物料id")
private Long materialId;
/**
*
*/
@ExcelProperty(value = "库位编码")
private String locationCode;
/**
*
*/
@ExcelProperty(value = "出库数量")
private Long outstockQty;
/**
*
*/
@ExcelProperty(value = "物料大类", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "mes_material_categories")
private String materialCategories;
/**
*
*/
@ExcelProperty(value = "出库人")
private String createBy;
/**
*
*/
@ExcelProperty(value = "提交时间")
private Date createTime;
/**
* erp
*/
@ExcelProperty(value = "erp同步状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String erpSynchronousStatus;
/**
* erp
*/
@ExcelProperty(value = "erp同步数量")
private Long erpSynchronousQty;
/**
*
*/
private String materialCode;
private String materialName;
private String materialUnit;
private String materialSpec;
}

@ -0,0 +1,15 @@
package org.dromara.wms.mapper;
import org.dromara.wms.domain.WmsOutstockRecord;
import org.dromara.wms.domain.vo.WmsOutstockRecordVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* Mapper
*
* @author Yinq
* @date 2025-01-09
*/
public interface WmsOutstockRecordMapper extends BaseMapperPlus<WmsOutstockRecord, WmsOutstockRecordVo> {
}

@ -0,0 +1,69 @@
package org.dromara.wms.service;
import org.dromara.wms.domain.WmsOutstockRecord;
import org.dromara.wms.domain.vo.WmsOutstockRecordVo;
import org.dromara.wms.domain.bo.WmsOutstockRecordBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2025-01-09
*/
public interface IWmsOutstockRecordService {
/**
*
*
* @param outstockRecordId
* @return
*/
WmsOutstockRecordVo queryById(Long outstockRecordId);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<WmsOutstockRecordVo> queryPageList(WmsOutstockRecordBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<WmsOutstockRecordVo> queryList(WmsOutstockRecordBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean insertByBo(WmsOutstockRecordBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBo(WmsOutstockRecordBo 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.BaseMaterialInfo;
import org.springframework.stereotype.Service;
import org.dromara.wms.domain.bo.WmsOutstockRecordBo;
import org.dromara.wms.domain.vo.WmsOutstockRecordVo;
import org.dromara.wms.domain.WmsOutstockRecord;
import org.dromara.wms.mapper.WmsOutstockRecordMapper;
import org.dromara.wms.service.IWmsOutstockRecordService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author Yinq
* @date 2025-01-09
*/
@RequiredArgsConstructor
@Service
public class WmsOutstockRecordServiceImpl implements IWmsOutstockRecordService {
private final WmsOutstockRecordMapper baseMapper;
/**
*
*
* @param outstockRecordId
* @return
*/
@Override
public WmsOutstockRecordVo queryById(Long outstockRecordId) {
return baseMapper.selectVoById(outstockRecordId);
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<WmsOutstockRecordVo> queryPageList(WmsOutstockRecordBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<WmsOutstockRecord> lqw = buildQueryWrapper(bo);
Page<WmsOutstockRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<WmsOutstockRecordVo> queryList(WmsOutstockRecordBo bo) {
MPJLambdaWrapper<WmsOutstockRecord> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<WmsOutstockRecord> buildQueryWrapper(WmsOutstockRecordBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsOutstockRecord> lqw = JoinWrappers.lambda(WmsOutstockRecord.class)
.selectAll(WmsOutstockRecord.class)
.select(BaseMaterialInfo::getMaterialCode, BaseMaterialInfo::getMaterialName,BaseMaterialInfo::getMaterialUnit,BaseMaterialInfo::getMaterialSpec)
.leftJoin(BaseMaterialInfo.class,BaseMaterialInfo::getMaterialId,WmsOutstockRecord::getMaterialId)
.eq(StringUtils.isNotBlank(bo.getOutstockCode()), WmsOutstockRecord::getOutstockCode, bo.getOutstockCode())
.like(StringUtils.isNotBlank(bo.getLocationCode()), WmsOutstockRecord::getLocationCode, bo.getLocationCode())
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsOutstockRecord::getMaterialCategories, bo.getMaterialCategories())
.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsOutstockRecord::getErpSynchronousStatus, bo.getErpSynchronousStatus())
.orderByDesc(WmsOutstockRecord::getCreateTime);
return lqw;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean insertByBo(WmsOutstockRecordBo bo) {
WmsOutstockRecord add = MapstructUtils.convert(bo, WmsOutstockRecord.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setOutstockRecordId(add.getOutstockRecordId());
}
return flag;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean updateByBo(WmsOutstockRecordBo bo) {
WmsOutstockRecord update = MapstructUtils.convert(bo, WmsOutstockRecord.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(WmsOutstockRecord 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.WmsOutstockRecordMapper">
</mapper>
Loading…
Cancel
Save