From 19c351075d024f7433d5a6a3c98163f1f79d0bc2 Mon Sep 17 00:00:00 2001 From: wanghao Date: Thu, 9 Jan 2025 13:57:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseMaterialInfoController.java | 2 +- .../WmsOutstockRecordController.java | 117 +++++++++++++++ .../dromara/wms/domain/WmsOutstockRecord.java | 87 +++++++++++ .../wms/domain/bo/WmsOutstockRecordBo.java | 74 ++++++++++ .../wms/domain/vo/WmsOutstockRecordVo.java | 111 ++++++++++++++ .../wms/mapper/WmsOutstockRecordMapper.java | 15 ++ .../service/IWmsOutstockRecordService.java | 69 +++++++++ .../impl/WmsOutstockRecordServiceImpl.java | 138 ++++++++++++++++++ .../mapper/wms/WmsOutstockRecordMapper.xml | 7 + 9 files changed, 619 insertions(+), 1 deletion(-) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockRecordController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockRecord.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockRecordBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockRecordVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockRecordMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockRecordService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockRecordServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockRecordMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java index 3f153334..3bd31d45 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java @@ -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; diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockRecordController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockRecordController.java new file mode 100644 index 00000000..656bcaeb --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockRecordController.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.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 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 list = wmsOutstockRecordService.queryList(bo); + ExcelUtil.exportExcel(list, "出库记录", WmsOutstockRecordVo.class, response); + } + + /** + * 获取出库记录详细信息 + * + * @param outstockRecordId 主键 + */ + @SaCheckPermission("wms:outstockRecord:query") + @GetMapping("/{outstockRecordId}") + public R 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 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 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 remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] outstockRecordIds) { + return toAjax(wmsOutstockRecordService.deleteWithValidByIds(List.of(outstockRecordIds), true)); + } + + + /** + * 下拉框查询出库记录列表 + */ + + @GetMapping("getWmsOutstockRecordList") + public R> getWmsOutstockRecordlist(WmsOutstockRecordBo bo) { + List list = wmsOutstockRecordService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockRecord.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockRecord.java new file mode 100644 index 00000000..ee7c1da3 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockRecord.java @@ -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; +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockRecordBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockRecordBo.java new file mode 100644 index 00000000..ff945cf9 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockRecordBo.java @@ -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; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockRecordVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockRecordVo.java new file mode 100644 index 00000000..f25241e7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockRecordVo.java @@ -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; +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockRecordMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockRecordMapper.java new file mode 100644 index 00000000..fbbd0b6b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockRecordMapper.java @@ -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 { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockRecordService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockRecordService.java new file mode 100644 index 00000000..150fe2f8 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockRecordService.java @@ -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 queryPageList(WmsOutstockRecordBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的出库记录列表 + * + * @param bo 查询条件 + * @return 出库记录列表 + */ + List 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 ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockRecordServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockRecordServiceImpl.java new file mode 100644 index 00000000..235c0b4d --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockRecordServiceImpl.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.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 queryPageList(WmsOutstockRecordBo 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(WmsOutstockRecordBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(WmsOutstockRecordBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper 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 ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockRecordMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockRecordMapper.xml new file mode 100644 index 00000000..f650a95c --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockRecordMapper.xml @@ -0,0 +1,7 @@ + + + + +