From 3c3259cf49245efb325f4b38acb70e221654441f Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:40:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Finstock=5Forder=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsInstockOrderController.java | 107 +++++++++ .../dromara/wms/domain/WmsInstockOrder.java | 104 +++++++++ .../wms/domain/bo/WmsInstockOrderBo.java | 91 ++++++++ .../wms/domain/vo/WmsInstockOrderVo.java | 102 +++++++++ .../wms/mapper/WmsInstockOrderMapper.java | 16 ++ .../wms/service/IWmsInstockOrderService.java | 68 ++++++ .../impl/WmsInstockOrderServiceImpl.java | 203 ++++++++++++++++++ .../mapper/wms/WmsInstockOrderMapper.xml | 23 ++ 8 files changed, 714 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockOrder.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockOrderBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockOrderVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockOrderMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockOrderMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java new file mode 100644 index 00000000..a8b5e8c6 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockOrderController.java @@ -0,0 +1,107 @@ +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.WmsInstockOrderBo; +import org.dromara.wms.domain.vo.WmsInstockOrderVo; +import org.dromara.wms.service.IWmsInstockOrderService; +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/instockOrder + * + * @author LionLi + * @date 2025-01-06 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/instockOrder") +public class WmsInstockOrderController extends BaseController { + + private final IWmsInstockOrderService wmsInstockOrderService; + + /** + * 查询入库单列表 + */ + @SaCheckPermission("system:instockOrder:list") + @GetMapping("/list") + public TableDataInfo list(WmsInstockOrderBo bo, PageQuery pageQuery) { + return wmsInstockOrderService.queryPageList(bo, pageQuery); + } + + /** + * 导出入库单列表 + */ + @SaCheckPermission("system:instockOrder:export") + @Log(title = "入库单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsInstockOrderBo bo, HttpServletResponse response) { + List list = wmsInstockOrderService.queryList(bo); + ExcelUtil.exportExcel(list, "入库单", WmsInstockOrderVo.class, response); + } + + /** + * 获取入库单详细信息 + * + * @param instockId 主键 + */ +// @SaCheckPermission("system:instockOrder:query") + @GetMapping("/{instockId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long instockId) { + return R.ok(wmsInstockOrderService.queryById(instockId)); + } + + /** + * 新增入库单 + */ + @SaCheckPermission("system:instockOrder:add") + @Log(title = "入库单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add( @RequestBody WmsInstockOrderBo bo) { + return toAjax(wmsInstockOrderService.insertByBo(bo)); + } + + /** + * 修改入库单 + */ + @SaCheckPermission("system:instockOrder:edit") + @Log(title = "入库单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsInstockOrderBo bo) { + return toAjax(wmsInstockOrderService.updateByBo(bo)); + } + + /** + * 删除入库单 + * + * @param instockIds 主键串 + */ + @SaCheckPermission("system:instockOrder:remove") + @Log(title = "入库单", businessType = BusinessType.DELETE) + @DeleteMapping("/{instockIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] instockIds) { + return toAjax(wmsInstockOrderService.deleteWithValidByIds(List.of(instockIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockOrder.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockOrder.java new file mode 100644 index 00000000..9cb8eee7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockOrder.java @@ -0,0 +1,104 @@ +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.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 入库单对象 wms_instock_order + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +//@EqualsAndHashCode(callSuper = true) +@TableName("wms_instock_order") +public class WmsInstockOrder{ + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 入库单 主键 + */ + private Long instockId; + + /** + * 入库单号 + */ + private String instockCode; + + /** + * 物料大类 + */ + private String materialCategories; + + /** + * 工单类型(1采购订单,2生产订单,3手工,4系统生成) + */ + private String instockType; + + /** + * 订单编号 + */ + private String orderNo; + + /** + * 审核人 + */ + private String auditBy; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + private String auditStatus; + + /** + * 审核意见 + */ + private String auditComments; + + /** + * 仓库ID + */ + private Long warehouseId; + + + @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; + @TableField(exist = false) + private String warehouseCode;//字段映射 +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockOrderBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockOrderBo.java new file mode 100644 index 00000000..8c4d1bdb --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockOrderBo.java @@ -0,0 +1,91 @@ +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 java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.WmsInstockOrder; + +/** + * 入库单业务对象 wms_instock_order + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsInstockOrder.class, reverseConvertGenerate = false) +public class WmsInstockOrderBo extends BaseEntity { + + /** + * 入库单 主键 + */ + @NotNull(message = "入库单 主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long instockId; + + /** + * 入库单号 + */ + @NotBlank(message = "入库单号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String instockCode; + + /** + * 物料大类 + */ + @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCategories; + + /** + * 工单类型(1采购订单,2生产订单,3手工,4系统生成) + */ + @NotBlank(message = "工单类型(1采购订单,2生产订单,3手工,4系统生成)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String instockType; + + /** + * 订单编号 + */ + @NotBlank(message = "订单编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String orderNo; + + /** + * 审核人 + */ + @NotBlank(message = "审核人不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditBy; + + /** + * 审核时间 + */ + @NotNull(message = "审核时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + @NotBlank(message = "审核状态(0待审核,1审核通过,2审核未通过)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditStatus; + + /** + * 审核意见 + */ + @NotBlank(message = "审核意见不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditComments; + + /** + * 仓库ID + */ + @NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long warehouseId; + /** + * 租户id + */ + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockOrderVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockOrderVo.java new file mode 100644 index 00000000..a8fa5e8d --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockOrderVo.java @@ -0,0 +1,102 @@ +package org.dromara.wms.domain.vo; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.WmsInstockOrder; +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_instock_order + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsInstockOrder.class) +public class WmsInstockOrderVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 入库单 主键 + */ + @ExcelProperty(value = "入库单 主键") + private Long instockId; + + /** + * 入库单号 + */ + @ExcelProperty(value = "入库单号") + private String instockCode; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private String materialCategories; + + /** + * 工单类型(1采购订单,2生产订单,3手工,4系统生成) + */ + @ExcelProperty(value = "工单类型(1采购订单,2生产订单,3手工,4系统生成)") + private String instockType; + + /** + * 订单编号 + */ + @ExcelProperty(value = "订单编号") + private String orderNo; + + /** + * 审核人 + */ + @ExcelProperty(value = "审核人") + private String auditBy; + + /** + * 审核时间 + */ + @ExcelProperty(value = "审核时间") + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + @ExcelProperty(value = "审核状态(0待审核,1审核通过,2审核未通过)") + private String auditStatus; + + /** + * 审核意见 + */ + @ExcelProperty(value = "审核意见") + private String auditComments; + + /** + * 仓库ID + */ + @ExcelProperty(value = "仓库ID") + private Long warehouseId; + /** + * 租户id + */ + private String tenantId; + + private String warehouseCode;//字段映射 + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockOrderMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockOrderMapper.java new file mode 100644 index 00000000..bf79546e --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockOrderMapper.java @@ -0,0 +1,16 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsInstockOrder; +import org.dromara.wms.domain.vo.WmsInstockOrderVo; + +/** + * 入库单Mapper接口 + * + * @author LionLi + * @date 2025-01-06 + */ +public interface WmsInstockOrderMapper extends BaseMapperPlus { + + int updateInstock(WmsInstockOrder update); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java new file mode 100644 index 00000000..b000ceb4 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockOrderService.java @@ -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.WmsInstockOrderBo; +import org.dromara.wms.domain.vo.WmsInstockOrderVo; + +import java.util.Collection; +import java.util.List; + +/** + * 入库单Service接口 + * + * @author LionLi + * @date 2025-01-06 + */ +public interface IWmsInstockOrderService { + + /** + * 查询入库单 + * + * @param instockId 主键 + * @return 入库单 + */ + WmsInstockOrderVo queryById(Long instockId); + + /** + * 分页查询入库单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 入库单分页列表 + */ + TableDataInfo queryPageList(WmsInstockOrderBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的入库单列表 + * + * @param bo 查询条件 + * @return 入库单列表 + */ + List queryList(WmsInstockOrderBo bo); + + /** + * 新增入库单 + * + * @param bo 入库单 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsInstockOrderBo bo); + + /** + * 修改入库单 + * + * @param bo 入库单 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsInstockOrderBo 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/WmsInstockOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java new file mode 100644 index 00000000..2915c95f --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockOrderServiceImpl.java @@ -0,0 +1,203 @@ +package org.dromara.wms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +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.WmsBaseWarehouse; +import org.dromara.wms.domain.WmsConfiguration; +import org.dromara.wms.domain.WmsInstockOrder; +import org.dromara.wms.domain.bo.WmsConfigurationBo; +import org.dromara.wms.domain.bo.WmsInstockOrderBo; +import org.dromara.wms.domain.vo.WmsInstockOrderVo; +import org.dromara.wms.mapper.WmsInstockOrderMapper; +import org.dromara.wms.service.IWmsInstockOrderService; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Collection; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + +/** + * 入库单Service业务层处理 + * + * @author LionLi + * @date 2025-01-06 + */ +@RequiredArgsConstructor +@Service +public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService { + private static final AtomicInteger sequence = new AtomicInteger(999); + private final WmsInstockOrderMapper baseMapper; + public static Integer nextSequence() { + return sequence.incrementAndGet(); + } + + + /** + * 查询入库单 + * + * @param instockId 主键 + * @return 入库单 + */ + @Override + public WmsInstockOrderVo queryById(Long instockId){ + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsInstockOrder::getInstockId,instockId); + return baseMapper.selectVoOne(wrapper); + } + + /** + * 分页查询入库单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 入库单分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsInstockOrderBo bo, PageQuery pageQuery) { +// LambdaQueryWrapper lqw = buildQueryWrapper(bo); + MPJLambdaWrapper lqw = buildJoinQueryWrapper(bo); + lqw.orderByDesc(WmsInstockOrder::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的入库单列表 + * + * @param bo 查询条件 + * @return 入库单列表 + */ + @Override + public List queryList(WmsInstockOrderBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + private MPJLambdaWrapper buildJoinQueryWrapper(WmsInstockOrderBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsInstockOrder.class) + .selectAll(WmsInstockOrder.class) + .select(WmsBaseWarehouse::getWarehouseCode) + .leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsInstockOrder::getWarehouseId); + lqw.eq(bo.getInstockId() != null, WmsInstockOrder::getInstockId, bo.getInstockId()); + lqw.eq(StringUtils.isNotBlank(bo.getInstockCode()), WmsInstockOrder::getInstockCode, bo.getInstockCode()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInstockOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getInstockType()), WmsInstockOrder::getInstockType, bo.getInstockType()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), WmsInstockOrder::getOrderNo, bo.getOrderNo()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsInstockOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsInstockOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsInstockOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsInstockOrder::getAuditComments, bo.getAuditComments()); + lqw.eq(bo.getWarehouseId() != null, WmsInstockOrder::getWarehouseId, bo.getWarehouseId()); + return lqw; + } + private LambdaQueryWrapper buildQueryWrapper(WmsInstockOrderBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getInstockId() != null, WmsInstockOrder::getInstockId, bo.getInstockId()); + lqw.eq(StringUtils.isNotBlank(bo.getInstockCode()), WmsInstockOrder::getInstockCode, bo.getInstockCode()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInstockOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getInstockType()), WmsInstockOrder::getInstockType, bo.getInstockType()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), WmsInstockOrder::getOrderNo, bo.getOrderNo()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsInstockOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsInstockOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsInstockOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsInstockOrder::getAuditComments, bo.getAuditComments()); + lqw.eq(bo.getWarehouseId() != null, WmsInstockOrder::getWarehouseId, bo.getWarehouseId()); + return lqw; + } + + /** + * 新增入库单 + * + * @param bo 入库单 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsInstockOrderBo bo) { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm"); + String orderDate = format.format(date); + String order = "IN"; + String orderLast=""; + Integer value = nextSequence(); + if (value.toString().length()==4){ + sequence.set(1); + orderLast = generateOrder(sequence.get()); + }else { + orderLast = generateOrder(value); + } + String inStockOrder = order + orderDate + orderLast; + WmsInstockOrder add = MapstructUtils.convert(bo, WmsInstockOrder.class); + validEntityBeforeSave(add); + add.setInstockCode(inStockOrder); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setInstockId(add.getInstockId()); + } + return flag; + } + + public String generateOrder(Integer value){ + if (value.toString().length()<3){ + String fixedLengthString = String.format("%03d", value); + return fixedLengthString; + }else if (value.toString().length()==3){ + return value.toString(); + } + return value.toString(); + } + + /** + * 修改入库单 + * + * @param bo 入库单 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsInstockOrderBo bo) { + WmsInstockOrder update = MapstructUtils.convert(bo, WmsInstockOrder.class); + validEntityBeforeSave(update); +// LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); +// wrapper.eq(WmsInstockOrder::getInstockId,bo.getInstockId()); + int rows = baseMapper.updateInstock(update); + return rows > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsInstockOrder entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除入库单信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(WmsInstockOrder::getInstockId,ids); + return baseMapper.delete(wrapper)>0; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockOrderMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockOrderMapper.xml new file mode 100644 index 00000000..7b90d4cd --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockOrderMapper.xml @@ -0,0 +1,23 @@ + + + + + + update wms_instock_order + + instock_code = #{instockCode}, + material_categories = #{materialCategories}, + instock_type = #{instockType}, + audit_by = #{auditBy}, + audit_comments = #{auditComments}, + warehouse_id = #{warehouseId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where instock_id = #{instockId} + + From 303a1bc3641599bb710efda2f2e586e461e3b170 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:43:20 +0800 Subject: [PATCH 2/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Finstock=5Fdetail=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WmsInstockDetailController.java | 107 ++++++++++ .../dromara/wms/domain/WmsInstockDetail.java | 123 ++++++++++++ .../wms/domain/bo/WmsInstockDetailBo.java | 115 +++++++++++ .../wms/domain/vo/WmsInstockDetailVo.java | 140 +++++++++++++ .../wms/mapper/WmsInstockDetailMapper.java | 16 ++ .../wms/service/IWmsInstockDetailService.java | 68 +++++++ .../impl/WmsInstockDetailServiceImpl.java | 190 ++++++++++++++++++ .../mapper/wms/WmsInstockDetailMapper.xml | 22 ++ 8 files changed, 781 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockDetailBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockDetailVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockDetailMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockDetailMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java new file mode 100644 index 00000000..b06435f1 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockDetailController.java @@ -0,0 +1,107 @@ +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.WmsInstockDetailBo; +import org.dromara.wms.domain.vo.WmsInstockDetailVo; +import org.dromara.wms.service.IWmsInstockDetailService; +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/instockDetail + * + * @author LionLi + * @date 2025-01-06 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/instockDetail") +public class WmsInstockDetailController extends BaseController { + + private final IWmsInstockDetailService wmsInstockDetailService; + + /** + * 查询入库单-物料列表 + */ + @SaCheckPermission("system:instockDetail:list") + @GetMapping("/list") + public TableDataInfo list(WmsInstockDetailBo bo, PageQuery pageQuery) { + return wmsInstockDetailService.queryPageList(bo, pageQuery); + } + + /** + * 导出入库单-物料列表 + */ + @SaCheckPermission("system:instockDetail:export") + @Log(title = "入库单-物料", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsInstockDetailBo bo, HttpServletResponse response) { + List list = wmsInstockDetailService.queryList(bo); + ExcelUtil.exportExcel(list, "入库单-物料", WmsInstockDetailVo.class, response); + } + + /** + * 获取入库单-物料详细信息 + * + * @param instockDetailId 主键 + */ + @SaCheckPermission("system:instockDetail:query") + @GetMapping("/{instockDetailId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long instockDetailId) { + return R.ok(wmsInstockDetailService.queryById(instockDetailId)); + } + + /** + * 新增入库单-物料 + */ + @SaCheckPermission("system:instockDetail:add") + @Log(title = "入库单-物料", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@RequestBody WmsInstockDetailBo bo) { + return toAjax(wmsInstockDetailService.insertByBo(bo)); + } + + /** + * 修改入库单-物料 + */ + @SaCheckPermission("system:instockDetail:edit") + @Log(title = "入库单-物料", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@RequestBody WmsInstockDetailBo bo) { + return toAjax(wmsInstockDetailService.updateByBo(bo)); + } + + /** + * 删除入库单-物料 + * + * @param instockDetailIds 主键串 + */ + @SaCheckPermission("system:instockDetail:remove") + @Log(title = "入库单-物料", businessType = BusinessType.DELETE) + @DeleteMapping("/{instockDetailIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] instockDetailIds) { + return toAjax(wmsInstockDetailService.deleteWithValidByIds(List.of(instockDetailIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java new file mode 100644 index 00000000..cd36cd45 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockDetail.java @@ -0,0 +1,123 @@ +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_detail + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +//@EqualsAndHashCode(callSuper = true) +@TableName("wms_instock_detail") +public class WmsInstockDetail{ + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 入库单子表主键 + */ + private Long instockDetailId; + + /** + * 入库单 主键 + */ + private Long instockId; + + /** + * 入库单号 + */ + private String instockCode; + + /** + * 送货-物料表主键 + */ + private Long dnDId; + + /** + * 采购-物料表主键 + */ + private Long poDId; + + /** + * 物料id + */ + private Long materialId; + + /** + * 物料编码 + */ + private String materialCode; + + /** + * 物料名称 + */ + private String materialName; + + /** + * 入库数量 + */ + private Long instockQty; + + /** + * 物料规格 + */ + private String materialSpe; + + /** + * 计量单位名称 + */ + private String unitName; + + /** + * 是否有条码 + */ + private String codeYesNo; + + /** + * 物料大类 + */ + private String materialCategories; + /** + * 租户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 Integer printNum; + /** + * 已打印数量 + */ + private Integer printedNum; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockDetailBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockDetailBo.java new file mode 100644 index 00000000..916544cc --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockDetailBo.java @@ -0,0 +1,115 @@ +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.WmsInstockDetail; + +/** + * 入库单-物料业务对象 wms_instock_detail + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsInstockDetail.class, reverseConvertGenerate = false) +public class WmsInstockDetailBo extends BaseEntity { + + /** + * 入库单子表主键 + */ + @NotNull(message = "入库单子表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long instockDetailId; + + /** + * 入库单 主键 + */ + @NotNull(message = "入库单 主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long instockId; + + /** + * 入库单号 + */ + @NotBlank(message = "入库单号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String instockCode; + + /** + * 送货-物料表主键 + */ + @NotNull(message = "送货-物料表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long dnDId; + + /** + * 采购-物料表主键 + */ + @NotNull(message = "采购-物料表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long poDId; + + /** + * 物料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; + + /** + * 入库数量 + */ + @NotNull(message = "入库数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long instockQty; + + /** + * 物料规格 + */ + @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; + /** + * 租户id + */ + private String tenantId; + /** + * 打印数量 + */ + private Integer printNum; + /** + * 已打印数量 + */ + private Integer printedNum; + private Long barcodeNum; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockDetailVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockDetailVo.java new file mode 100644 index 00000000..3ce811ed --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockDetailVo.java @@ -0,0 +1,140 @@ +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.WmsInstockDetail; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 入库单-物料视图对象 wms_instock_detail + * + * @author LionLi + * @date 2025-01-06 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsInstockDetail.class) +public class WmsInstockDetailVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 入库单子表主键 + */ + @ExcelProperty(value = "入库单子表主键") + private Long instockDetailId; + + /** + * 入库单 主键 + */ + @ExcelProperty(value = "入库单 主键") + private Long instockId; + + /** + * 入库单号 + */ + @ExcelProperty(value = "入库单号") + private String instockCode; + + /** + * 送货-物料表主键 + */ + @ExcelProperty(value = "送货-物料表主键") + private Long dnDId; + + /** + * 采购-物料表主键 + */ + @ExcelProperty(value = "采购-物料表主键") + private Long poDId; + + /** + * 物料id + */ + @ExcelProperty(value = "物料id") + private Long materialId; + + /** + * 物料编码 + */ + @ExcelProperty(value = "物料编码") + private String materialCode; + + /** + * 物料名称 + */ + @ExcelProperty(value = "物料名称") + private String materialName; + + /** + * 入库数量 + */ + @ExcelProperty(value = "入库数量") + private Long instockQty; + + /** + * 物料规格 + */ + @ExcelProperty(value = "物料规格") + private String materialSpe; + + /** + * 计量单位名称 + */ + @ExcelProperty(value = "计量单位名称") + private String unitName; + + /** + * 是否有条码 + */ + @ExcelProperty(value = "是否有条码") + private String codeYesNo; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + 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; + /** + * 已打印数量 + */ + private Integer printedNum; + /** + * 租户id + */ + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockDetailMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockDetailMapper.java new file mode 100644 index 00000000..cf53e471 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockDetailMapper.java @@ -0,0 +1,16 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsInstockDetail; +import org.dromara.wms.domain.vo.WmsInstockDetailVo; + +/** + * 入库单-物料Mapper接口 + * + * @author LionLi + * @date 2025-01-06 + */ +public interface WmsInstockDetailMapper extends BaseMapperPlus { + + int updateDetail(WmsInstockDetail update); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java new file mode 100644 index 00000000..b1b1c041 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockDetailService.java @@ -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.WmsInstockDetailBo; +import org.dromara.wms.domain.vo.WmsInstockDetailVo; + +import java.util.Collection; +import java.util.List; + +/** + * 入库单-物料Service接口 + * + * @author LionLi + * @date 2025-01-06 + */ +public interface IWmsInstockDetailService { + + /** + * 查询入库单-物料 + * + * @param instockDetailId 主键 + * @return 入库单-物料 + */ + WmsInstockDetailVo queryById(Long instockDetailId); + + /** + * 分页查询入库单-物料列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 入库单-物料分页列表 + */ + TableDataInfo queryPageList(WmsInstockDetailBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的入库单-物料列表 + * + * @param bo 查询条件 + * @return 入库单-物料列表 + */ + List queryList(WmsInstockDetailBo bo); + + /** + * 新增入库单-物料 + * + * @param bo 入库单-物料 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsInstockDetailBo bo); + + /** + * 修改入库单-物料 + * + * @param bo 入库单-物料 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsInstockDetailBo 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/WmsInstockDetailServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java new file mode 100644 index 00000000..5813ed2d --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockDetailServiceImpl.java @@ -0,0 +1,190 @@ +package org.dromara.wms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +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.WmsInstockOrder; +import org.dromara.wms.domain.WmsInstockPrint; +import org.dromara.wms.domain.bo.WmsInstockDetailBo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; +import org.dromara.wms.domain.vo.WmsInstockDetailVo; +import org.dromara.wms.mapper.WmsInstockDetailMapper; +import org.dromara.wms.service.IBaseMaterialInfoService; +import org.dromara.wms.service.IWmsInstockDetailService; +import org.dromara.wms.service.IWmsInstockPrintService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 入库单-物料Service业务层处理 + * + * @author LionLi + * @date 2025-01-06 + */ +@RequiredArgsConstructor +@Service +public class WmsInstockDetailServiceImpl implements IWmsInstockDetailService { + + private final WmsInstockDetailMapper baseMapper; + @Autowired + private IBaseMaterialInfoService baseMaterialInfoService; + + @Autowired + private IWmsInstockPrintService wmsInstockPrintService; + /** + * 查询入库单-物料 + * + * @param instockDetailId 主键 + * @return 入库单-物料 + */ + @Override + public WmsInstockDetailVo queryById(Long instockDetailId){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsInstockDetail::getInstockDetailId,instockDetailId); + return baseMapper.selectVoOne(wrapper); + } + + /** + * 分页查询入库单-物料列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 入库单-物料分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsInstockDetailBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(WmsInstockDetail::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的入库单-物料列表 + * + * @param bo 查询条件 + * @return 入库单-物料列表 + */ + @Override + public List queryList(WmsInstockDetailBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsInstockDetailBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getInstockDetailId() != null, WmsInstockDetail::getInstockDetailId, bo.getInstockDetailId()); + lqw.eq(bo.getInstockId() != null, WmsInstockDetail::getInstockId, bo.getInstockId()); + lqw.eq(StringUtils.isNotBlank(bo.getInstockCode()), WmsInstockDetail::getInstockCode, bo.getInstockCode()); + lqw.eq(bo.getDnDId() != null, WmsInstockDetail::getDnDId, bo.getDnDId()); + lqw.eq(bo.getPoDId() != null, WmsInstockDetail::getPoDId, bo.getPoDId()); + lqw.eq(bo.getMaterialId() != null, WmsInstockDetail::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsInstockDetail::getMaterialCode, bo.getMaterialCode()); + lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsInstockDetail::getMaterialName, bo.getMaterialName()); + lqw.eq(bo.getInstockQty() != null, WmsInstockDetail::getInstockQty, bo.getInstockQty()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialSpe()), WmsInstockDetail::getMaterialSpe, bo.getMaterialSpe()); + lqw.like(StringUtils.isNotBlank(bo.getUnitName()), WmsInstockDetail::getUnitName, bo.getUnitName()); + lqw.eq(StringUtils.isNotBlank(bo.getCodeYesNo()), WmsInstockDetail::getCodeYesNo, bo.getCodeYesNo()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsInstockDetail::getMaterialCategories, bo.getMaterialCategories()); + return lqw; + } + + /** + * 新增入库单-物料 + * + * @param bo 入库单-物料 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsInstockDetailBo bo) { + WmsInstockDetail add = MapstructUtils.convert(bo, WmsInstockDetail.class); + BaseMaterialInfoVo baseMaterialInfoVo = baseMaterialInfoService.queryById(bo.getMaterialId()); + BeanUtils.copyProperties(baseMaterialInfoVo,add); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setInstockDetailId(add.getInstockDetailId()); + } + return flag; + } + + /** + * 修改入库单-物料 + * + * @param bo 入库单-物料 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsInstockDetailBo bo) { + if (bo.getPrintNum()==null){ + WmsInstockDetail update = MapstructUtils.convert(bo, WmsInstockDetail.class); + validEntityBeforeSave(update); + return baseMapper.updateDetail(update)>0; + } + //打印数量不能超过入库数量 + if (bo.getPrintNum()+bo.getPrintedNum()>bo.getInstockQty()){ + return false; + } + Integer printNum = (int)wmsInstockPrintService.queryPrintNum(bo) + 1; + String order = generateOrder(printNum); + WmsInstockPrint wmsInstockPrint = new WmsInstockPrint(); + BeanUtils.copyProperties(bo,wmsInstockPrint); + String instockCode = bo.getInstockCode(); + String materialCode = bo.getMaterialCode(); + String batchCode = instockCode+materialCode+order; + wmsInstockPrint.setBatchCode(batchCode); + wmsInstockPrint.setApportionQty(bo.getPrintNum().longValue()); + wmsInstockPrint.setMaterialQty(bo.getBarcodeNum()); + int rows = wmsInstockPrintService.insertWmsInstockPrint(wmsInstockPrint); + WmsInstockDetail wmsInstockDetail = new WmsInstockDetail(); + wmsInstockDetail.setPrintedNum(bo.getPrintedNum()+bo.getPrintNum()); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(WmsInstockDetail::getInstockDetailId,bo.getInstockDetailId()); + int update = baseMapper.update(wmsInstockDetail, updateWrapper); + return update>0; + } + public String generateOrder(Integer value){ + if (value.toString().length()<3){ + String fixedLengthString = String.format("%03d", value); + return fixedLengthString; + }else if (value.toString().length()==3){ + return value.toString(); + } + return value.toString(); + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsInstockDetail 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/WmsInstockDetailMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockDetailMapper.xml new file mode 100644 index 00000000..3f21d4cf --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockDetailMapper.xml @@ -0,0 +1,22 @@ + + + + + + update wms_instock_detail + + dn_d_id = #{dnDId}, + po_d_id = #{poDId}, + material_id = #{materialId}, + instock_qty = #{instockQty}, + code_yes_no = #{codeYesNo}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where instock_id = #{instockId} + + From dcf6c749dd04ed86ab5be0f790506123fd4e8dbe Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:43:56 +0800 Subject: [PATCH 3/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Finstock=5Fprint=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsInstockPrintController.java | 112 +++++++++++++ .../dromara/wms/domain/WmsInstockPrint.java | 112 +++++++++++++ .../wms/domain/bo/WmsInstockPrintBo.java | 101 ++++++++++++ .../wms/domain/vo/WmsInstockPrintVo.java | 110 +++++++++++++ .../wms/mapper/WmsInstockPrintMapper.java | 15 ++ .../wms/service/IWmsInstockPrintService.java | 73 +++++++++ .../impl/WmsInstockPrintServiceImpl.java | 154 ++++++++++++++++++ .../mapper/wms/WmsInstockPrintMapper.xml | 7 + 8 files changed, 684 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockPrintController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockPrint.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockPrintBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockPrintVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockPrintMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockPrintService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockPrintServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockPrintMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockPrintController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockPrintController.java new file mode 100644 index 00000000..24526c50 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInstockPrintController.java @@ -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 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 list = wmsInstockPrintService.queryList(bo); + ExcelUtil.exportExcel(list, "入库单-物料打印条码", WmsInstockPrintVo.class, response); + } + + /** + * 获取入库单-物料打印条码详细信息 + * + * @param instockPrintId 主键 + */ + @SaCheckPermission("system:instockPrint:query") + @GetMapping("/{instockPrintId}") + public R 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 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 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 remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] instockPrintIds) { + return toAjax(wmsInstockPrintService.deleteWithValidByIds(List.of(instockPrintIds), true)); + } + @PostMapping("/print") + public R print(@RequestBody WmsInstockPrintBo bo){ + List vos = bo.getVos(); + return null; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockPrint.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockPrint.java new file mode 100644 index 00000000..d5c5226b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInstockPrint.java @@ -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; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockPrintBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockPrintBo.java new file mode 100644 index 00000000..6e6ba124 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInstockPrintBo.java @@ -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 vos; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockPrintVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockPrintVo.java new file mode 100644 index 00000000..bfe1e261 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInstockPrintVo.java @@ -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; + + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockPrintMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockPrintMapper.java new file mode 100644 index 00000000..6eb5f1b7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInstockPrintMapper.java @@ -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 { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockPrintService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockPrintService.java new file mode 100644 index 00000000..f89160ee --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInstockPrintService.java @@ -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 queryPageList(WmsInstockPrintBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的入库单-物料打印条码列表 + * + * @param bo 查询条件 + * @return 入库单-物料打印条码列表 + */ + List 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 ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockPrintServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockPrintServiceImpl.java new file mode 100644 index 00000000..3c3bc18c --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInstockPrintServiceImpl.java @@ -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 queryPageList(WmsInstockPrintBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(WmsInstockPrint::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的入库单-物料打印条码列表 + * + * @param bo 查询条件 + * @return 入库单-物料打印条码列表 + */ + @Override + public List queryList(WmsInstockPrintBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + public long queryPrintNum(WmsInstockDetailBo bo){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsInstockPrint::getInstockCode,bo.getInstockCode()); + wrapper.eq(WmsInstockPrint::getMaterialCode,bo.getMaterialCode()); + return baseMapper.selectCount(wrapper); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsInstockPrintBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper 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 ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockPrintMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockPrintMapper.xml new file mode 100644 index 00000000..3e11fedc --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInstockPrintMapper.xml @@ -0,0 +1,7 @@ + + + + + From 2d647456d411fdb0ed2ba2e64582584f0d285d32 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:44:54 +0800 Subject: [PATCH 4/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Finventory=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsInventoryController.java | 116 ++++++++++++ .../org/dromara/wms/domain/WmsInventory.java | 98 ++++++++++ .../dromara/wms/domain/bo/WmsInventoryBo.java | 80 +++++++++ .../dromara/wms/domain/vo/WmsInventoryVo.java | 117 ++++++++++++ .../wms/mapper/WmsInventoryMapper.java | 20 +++ .../wms/service/IWmsInventoryService.java | 72 ++++++++ .../service/impl/WmsInventoryServiceImpl.java | 168 ++++++++++++++++++ .../mapper/wms/WmsInventoryMapper.xml | 16 ++ 8 files changed, 687 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInventoryController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInventoryBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInventoryVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInventoryMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInventoryService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInventoryMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInventoryController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInventoryController.java new file mode 100644 index 00000000..b4074cad --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsInventoryController.java @@ -0,0 +1,116 @@ +package org.dromara.wms.controller; + +import java.math.BigDecimal; +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.WmsInventory; +import org.dromara.wms.domain.bo.WmsInventoryBo; +import org.dromara.wms.domain.vo.WmsInventoryVo; +import org.dromara.wms.service.IWmsInventoryService; +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/inventory + * + * @author LionLi + * @date 2025-01-07 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/inventory") +public class WmsInventoryController extends BaseController { + + private final IWmsInventoryService wmsInventoryService; + + /** + * 查询物料库存列表 + */ + @SaCheckPermission("system:inventory:list") + @GetMapping("/list") + public TableDataInfo list(WmsInventoryBo bo, PageQuery pageQuery) { + return wmsInventoryService.queryPageList(bo, pageQuery); + } + + /** + * 导出物料库存列表 + */ + @SaCheckPermission("system:inventory:export") + @Log(title = "物料库存", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsInventoryBo bo, HttpServletResponse response) { + List list = wmsInventoryService.queryList(bo); + ExcelUtil.exportExcel(list, "物料库存", WmsInventoryVo.class, response); + } + + /** + * 获取物料库存详细信息 + * + * @param inventoryId 主键 + */ + @SaCheckPermission("system:inventory:query") + @GetMapping("/{inventoryId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long inventoryId) { + return R.ok(wmsInventoryService.queryById(inventoryId)); + } + + /** + * 新增物料库存 + */ + @SaCheckPermission("system:inventory:add") + @Log(title = "物料库存", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody WmsInventoryBo bo) { + return toAjax(wmsInventoryService.insertByBo(bo)); + } + + /** + * 修改物料库存 + */ + @SaCheckPermission("system:inventory:edit") + @Log(title = "物料库存", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsInventoryBo bo) { + return toAjax(wmsInventoryService.updateByBo(bo)); + } + + /** + * 删除物料库存 + * + * @param inventoryIds 主键串 + */ + @SaCheckPermission("system:inventory:remove") + @Log(title = "物料库存", businessType = BusinessType.DELETE) + @DeleteMapping("/{inventoryIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] inventoryIds) { + return toAjax(wmsInventoryService.deleteWithValidByIds(List.of(inventoryIds), true)); + } + /** + * 查询物料总数 + */ + @GetMapping("materailCount") + public R materailCount(WmsInventory materialId){ + BigDecimal bigDecimal = wmsInventoryService.materailCount(materialId); + return R.ok(wmsInventoryService.materailCount(materialId)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java new file mode 100644 index 00000000..0fc0d25e --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsInventory.java @@ -0,0 +1,98 @@ +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.math.BigDecimal; +import java.util.Date; + +/** + * 物料库存对象 wms_inventory + * + * @author LionLi + * @date 2025-01-07 + */ +@Data +@TableName("wms_inventory") +public class WmsInventory{ + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @TableId(type = IdType.AUTO) + private Long inventoryId; + + /** + * 批次码 + */ + private String batchCode; + + /** + * 物料id + */ + private Long materialId; + + /** + * 库位编码 + */ + private String locationCode; + + /** + * 物料大类 + */ + private Long materialCategories; + + /** + * 库存数量 + */ + private BigDecimal inventoryQty; + + /** + * 锁定状态(0未锁定,1锁定) + */ + private String lockState; + + /** + * 库存状态(0库存归0,1正常) + */ + private String inventoryStatus; + + /** + * 仓库ID + */ + private Long storeId; + /** + * 租户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 warehouseCode;//字段映射 + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInventoryBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInventoryBo.java new file mode 100644 index 00000000..4bb13e15 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsInventoryBo.java @@ -0,0 +1,80 @@ +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.WmsInventory; + +import java.math.BigDecimal; + +/** + * 物料库存业务对象 wms_inventory + * + * @author LionLi + * @date 2025-01-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsInventory.class, reverseConvertGenerate = false) +public class WmsInventoryBo extends BaseEntity { + + /** + * 表主键 + */ + @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long inventoryId; + + /** + * 批次码 + */ + @NotBlank(message = "批次码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String batchCode; + + /** + * 物料id + */ + @NotNull(message = "物料id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 库位编码 + */ + @NotBlank(message = "库位编码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String locationCode; + + /** + * 物料大类 + */ + @NotNull(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialCategories; + + /** + * 库存数量 + */ + @NotNull(message = "库存数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal inventoryQty; + + /** + * 锁定状态(0未锁定,1锁定) + */ + @NotBlank(message = "锁定状态(0未锁定,1锁定)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String lockState; + + /** + * 库存状态(0库存归0,1正常) + */ + @NotBlank(message = "库存状态(0库存归0,1正常)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String inventoryStatus; + + /** + * 仓库ID + */ + @NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long storeId; + private String tenantId; + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInventoryVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInventoryVo.java new file mode 100644 index 00000000..8abbeba0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsInventoryVo.java @@ -0,0 +1,117 @@ +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.WmsInventory; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + + + +/** + * 物料库存视图对象 wms_inventory + * + * @author LionLi + * @date 2025-01-07 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsInventory.class) +public class WmsInventoryVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long inventoryId; + + /** + * 批次码 + */ + @ExcelProperty(value = "批次码") + private String batchCode; + + /** + * 物料id + */ + @ExcelProperty(value = "物料id") + private Long materialId; + + /** + * 库位编码 + */ + @ExcelProperty(value = "库位编码") + private String locationCode; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private Long materialCategories; + + /** + * 库存数量 + */ + @ExcelProperty(value = "库存数量") + private BigDecimal inventoryQty; + + /** + * 锁定状态(0未锁定,1锁定) + */ + @ExcelProperty(value = "锁定状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "0=未锁定,1锁定") + private String lockState; + + /** + * 库存状态(0库存归0,1正常) + */ + @ExcelProperty(value = "库存状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "0=库存归0,1正常") + private String inventoryStatus; + + /** + * 仓库ID + */ + @ExcelProperty(value = "仓库ID") + private Long storeId; + /** + * 租户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 warehouseCode;//字段映射 + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInventoryMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInventoryMapper.java new file mode 100644 index 00000000..6dbeab73 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsInventoryMapper.java @@ -0,0 +1,20 @@ +package org.dromara.wms.mapper; + +import org.apache.ibatis.annotations.Param; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsInventory; +import org.dromara.wms.domain.vo.WmsInventoryVo; +import org.springframework.web.bind.annotation.PostMapping; + +import java.math.BigDecimal; + +/** + * 物料库存Mapper接口 + * + * @author LionLi + * @date 2025-01-07 + */ +public interface WmsInventoryMapper extends BaseMapperPlus { + + BigDecimal materailCount(@Param("entity") WmsInventory wmsInventory); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInventoryService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInventoryService.java new file mode 100644 index 00000000..62a4013a --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsInventoryService.java @@ -0,0 +1,72 @@ +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.WmsInventory; +import org.dromara.wms.domain.bo.WmsInventoryBo; +import org.dromara.wms.domain.vo.WmsInventoryVo; + +import java.math.BigDecimal; +import java.util.Collection; +import java.util.List; + +/** + * 物料库存Service接口 + * + * @author LionLi + * @date 2025-01-07 + */ +public interface IWmsInventoryService { + + /** + * 查询物料库存 + * + * @param inventoryId 主键 + * @return 物料库存 + */ + WmsInventoryVo queryById(Long inventoryId); + + /** + * 分页查询物料库存列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 物料库存分页列表 + */ + TableDataInfo queryPageList(WmsInventoryBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的物料库存列表 + * + * @param bo 查询条件 + * @return 物料库存列表 + */ + List queryList(WmsInventoryBo bo); + + /** + * 新增物料库存 + * + * @param bo 物料库存 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsInventoryBo bo); + + /** + * 修改物料库存 + * + * @param bo 物料库存 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsInventoryBo bo); + + /** + * 校验并批量删除物料库存信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + BigDecimal materailCount(WmsInventory materialId); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java new file mode 100644 index 00000000..67d8c7a0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java @@ -0,0 +1,168 @@ +package org.dromara.wms.service.impl; + +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +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.WmsBaseWarehouse; +import org.dromara.wms.domain.WmsConfiguration; +import org.dromara.wms.domain.WmsInventory; +import org.dromara.wms.domain.bo.WmsConfigurationBo; +import org.dromara.wms.domain.bo.WmsInventoryBo; +import org.dromara.wms.domain.vo.WmsInventoryVo; +import org.dromara.wms.mapper.WmsInventoryMapper; +import org.dromara.wms.service.IWmsInventoryService; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Collection; +import java.util.stream.Collectors; + +/** + * 物料库存Service业务层处理 + * + * @author LionLi + * @date 2025-01-07 + */ +@RequiredArgsConstructor +@Service +public class WmsInventoryServiceImpl implements IWmsInventoryService { + + private final WmsInventoryMapper baseMapper; + + /** + * 查询物料库存 + * + * @param inventoryId 主键 + * @return 物料库存 + */ + @Override + public WmsInventoryVo queryById(Long inventoryId){ + return baseMapper.selectVoById(inventoryId); + } + + /** + * 分页查询物料库存列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 物料库存分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsInventoryBo bo, PageQuery pageQuery) { +// LambdaQueryWrapper lqw = buildQueryWrapper(bo); + MPJLambdaWrapper lqw = buildJoinQueryWrapper(bo); + lqw.orderByDesc(WmsInventory::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的物料库存列表 + * + * @param bo 查询条件 + * @return 物料库存列表 + */ + @Override + public List queryList(WmsInventoryBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsInventoryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getInventoryId() != null, WmsInventory::getInventoryId, bo.getInventoryId()); + lqw.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsInventory::getBatchCode, bo.getBatchCode()); + lqw.eq(bo.getMaterialId() != null, WmsInventory::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventory::getLocationCode, bo.getLocationCode()); + lqw.eq(bo.getMaterialCategories() != null, WmsInventory::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(bo.getInventoryQty() != null, WmsInventory::getInventoryQty, bo.getInventoryQty()); + lqw.eq(StringUtils.isNotBlank(bo.getLockState()), WmsInventory::getLockState, bo.getLockState()); + lqw.eq(StringUtils.isNotBlank(bo.getInventoryStatus()), WmsInventory::getInventoryStatus, bo.getInventoryStatus()); + lqw.eq(bo.getStoreId() != null, WmsInventory::getStoreId, bo.getStoreId()); + return lqw; + } + private MPJLambdaWrapper buildJoinQueryWrapper(WmsInventoryBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsInventory.class) + .selectAll(WmsInventory.class) + .select(WmsBaseWarehouse::getWarehouseCode) + .leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsInventory::getStoreId); + lqw.eq(bo.getInventoryId() != null, WmsInventory::getInventoryId, bo.getInventoryId()); + lqw.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsInventory::getBatchCode, bo.getBatchCode()); + lqw.eq(bo.getMaterialId() != null, WmsInventory::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventory::getLocationCode, bo.getLocationCode()); + lqw.eq(bo.getMaterialCategories() != null, WmsInventory::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(bo.getInventoryQty() != null, WmsInventory::getInventoryQty, bo.getInventoryQty()); + lqw.eq(StringUtils.isNotBlank(bo.getLockState()), WmsInventory::getLockState, bo.getLockState()); + lqw.eq(StringUtils.isNotBlank(bo.getInventoryStatus()), WmsInventory::getInventoryStatus, bo.getInventoryStatus()); + lqw.eq(bo.getStoreId() != null, WmsInventory::getStoreId, bo.getStoreId()); + return lqw; + } + + /** + * 新增物料库存 + * + * @param bo 物料库存 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsInventoryBo bo) { + WmsInventory add = MapstructUtils.convert(bo, WmsInventory.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setInventoryId(add.getInventoryId()); + } + return flag; + } + + /** + * 修改物料库存 + * + * @param bo 物料库存 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsInventoryBo bo) { + WmsInventory update = MapstructUtils.convert(bo, WmsInventory.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsInventory entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public BigDecimal materailCount(WmsInventory wmsInventory) { + return baseMapper.materailCount(wmsInventory); + } + + /** + * 校验并批量删除物料库存信息 + * + * @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/WmsInventoryMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInventoryMapper.xml new file mode 100644 index 00000000..31f7b5f4 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsInventoryMapper.xml @@ -0,0 +1,16 @@ + + + + + + From 776767451819638e5aa83dd8bc3df34cf2c305d6 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:45:50 +0800 Subject: [PATCH 5/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Foutstock=5Forder=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WmsOutstockOrderController.java | 106 +++++++++++ .../dromara/wms/domain/WmsOutstockOrder.java | 108 +++++++++++ .../wms/domain/bo/WmsOutstockOrderBo.java | 93 ++++++++++ .../wms/domain/vo/WmsOutstockDetailVo.java | 97 ++++++++++ .../wms/domain/vo/WmsOutstockOrderVo.java | 128 +++++++++++++ .../wms/mapper/WmsOutstockOrderMapper.java | 15 ++ .../wms/service/IWmsOutstockOrderService.java | 68 +++++++ .../impl/WmsOutstockOrderServiceImpl.java | 171 ++++++++++++++++++ .../mapper/wms/WmsOutstockOrderMapper.xml | 7 + 9 files changed, 793 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockOrder.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockOrderBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockOrderVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockOrderMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockOrderMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java new file mode 100644 index 00000000..51950e4d --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockOrderController.java @@ -0,0 +1,106 @@ +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.WmsOutstockOrderBo; +import org.dromara.wms.domain.vo.WmsOutstockOrderVo; +import org.dromara.wms.service.IWmsOutstockOrderService; +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/outstockOrder + * + * @author LionLi + * @date 2025-01-08 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/outstockOrder") +public class WmsOutstockOrderController extends BaseController { + + private final IWmsOutstockOrderService wmsOutstockOrderService; + + /** + * 查询出库单列表 + */ + @SaCheckPermission("system:outstockOrder:list") + @GetMapping("/list") + public TableDataInfo list(WmsOutstockOrderBo bo, PageQuery pageQuery) { + return wmsOutstockOrderService.queryPageList(bo, pageQuery); + } + + /** + * 导出出库单列表 + */ + @SaCheckPermission("system:outstockOrder:export") + @Log(title = "出库单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsOutstockOrderBo bo, HttpServletResponse response) { + List list = wmsOutstockOrderService.queryList(bo); + ExcelUtil.exportExcel(list, "出库单", WmsOutstockOrderVo.class, response); + } + + /** + * 获取出库单详细信息 + * + * @param outstockId 主键 + */ + @SaCheckPermission("system:outstockOrder:query") + @GetMapping("/{outstockId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long outstockId) { + return R.ok(wmsOutstockOrderService.queryById(outstockId)); + } + + /** + * 新增出库单 + */ + @SaCheckPermission("system:outstockOrder:add") + @Log(title = "出库单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody WmsOutstockOrderBo bo) { + return toAjax(wmsOutstockOrderService.insertByBo(bo)); + } + + /** + * 修改出库单 + */ + @SaCheckPermission("system:outstockOrder:edit") + @Log(title = "出库单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsOutstockOrderBo bo) { + return toAjax(wmsOutstockOrderService.updateByBo(bo)); + } + + /** + * 删除出库单 + * + * @param outstockIds 主键串 + */ + @SaCheckPermission("system:outstockOrder:remove") + @Log(title = "出库单", businessType = BusinessType.DELETE) + @DeleteMapping("/{outstockIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] outstockIds) { + return toAjax(wmsOutstockOrderService.deleteWithValidByIds(List.of(outstockIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockOrder.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockOrder.java new file mode 100644 index 00000000..0ef6c898 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockOrder.java @@ -0,0 +1,108 @@ +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.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 出库单对象 wms_outstock_order + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@TableName("wms_outstock_order") +public class WmsOutstockOrder { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 出库单 主键 + */ + @TableId(type = IdType.AUTO) + private Long outstockId; + + /** + * 仓库ID + */ + private Long warehouseId; + + /** + * 出库单号 + */ + private String outstockCode; + + /** + * 出库类型 + */ + private String outstockType; + + /** + * 物料大类 + */ + private String materialCategories; + + /** + * 工单类型(字典:1销售订单,2生产订单,3手工,4系统生成) + */ + private String orderType; + + /** + * 订单编号 + */ + private String orderNo; + + /** + * 审核人 + */ + private String auditBy; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + private String auditStatus; + + /** + * 审核意见 + */ + private String auditComments; + /** + * 租户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 warehouseCode;//字段映射 + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockOrderBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockOrderBo.java new file mode 100644 index 00000000..25877eee --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockOrderBo.java @@ -0,0 +1,93 @@ +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 java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.WmsOutstockOrder; + +/** + * 出库单业务对象 wms_outstock_order + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsOutstockOrder.class, reverseConvertGenerate = false) +public class WmsOutstockOrderBo extends BaseEntity { + + /** + * 出库单 主键 + */ +// @NotNull(message = "出库单 主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long outstockId; + + /** + * 仓库ID + */ +// @NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long warehouseId; + + /** + * 出库单号 + */ +// @NotBlank(message = "出库单号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String outstockCode; + + /** + * 出库类型 + */ +// @NotBlank(message = "出库类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String outstockType; + + /** + * 物料大类 + */ +// @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCategories; + + /** + * 工单类型(字典:1销售订单,2生产订单,3手工,4系统生成) + */ +// @NotBlank(message = "工单类型(字典:1销售订单,2生产订单,3手工,4系统生成)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String orderType; + + /** + * 订单编号 + */ +// @NotBlank(message = "订单编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String orderNo; + + /** + * 审核人 + */ +// @NotBlank(message = "审核人不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditBy; + + /** + * 审核时间 + */ +// @NotNull(message = "审核时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ +// @NotBlank(message = "审核状态(0待审核,1审核通过,2审核未通过)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditStatus; + + /** + * 审核意见 + */ +// @NotBlank(message = "审核意见不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditComments; + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java new file mode 100644 index 00000000..40a7f721 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockDetailVo.java @@ -0,0 +1,97 @@ +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 com.ibm.icu.math.BigDecimal; +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.WmsOutstockDetail; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 出库单-物料视图对象 wms_outstock_detail + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsOutstockDetail.class) +public class WmsOutstockDetailVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long outstockDetailId; + + /** + * 出库单号 + */ + @ExcelProperty(value = "出库单号") + private String outstockCode; + + /** + * 出库单 主键 + */ + @ExcelProperty(value = "出库单 主键") + private Long outstockId; + + /** + * 物料id + */ + @ExcelProperty(value = "物料id") + private Long materialId; + + /** + * 出库数量 + */ + @ExcelProperty(value = "出库数量") + private BigDecimal outstockQty; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private String materialCategories; + /** + * 租户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; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockOrderVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockOrderVo.java new file mode 100644 index 00000000..1aebe3d7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsOutstockOrderVo.java @@ -0,0 +1,128 @@ +package org.dromara.wms.domain.vo; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +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.WmsOutstockOrder; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 出库单视图对象 wms_outstock_order + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsOutstockOrder.class) +public class WmsOutstockOrderVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 出库单 主键 + */ + @ExcelProperty(value = "出库单 主键") + private Long outstockId; + + /** + * 仓库ID + */ + @ExcelProperty(value = "仓库ID") + private Long warehouseId; + + /** + * 出库单号 + */ + @ExcelProperty(value = "出库单号") + private String outstockCode; + + /** + * 出库类型 + */ + @ExcelProperty(value = "出库类型") + private String outstockType; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private String materialCategories; + + /** + * 工单类型(字典:1销售订单,2生产订单,3手工,4系统生成) + */ + @ExcelProperty(value = "工单类型(字典:1销售订单,2生产订单,3手工,4系统生成)") + private String orderType; + + /** + * 订单编号 + */ + @ExcelProperty(value = "订单编号") + private String orderNo; + + /** + * 审核人 + */ + @ExcelProperty(value = "审核人") + private String auditBy; + + /** + * 审核时间 + */ + @ExcelProperty(value = "审核时间") + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + @ExcelProperty(value = "审核状态(0待审核,1审核通过,2审核未通过)") + private String auditStatus; + + /** + * 审核意见 + */ + @ExcelProperty(value = "审核意见") + private String auditComments; + /** + * 租户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 warehouseCode;//字段映射 + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockOrderMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockOrderMapper.java new file mode 100644 index 00000000..850aaf0e --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockOrderMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsOutstockOrder; +import org.dromara.wms.domain.vo.WmsOutstockOrderVo; + +/** + * 出库单Mapper接口 + * + * @author LionLi + * @date 2025-01-08 + */ +public interface WmsOutstockOrderMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java new file mode 100644 index 00000000..8900c56f --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockOrderService.java @@ -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.WmsOutstockOrderBo; +import org.dromara.wms.domain.vo.WmsOutstockOrderVo; + +import java.util.Collection; +import java.util.List; + +/** + * 出库单Service接口 + * + * @author LionLi + * @date 2025-01-08 + */ +public interface IWmsOutstockOrderService { + + /** + * 查询出库单 + * + * @param outstockId 主键 + * @return 出库单 + */ + WmsOutstockOrderVo queryById(Long outstockId); + + /** + * 分页查询出库单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 出库单分页列表 + */ + TableDataInfo queryPageList(WmsOutstockOrderBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的出库单列表 + * + * @param bo 查询条件 + * @return 出库单列表 + */ + List queryList(WmsOutstockOrderBo bo); + + /** + * 新增出库单 + * + * @param bo 出库单 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsOutstockOrderBo bo); + + /** + * 修改出库单 + * + * @param bo 出库单 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsOutstockOrderBo 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/WmsOutstockOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java new file mode 100644 index 00000000..f27af785 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockOrderServiceImpl.java @@ -0,0 +1,171 @@ +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.WmsOutstockOrder; +import org.dromara.wms.domain.bo.WmsOutstockOrderBo; +import org.dromara.wms.domain.vo.WmsOutstockOrderVo; +import org.dromara.wms.mapper.WmsInstockOrderMapper; +import org.dromara.wms.mapper.WmsOutstockOrderMapper; +import org.dromara.wms.service.IWmsOutstockOrderService; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Collection; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 出库单Service业务层处理 + * + * @author LionLi + * @date 2025-01-08 + */ +@RequiredArgsConstructor +@Service +public class WmsOutstockOrderServiceImpl implements IWmsOutstockOrderService { + + private final WmsOutstockOrderMapper baseMapper; + private static final AtomicInteger sequence = new AtomicInteger(999); + public static Integer nextSequence() { + return sequence.incrementAndGet(); + } + + /** + * 查询出库单 + * + * @param outstockId 主键 + * @return 出库单 + */ + @Override + public WmsOutstockOrderVo queryById(Long outstockId){ + return baseMapper.selectVoById(outstockId); + } + + /** + * 分页查询出库单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 出库单分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsOutstockOrderBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(WmsOutstockOrder::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的出库单列表 + * + * @param bo 查询条件 + * @return 出库单列表 + */ + @Override + public List queryList(WmsOutstockOrderBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsOutstockOrderBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getOutstockId() != null, WmsOutstockOrder::getOutstockId, bo.getOutstockId()); + lqw.eq(bo.getWarehouseId() != null, WmsOutstockOrder::getWarehouseId, bo.getWarehouseId()); + lqw.eq(StringUtils.isNotBlank(bo.getOutstockCode()), WmsOutstockOrder::getOutstockCode, bo.getOutstockCode()); + lqw.eq(StringUtils.isNotBlank(bo.getOutstockType()), WmsOutstockOrder::getOutstockType, bo.getOutstockType()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsOutstockOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderType()), WmsOutstockOrder::getOrderType, bo.getOrderType()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), WmsOutstockOrder::getOrderNo, bo.getOrderNo()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsOutstockOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsOutstockOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsOutstockOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsOutstockOrder::getAuditComments, bo.getAuditComments()); + return lqw; + } + + /** + * 新增出库单 + * + * @param bo 出库单 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsOutstockOrderBo bo) { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm"); + String orderDate = format.format(date); + String order = "OU"; + String orderLast=""; + Integer value = nextSequence(); + if (value.toString().length()==4){ + sequence.set(1); + orderLast = generateOrder(sequence.get()); + }else { + orderLast = generateOrder(value); + } + String outStockOrder = order + orderDate + orderLast; + WmsOutstockOrder add = MapstructUtils.convert(bo, WmsOutstockOrder.class); + validEntityBeforeSave(add); + add.setOutstockCode(outStockOrder); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setOutstockId(add.getOutstockId()); + } + return flag; + } + public String generateOrder(Integer value){ + if (value.toString().length()<3){ + String fixedLengthString = String.format("%03d", value); + return fixedLengthString; + }else if (value.toString().length()==3){ + return value.toString(); + } + return value.toString(); + } + + /** + * 修改出库单 + * + * @param bo 出库单 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsOutstockOrderBo bo) { + WmsOutstockOrder update = MapstructUtils.convert(bo, WmsOutstockOrder.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsOutstockOrder 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/WmsOutstockOrderMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockOrderMapper.xml new file mode 100644 index 00000000..07e74953 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockOrderMapper.xml @@ -0,0 +1,7 @@ + + + + + From edc2bac896b14d04605dea5db8e662d4a11531ef Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:46:40 +0800 Subject: [PATCH 6/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Foutstock=5Fdetail=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WmsOutstockDetailController.java | 107 ++++++++++++ .../dromara/wms/domain/WmsOutstockDetail.java | 86 ++++++++++ .../wms/domain/bo/WmsOutstockDetailBo.java | 62 +++++++ .../wms/mapper/WmsOutstockDetailMapper.java | 15 ++ .../service/IWmsOutstockDetailService.java | 68 ++++++++ .../impl/WmsOutstockDetailServiceImpl.java | 154 ++++++++++++++++++ .../mapper/wms/WmsOutstockDetailMapper.xml | 7 + 7 files changed, 499 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockDetailMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockDetailMapper.xml diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java new file mode 100644 index 00000000..c3b4bd5b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsOutstockDetailController.java @@ -0,0 +1,107 @@ +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.WmsOutstockDetailBo; +import org.dromara.wms.domain.vo.WmsOutstockDetailVo; +import org.dromara.wms.service.IWmsOutstockDetailService; +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/outstockDetail + * + * @author LionLi + * @date 2025-01-08 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/outstockDetail") +public class WmsOutstockDetailController extends BaseController { + + private final IWmsOutstockDetailService wmsOutstockDetailService; + + /** + * 查询出库单-物料列表 + */ + @SaCheckPermission("system:outstockDetail:list") + @GetMapping("/list") + public TableDataInfo list(WmsOutstockDetailBo bo, PageQuery pageQuery) { + return wmsOutstockDetailService.queryPageList(bo, pageQuery); + } + + /** + * 导出出库单-物料列表 + */ + @SaCheckPermission("system:outstockDetail:export") + @Log(title = "出库单-物料", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsOutstockDetailBo bo, HttpServletResponse response) { + List list = wmsOutstockDetailService.queryList(bo); + ExcelUtil.exportExcel(list, "出库单-物料", WmsOutstockDetailVo.class, response); + } + + /** + * 获取出库单-物料详细信息 + * + * @param outstockDetailId 主键 + */ + @SaCheckPermission("system:outstockDetail:query") + @GetMapping("/{outstockDetailId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long outstockDetailId) { + return R.ok(wmsOutstockDetailService.queryById(outstockDetailId)); + } + + /** + * 新增出库单-物料 + */ + @SaCheckPermission("system:outstockDetail:add") + @Log(title = "出库单-物料", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@RequestBody WmsOutstockDetailBo bo) { + return toAjax(wmsOutstockDetailService.insertByBo(bo)); + } + + /** + * 修改出库单-物料 + */ + @SaCheckPermission("system:outstockDetail:edit") + @Log(title = "出库单-物料", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsOutstockDetailBo bo) { + return toAjax(wmsOutstockDetailService.updateByBo(bo)); + } + + /** + * 删除出库单-物料 + * + * @param outstockDetailIds 主键串 + */ + @SaCheckPermission("system:outstockDetail:remove") + @Log(title = "出库单-物料", businessType = BusinessType.DELETE) + @DeleteMapping("/{outstockDetailIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] outstockDetailIds) { + return toAjax(wmsOutstockDetailService.deleteWithValidByIds(List.of(outstockDetailIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java new file mode 100644 index 00000000..bbb1c762 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsOutstockDetail.java @@ -0,0 +1,86 @@ +package org.dromara.wms.domain; + +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.ibm.icu.math.BigDecimal; +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_outstock_detail + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@TableName("wms_outstock_detail") +public class WmsOutstockDetail { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @TableId(type = IdType.AUTO) + private Long outstockDetailId; + + /** + * 出库单号 + */ + private String outstockCode; + + /** + * 出库单 主键 + */ + private Long outstockId; + + /** + * 物料id + */ + private Long materialId; + + /** + * 出库数量 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private BigDecimal outstockQty; + + /** + * 物料大类 + */ + private String materialCategories; + /** + * 租户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 materialCode; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java new file mode 100644 index 00000000..19e97c0b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsOutstockDetailBo.java @@ -0,0 +1,62 @@ +package org.dromara.wms.domain.bo; + +import com.ibm.icu.math.BigDecimal; +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.WmsOutstockDetail; + +/** + * 出库单-物料业务对象 wms_outstock_detail + * + * @author LionLi + * @date 2025-01-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = WmsOutstockDetail.class, reverseConvertGenerate = false) +public class WmsOutstockDetailBo extends BaseEntity { + + /** + * 表主键 + */ +// @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long outstockDetailId; + + /** + * 出库单号 + */ +// @NotBlank(message = "出库单号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String outstockCode; + + /** + * 出库单 主键 + */ +// @NotNull(message = "出库单 主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long outstockId; + + /** + * 物料id + */ +// @NotNull(message = "物料id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 出库数量 + */ +// @NotNull(message = "出库数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal outstockQty; + + /** + * 物料大类 + */ +// @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCategories; + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockDetailMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockDetailMapper.java new file mode 100644 index 00000000..6c5c8136 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsOutstockDetailMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsOutstockDetail; +import org.dromara.wms.domain.vo.WmsOutstockDetailVo; + +/** + * 出库单-物料Mapper接口 + * + * @author LionLi + * @date 2025-01-08 + */ +public interface WmsOutstockDetailMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java new file mode 100644 index 00000000..645d3a2f --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsOutstockDetailService.java @@ -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.WmsOutstockDetailBo; +import org.dromara.wms.domain.vo.WmsOutstockDetailVo; + +import java.util.Collection; +import java.util.List; + +/** + * 出库单-物料Service接口 + * + * @author LionLi + * @date 2025-01-08 + */ +public interface IWmsOutstockDetailService { + + /** + * 查询出库单-物料 + * + * @param outstockDetailId 主键 + * @return 出库单-物料 + */ + WmsOutstockDetailVo queryById(Long outstockDetailId); + + /** + * 分页查询出库单-物料列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 出库单-物料分页列表 + */ + TableDataInfo queryPageList(WmsOutstockDetailBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的出库单-物料列表 + * + * @param bo 查询条件 + * @return 出库单-物料列表 + */ + List queryList(WmsOutstockDetailBo bo); + + /** + * 新增出库单-物料 + * + * @param bo 出库单-物料 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsOutstockDetailBo bo); + + /** + * 修改出库单-物料 + * + * @param bo 出库单-物料 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsOutstockDetailBo 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/WmsOutstockDetailServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java new file mode 100644 index 00000000..8e26d9d0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsOutstockDetailServiceImpl.java @@ -0,0 +1,154 @@ +package org.dromara.wms.service.impl; + +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +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.BaseMaterialInfo; +import org.dromara.wms.domain.WmsInventory; +import org.dromara.wms.domain.WmsOutstockDetail; +import org.dromara.wms.domain.bo.WmsOutstockDetailBo; +import org.dromara.wms.domain.vo.WmsOutstockDetailVo; +import org.dromara.wms.mapper.WmsOutstockDetailMapper; +import org.dromara.wms.service.IWmsOutstockDetailService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 出库单-物料Service业务层处理 + * + * @author LionLi + * @date 2025-01-08 + */ +@RequiredArgsConstructor +@Service +public class WmsOutstockDetailServiceImpl implements IWmsOutstockDetailService { + + private final WmsOutstockDetailMapper baseMapper; + + /** + * 查询出库单-物料 + * + * @param outstockDetailId 主键 + * @return 出库单-物料 + */ + @Override + public WmsOutstockDetailVo queryById(Long outstockDetailId){ + return baseMapper.selectVoById(outstockDetailId); + } + + /** + * 分页查询出库单-物料列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 出库单-物料分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsOutstockDetailBo bo, PageQuery pageQuery) { +// LambdaQueryWrapper lqw = buildQueryWrapper(bo); + MPJLambdaWrapper mpjLambdaWrapper = buildJoinQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), mpjLambdaWrapper); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的出库单-物料列表 + * + * @param bo 查询条件 + * @return 出库单-物料列表 + */ + @Override + public List queryList(WmsOutstockDetailBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsOutstockDetailBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getOutstockDetailId() != null, WmsOutstockDetail::getOutstockDetailId, bo.getOutstockDetailId()); + lqw.eq(StringUtils.isNotBlank(bo.getOutstockCode()), WmsOutstockDetail::getOutstockCode, bo.getOutstockCode()); + lqw.eq(bo.getOutstockId() != null, WmsOutstockDetail::getOutstockId, bo.getOutstockId()); + lqw.eq(bo.getMaterialId() != null, WmsOutstockDetail::getMaterialId, bo.getMaterialId()); + lqw.eq(bo.getOutstockQty() != null, WmsOutstockDetail::getOutstockQty, bo.getOutstockQty()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsOutstockDetail::getMaterialCategories, bo.getMaterialCategories()); + return lqw; + } + private MPJLambdaWrapper buildJoinQueryWrapper(WmsOutstockDetailBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsOutstockDetail.class) + .selectAll(WmsOutstockDetail.class) + .select(BaseMaterialInfo::getMaterialCode) + .leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, WmsOutstockDetail::getMaterialId) + .eq(bo.getOutstockDetailId() != null, WmsOutstockDetail::getOutstockDetailId, bo.getOutstockDetailId()) + .eq(StringUtils.isNotBlank(bo.getOutstockCode()), WmsOutstockDetail::getOutstockCode, bo.getOutstockCode()) + .eq(bo.getOutstockId() != null, WmsOutstockDetail::getOutstockId, bo.getOutstockId()) + .eq(bo.getMaterialId() != null, WmsOutstockDetail::getMaterialId, bo.getMaterialId()) + .eq(bo.getOutstockQty() != null, WmsOutstockDetail::getOutstockQty, bo.getOutstockQty()) + .eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsOutstockDetail::getMaterialCategories, bo.getMaterialCategories()) + .orderByAsc(WmsOutstockDetail::getCreateTime); + return lqw; + } + + /** + * 新增出库单-物料 + * + * @param bo 出库单-物料 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsOutstockDetailBo bo) { + WmsOutstockDetail add = MapstructUtils.convert(bo, WmsOutstockDetail.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setOutstockDetailId(add.getOutstockDetailId()); + } + return flag; + } + + /** + * 修改出库单-物料 + * + * @param bo 出库单-物料 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsOutstockDetailBo bo) { + WmsOutstockDetail update = MapstructUtils.convert(bo, WmsOutstockDetail.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsOutstockDetail 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/WmsOutstockDetailMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockDetailMapper.xml new file mode 100644 index 00000000..2103ff71 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsOutstockDetailMapper.xml @@ -0,0 +1,7 @@ + + + + + From a70483c4e0b61454b476ffc25d0a8ddfcd080fb9 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:47:21 +0800 Subject: [PATCH 7/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Freturn=5Forder=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsReturnOrderController.java | 106 ++++++++++++ .../dromara/wms/domain/WmsReturnOrder.java | 131 +++++++++++++++ .../wms/domain/bo/WmsReturnOrderBo.java | 122 ++++++++++++++ .../wms/domain/vo/WmsReturnOrderVo.java | 157 ++++++++++++++++++ .../wms/mapper/WmsReturnOrderMapper.java | 15 ++ .../wms/service/IWmsReturnOrderService.java | 69 ++++++++ .../impl/WmsReturnOrderServiceImpl.java | 145 ++++++++++++++++ 7 files changed, 745 insertions(+) create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java create mode 100644 ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java new file mode 100644 index 00000000..79db5ef0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/WmsReturnOrderController.java @@ -0,0 +1,106 @@ +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.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; +import org.dromara.wms.service.IWmsReturnOrderService; +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/returnOrder + * + * @author LionLi + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/returnOrder") +public class WmsReturnOrderController extends BaseController { + + private final IWmsReturnOrderService wmsReturnOrderService; + + /** + * 查询退库工单列表 + */ + @SaCheckPermission("system:returnOrder:list") + @GetMapping("/list") + public TableDataInfo list(WmsReturnOrderBo bo, PageQuery pageQuery) { + return wmsReturnOrderService.queryPageList(bo, pageQuery); + } + + /** + * 导出退库工单列表 + */ + @SaCheckPermission("system:returnOrder:export") + @Log(title = "退库工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(WmsReturnOrderBo bo, HttpServletResponse response) { + List list = wmsReturnOrderService.queryList(bo); + ExcelUtil.exportExcel(list, "退库工单", WmsReturnOrderVo.class, response); + } + + /** + * 获取退库工单详细信息 + * + * @param roId 主键 + */ + @SaCheckPermission("system:returnOrder:query") + @GetMapping("/{roId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long roId) { + return R.ok(wmsReturnOrderService.queryById(roId)); + } + + /** + * 新增退库工单 + */ + @SaCheckPermission("system:returnOrder:add") + @Log(title = "退库工单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody WmsReturnOrderBo bo) { + return toAjax(wmsReturnOrderService.insertByBo(bo)); + } + + /** + * 修改退库工单 + */ + @SaCheckPermission("system:returnOrder:edit") + @Log(title = "退库工单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody WmsReturnOrderBo bo) { + return toAjax(wmsReturnOrderService.updateByBo(bo)); + } + + /** + * 删除退库工单 + * + * @param roIds 主键串 + */ + @SaCheckPermission("system:returnOrder:remove") + @Log(title = "退库工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{roIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] roIds) { + return toAjax(wmsReturnOrderService.deleteWithValidByIds(List.of(roIds), true)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java new file mode 100644 index 00000000..7c24b1e7 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsReturnOrder.java @@ -0,0 +1,131 @@ +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.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 退库工单对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@TableName("wms_return_order") +public class WmsReturnOrder { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + private Long roId; + + /** + * 物料ID + */ + private Long materialId; + + /** + * 物料大类 + */ + private String materialCategories; + + /** + * 批次条码 + */ + private String batchCode; + + /** + * 计划数量 + */ + private Long planAmount; + + /** + * 仓库ID + */ + private Long warehouseId; + + /** + * 计划退库库位 + */ + private String planLocationCode; + + /** + * 退库工单状态 + */ + private String orderStatus; + + /** + * 实际数量 + */ + private Long returnAmount; + + /** + * 实际退库库位 + */ + private String returnLocationCode; + + /** + * 审核人 + */ + private String auditBy; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + private String auditStatus; + + /** + * 审核意见 + */ + private String auditComments; + + /** + * erp同步状态 + */ + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ + private Long erpSynchronousQty; + /** + * 租户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 warehouseCode;//字段映射 + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java new file mode 100644 index 00000000..3bb0946b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsReturnOrderBo.java @@ -0,0 +1,122 @@ +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 java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.WmsReturnOrder; + +/** + * 退库工单业务对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@AutoMapper(target = WmsReturnOrder.class, reverseConvertGenerate = false) +public class WmsReturnOrderBo extends BaseEntity{ + + /** + * 表主键 + */ +// @NotNull(message = "表主键不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long roId; + + /** + * 物料ID + */ +// @NotNull(message = "物料ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 物料大类 + */ +// @NotBlank(message = "物料大类不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCategories; + + /** + * 批次条码 + */ +// @NotBlank(message = "批次条码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String batchCode; + + /** + * 计划数量 + */ +// @NotNull(message = "计划数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long planAmount; + + /** + * 仓库ID + */ +// @NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long warehouseId; + + /** + * 计划退库库位 + */ +// @NotBlank(message = "计划退库库位不能为空", groups = { AddGroup.class, EditGroup.class }) + private String planLocationCode; + + /** + * 退库工单状态 + */ +// @NotBlank(message = "退库工单状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String orderStatus; + + /** + * 实际数量 + */ +// @NotNull(message = "实际数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long returnAmount; + + /** + * 实际退库库位 + */ +// @NotBlank(message = "实际退库库位不能为空", groups = { AddGroup.class, EditGroup.class }) + private String returnLocationCode; + + /** + * 审核人 + */ +// @NotBlank(message = "审核人不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditBy; + + /** + * 审核时间 + */ +// @NotNull(message = "审核时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ +// @NotBlank(message = "审核状态(0待审核,1审核通过,2审核未通过)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditStatus; + + /** + * 审核意见 + */ +// @NotBlank(message = "审核意见不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditComments; + + /** + * erp同步状态 + */ +// @NotBlank(message = "erp同步状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ +// @NotNull(message = "erp同步数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long erpSynchronousQty; + private String tenantId; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java new file mode 100644 index 00000000..eed0f0dc --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsReturnOrderVo.java @@ -0,0 +1,157 @@ +package org.dromara.wms.domain.vo; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +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.WmsReturnOrder; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 退库工单视图对象 wms_return_order + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = WmsReturnOrder.class) +public class WmsReturnOrderVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 表主键 + */ + @ExcelProperty(value = "表主键") + private Long roId; + + /** + * 物料ID + */ + @ExcelProperty(value = "物料ID") + private Long materialId; + + /** + * 物料大类 + */ + @ExcelProperty(value = "物料大类") + private String materialCategories; + + /** + * 批次条码 + */ + @ExcelProperty(value = "批次条码") + private String batchCode; + + /** + * 计划数量 + */ + @ExcelProperty(value = "计划数量") + private Long planAmount; + + /** + * 仓库ID + */ + @ExcelProperty(value = "仓库ID") + private Long warehouseId; + + /** + * 计划退库库位 + */ + @ExcelProperty(value = "计划退库库位") + private String planLocationCode; + + /** + * 退库工单状态 + */ + @ExcelProperty(value = "退库工单状态") + private String orderStatus; + + /** + * 实际数量 + */ + @ExcelProperty(value = "实际数量") + private Long returnAmount; + + /** + * 实际退库库位 + */ + @ExcelProperty(value = "实际退库库位") + private String returnLocationCode; + + /** + * 审核人 + */ + @ExcelProperty(value = "审核人") + private String auditBy; + + /** + * 审核时间 + */ + @ExcelProperty(value = "审核时间") + private Date auditTime; + + /** + * 审核状态(0待审核,1审核通过,2审核未通过) + */ + @ExcelProperty(value = "审核状态(0待审核,1审核通过,2审核未通过)") + private String auditStatus; + + /** + * 审核意见 + */ + @ExcelProperty(value = "审核意见") + private String auditComments; + + /** + * erp同步状态 + */ + @ExcelProperty(value = "erp同步状态") + private String erpSynchronousStatus; + + /** + * erp同步数量 + */ + @ExcelProperty(value = "erp同步数量") + private Long erpSynchronousQty; + + /** + * 租户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 warehouseCode;//字段映射 +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java new file mode 100644 index 00000000..8600fc7a --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsReturnOrderMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.WmsReturnOrder; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; + +/** + * 退库工单Mapper接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface WmsReturnOrderMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java new file mode 100644 index 00000000..60f63544 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IWmsReturnOrderService.java @@ -0,0 +1,69 @@ +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.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; + +import java.util.Collection; +import java.util.List; + +/** + * 退库工单Service接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface IWmsReturnOrderService { + + /** + * 查询退库工单 + * + * @param roId 主键 + * @return 退库工单 + */ + WmsReturnOrderVo queryById(Long roId); + + /** + * 分页查询退库工单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 退库工单分页列表 + */ + TableDataInfo queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的退库工单列表 + * + * @param bo 查询条件 + * @return 退库工单列表 + */ + List queryList(WmsReturnOrderBo bo); + + /** + * 新增退库工单 + * + * @param bo 退库工单 + * @return 是否新增成功 + */ + Boolean insertByBo(WmsReturnOrderBo bo); + + /** + * 修改退库工单 + * + * @param bo 退库工单 + * @return 是否修改成功 + */ + Boolean updateByBo(WmsReturnOrderBo 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/WmsReturnOrderServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java new file mode 100644 index 00000000..0a76dd18 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsReturnOrderServiceImpl.java @@ -0,0 +1,145 @@ +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.WmsReturnOrder; +import org.dromara.wms.domain.bo.WmsReturnOrderBo; +import org.dromara.wms.domain.vo.WmsReturnOrderVo; +import org.dromara.wms.mapper.WmsReturnOrderMapper; +import org.dromara.wms.service.IWmsReturnOrderService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 退库工单Service业务层处理 + * + * @author LionLi + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class WmsReturnOrderServiceImpl implements IWmsReturnOrderService { + + private final WmsReturnOrderMapper baseMapper; + + /** + * 查询退库工单 + * + * @param roId 主键 + * @return 退库工单 + */ + @Override + public WmsReturnOrderVo queryById(Long roId){ + return baseMapper.selectVoById(roId); + } + + /** + * 分页查询退库工单列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 退库工单分页列表 + */ + @Override + public TableDataInfo queryPageList(WmsReturnOrderBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(WmsReturnOrder::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的退库工单列表 + * + * @param bo 查询条件 + * @return 退库工单列表 + */ + @Override + public List queryList(WmsReturnOrderBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(WmsReturnOrderBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getRoId() != null, WmsReturnOrder::getRoId, bo.getRoId()); + lqw.eq(bo.getMaterialId() != null, WmsReturnOrder::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsReturnOrder::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsReturnOrder::getBatchCode, bo.getBatchCode()); + lqw.eq(bo.getPlanAmount() != null, WmsReturnOrder::getPlanAmount, bo.getPlanAmount()); + lqw.eq(bo.getWarehouseId() != null, WmsReturnOrder::getWarehouseId, bo.getWarehouseId()); + lqw.eq(StringUtils.isNotBlank(bo.getPlanLocationCode()), WmsReturnOrder::getPlanLocationCode, bo.getPlanLocationCode()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderStatus()), WmsReturnOrder::getOrderStatus, bo.getOrderStatus()); + lqw.eq(bo.getReturnAmount() != null, WmsReturnOrder::getReturnAmount, bo.getReturnAmount()); + lqw.eq(StringUtils.isNotBlank(bo.getReturnLocationCode()), WmsReturnOrder::getReturnLocationCode, bo.getReturnLocationCode()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsReturnOrder::getAuditBy, bo.getAuditBy()); + lqw.eq(bo.getAuditTime() != null, WmsReturnOrder::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsReturnOrder::getAuditStatus, bo.getAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsReturnOrder::getAuditComments, bo.getAuditComments()); + lqw.eq(StringUtils.isNotBlank(bo.getErpSynchronousStatus()), WmsReturnOrder::getErpSynchronousStatus, bo.getErpSynchronousStatus()); + lqw.eq(bo.getErpSynchronousQty() != null, WmsReturnOrder::getErpSynchronousQty, bo.getErpSynchronousQty()); + return lqw; + } + + /** + * 新增退库工单 + * + * @param bo 退库工单 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(WmsReturnOrderBo bo) { + WmsReturnOrder add = MapstructUtils.convert(bo, WmsReturnOrder.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setRoId(add.getRoId()); + } + return flag; + } + + /** + * 修改退库工单 + * + * @param bo 退库工单 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(WmsReturnOrderBo bo) { + WmsReturnOrder update = MapstructUtils.convert(bo, WmsReturnOrder.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(WmsReturnOrder entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除退库工单信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} From 70365db591add50df7c5cc1df03cbae936691d81 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:49:26 +0800 Subject: [PATCH 8/8] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms?= =?UTF-8?q?=5Fconfiguration=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dromara/wms/domain/WmsConfiguration.java | 5 ++- .../wms/domain/bo/WmsConfigurationBo.java | 3 +- .../wms/domain/vo/WmsConfigurationVo.java | 6 ++- .../wms/mapper/WmsConfigurationMapper.java | 3 ++ .../impl/WmsConfigurationServiceImpl.java | 42 +++++++++++++++++-- .../mapper/wms/WmsConfigurationMapper.xml | 17 ++++++++ 6 files changed, 69 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsConfiguration.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsConfiguration.java index e7bff38c..e7cfa554 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsConfiguration.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/WmsConfiguration.java @@ -64,7 +64,7 @@ public class WmsConfiguration { /** * 租户id */ - private int tenantId; + private String tenantId; @TableField(fill = FieldFill.INSERT) private String createBy; @@ -86,5 +86,8 @@ public class WmsConfiguration { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; + @TableField(exist = false) + private String warehouseCode;//字段映射 + } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsConfigurationBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsConfigurationBo.java index b5b6e4de..8acefc63 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsConfigurationBo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/WmsConfigurationBo.java @@ -71,7 +71,8 @@ public class WmsConfigurationBo extends BaseEntity { /** * 租户id */ - private int tenantId; + private String tenantId; + } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsConfigurationVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsConfigurationVo.java index fb194fe9..96d2e5e7 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsConfigurationVo.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/WmsConfigurationVo.java @@ -99,6 +99,10 @@ public class WmsConfigurationVo implements Serializable { @ExcelProperty(value = "审批范围", converter = ExcelDictConvert.class) @ExcelDictFormat(readConverterExp = "0=所有仓库,1仓库") private String approveRange; - + /** + * 租户id + */ + private String tenantId; + private String warehouseCode; } diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsConfigurationMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsConfigurationMapper.java index 2c21a91b..41cd7389 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsConfigurationMapper.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/WmsConfigurationMapper.java @@ -1,5 +1,6 @@ package org.dromara.wms.mapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; @@ -18,4 +19,6 @@ public interface WmsConfigurationMapper extends BaseMapperPlus wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(WmsConfiguration::getConfigurationId,configurationId); + WmsConfigurationVo wmsConfigurationVo = baseMapper.selectVoOne(wrapper); + return wmsConfigurationVo; } /** @@ -53,7 +65,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService { */ @Override public TableDataInfo queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) { - LambdaQueryWrapper lqw = buildQueryWrapper(bo); +// LambdaQueryWrapper lqw = buildQueryWrapper(bo); + MPJLambdaWrapper lqw = buildJoinQueryWrapper(bo); lqw.orderByDesc(WmsConfiguration::getCreateTime); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); return TableDataInfo.build(result); @@ -70,6 +83,22 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService { LambdaQueryWrapper lqw = buildQueryWrapper(bo); return baseMapper.selectVoList(lqw); } + private MPJLambdaWrapper buildJoinQueryWrapper(WmsConfigurationBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(WmsConfiguration.class) + .selectAll(WmsConfiguration.class) + .select(WmsBaseWarehouse::getWarehouseCode) + .leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsConfiguration::getWarehouseId); + lqw.eq(bo.getConfigurationId() != null, WmsConfiguration::getConfigurationId, bo.getConfigurationId()); + lqw.eq(StringUtils.isNotBlank(bo.getNodeCode()), WmsConfiguration::getNodeCode, bo.getNodeCode()); + lqw.like(StringUtils.isNotBlank(bo.getNodeName()), WmsConfiguration::getNodeName, bo.getNodeName()); + lqw.eq(StringUtils.isNotBlank(bo.getApproveYesNo()), WmsConfiguration::getApproveYesNo, bo.getApproveYesNo()); + lqw.eq(StringUtils.isNotBlank(bo.getApproveType()), WmsConfiguration::getApproveType, bo.getApproveType()); + lqw.eq(StringUtils.isNotBlank(bo.getApproveRoleCode()), WmsConfiguration::getApproveRoleCode, bo.getApproveRoleCode()); + lqw.eq(bo.getWarehouseId() != null, WmsConfiguration::getWarehouseId, bo.getWarehouseId()); + lqw.eq(StringUtils.isNotBlank(bo.getApproveRange()), WmsConfiguration::getApproveRange, bo.getApproveRange()); + return lqw; + } private LambdaQueryWrapper buildQueryWrapper(WmsConfigurationBo bo) { Map params = bo.getParams(); @@ -94,6 +123,9 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService { @Override public Boolean insertByBo(WmsConfigurationBo bo) { WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class); +// LoginUser currentUser = DataPermissionHelper.getVariable("user"); +// String tenantId = currentUser.getTenantId(); +// add.setTenantId(Integer.valueOf(tenantId)); boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setConfigurationId(add.getConfigurationId()); @@ -111,7 +143,7 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService { public Boolean updateByBo(WmsConfigurationBo bo) { WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; + return baseMapper.updateByconfigurationId(update) > 0; } /** @@ -133,6 +165,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 } - return baseMapper.deleteByIds(ids) > 0; + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.in(WmsConfiguration::getConfigurationId,ids); + return baseMapper.delete(updateWrapper)>0; } } diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsConfigurationMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsConfigurationMapper.xml index 62f9a571..2e5691c2 100644 --- a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsConfigurationMapper.xml +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/WmsConfigurationMapper.xml @@ -23,6 +23,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" VALUES (#{entity.nodeCode},(#{entity.nodeName},(#{entity.approveYesNo},(#{entity.approveType},(#{entity.approveRoleCode},(#{entity.warehouseId},(#{entity.approveRange},(#{entity.tenantId}, (#{entity.createBy},(#{entity.createTime},(#{entity.updateBy},(#{entity.updateTime}) + + update wms_configuration + + node_code = #{nodeCode}, + node_name = #{nodeName}, + approve_yes_no = #{approveYesNo}, + approve_type = #{approveType}, + approve_role_code = #{approveRoleCode}, + warehouse_id = #{warehouseId}, + approve_range = #{approveRange}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where configuration_id = #{configurationId} +