From 2d647456d411fdb0ed2ba2e64582584f0d285d32 Mon Sep 17 00:00:00 2001 From: "maxw@mesnac.com" Date: Thu, 9 Jan 2025 13:44:54 +0800 Subject: [PATCH] =?UTF-8?q?wms=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99wms=5Fin?= =?UTF-8?q?ventory=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 @@ + + + + + +