feat(wms): 物料变动台账
parent
9915eff6c7
commit
2d5c3f5e3f
@ -0,0 +1,116 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
|
||||
import org.dromara.wms.service.IWmsInventoryLedgerService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 库存变动台账
|
||||
* 前端访问路由地址为:/wms/inventoryLedger
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/inventoryLedger")
|
||||
public class WmsInventoryLedgerController extends BaseController {
|
||||
|
||||
private final IWmsInventoryLedgerService wmsInventoryLedgerService;
|
||||
|
||||
/**
|
||||
* 查询库存变动台账列表
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsInventoryLedgerVo> list(WmsInventoryLedgerBo bo, PageQuery pageQuery) {
|
||||
return wmsInventoryLedgerService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存变动台账列表
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:export")
|
||||
@Log(title = "库存变动台账", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsInventoryLedgerBo bo, HttpServletResponse response) {
|
||||
List<WmsInventoryLedgerVo> list = wmsInventoryLedgerService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "库存变动台账", WmsInventoryLedgerVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存变动台账详细信息
|
||||
*
|
||||
* @param ledgerId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:query")
|
||||
@GetMapping("/{ledgerId}")
|
||||
public R<WmsInventoryLedgerVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("ledgerId") Long ledgerId) {
|
||||
return R.ok(wmsInventoryLedgerService.queryById(ledgerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存变动台账
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:add")
|
||||
@Log(title = "库存变动台账", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsInventoryLedgerBo bo) {
|
||||
return toAjax(wmsInventoryLedgerService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存变动台账
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:edit")
|
||||
@Log(title = "库存变动台账", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsInventoryLedgerBo bo) {
|
||||
return toAjax(wmsInventoryLedgerService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存变动台账
|
||||
*
|
||||
* @param ledgerIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:inventoryLedger:remove")
|
||||
@Log(title = "库存变动台账", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ledgerIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ledgerIds") Long[] ledgerIds) {
|
||||
return toAjax(wmsInventoryLedgerService.deleteWithValidByIds(List.of(ledgerIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询库存变动台账列表
|
||||
*/
|
||||
@GetMapping("/getWmsInventoryLedgerList")
|
||||
public R<List<WmsInventoryLedgerVo>> getWmsInventoryLedgerList(WmsInventoryLedgerBo bo) {
|
||||
List<WmsInventoryLedgerVo> list = wmsInventoryLedgerService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package org.dromara.wms.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 库存变动台账对象 wms_inventory_ledger
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_inventory_ledger")
|
||||
public class WmsInventoryLedger extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@TableId(value = "ledger_id", type = IdType.AUTO)
|
||||
private Long ledgerId;
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
private String locationCode;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private Long materielId;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
* 原始库存
|
||||
*/
|
||||
private Double inventoryAmount;
|
||||
|
||||
/**
|
||||
* 变动类型
|
||||
*/
|
||||
private String changeType;
|
||||
|
||||
/**
|
||||
* 变动状态(0减少,1增加)
|
||||
*/
|
||||
private String ledgerState;
|
||||
|
||||
/**
|
||||
* 变动数量
|
||||
*/
|
||||
private Double changeAmount;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String warehouseName;
|
||||
@TableField(exist = false)
|
||||
private String productCode;
|
||||
@TableField(exist = false)
|
||||
private String productName;
|
||||
@TableField(exist = false)
|
||||
private String productSpe;
|
||||
@TableField(exist = false)
|
||||
private String externalBrand;
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package org.dromara.wms.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import org.dromara.wms.domain.WmsInventoryLedger;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 库存变动台账业务对象 wms_inventory_ledger
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = WmsInventoryLedger.class, reverseConvertGenerate = false)
|
||||
public class WmsInventoryLedgerBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@NotNull(message = "仓库ID不能为空", groups = { EditGroup.class })
|
||||
private Long ledgerId;
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
private String locationCode;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private Long materielId;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
* 原始库存
|
||||
*/
|
||||
private Double inventoryAmount;
|
||||
|
||||
/**
|
||||
* 变动类型
|
||||
*/
|
||||
private String changeType;
|
||||
|
||||
/**
|
||||
* 变动状态(0减少,1增加)
|
||||
*/
|
||||
private String ledgerState;
|
||||
|
||||
/**
|
||||
* 变动数量
|
||||
*/
|
||||
private Double changeAmount;
|
||||
private String productCode;
|
||||
private String productName;
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package org.dromara.wms.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.wms.domain.WmsInventoryLedger;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 库存变动台账视图对象 wms_inventory_ledger
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = WmsInventoryLedger.class)
|
||||
public class WmsInventoryLedgerVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private Long ledgerId;
|
||||
@ExcelProperty(value = "仓库名称")
|
||||
private String warehouseName;
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@ExcelProperty(value = "租户编号")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 库位编码
|
||||
*/
|
||||
@ExcelProperty(value = "库位编码")
|
||||
private String locationCode;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@ExcelProperty(value = "仓库ID")
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private Long materielId;
|
||||
/**
|
||||
* 成品编码
|
||||
*/
|
||||
@ExcelProperty(value = "成品编码")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 成品名称
|
||||
*/
|
||||
@ExcelProperty(value = "成品名称")
|
||||
private String productName;
|
||||
@ExcelProperty(value = "外部品牌")
|
||||
private String externalBrand;
|
||||
|
||||
/**
|
||||
* 成品描述
|
||||
*/
|
||||
@ExcelProperty(value = "物料描述")
|
||||
private String productSpe;
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
@ExcelProperty(value = "批次号")
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
* 原始库存
|
||||
*/
|
||||
@ExcelProperty(value = "原始库存")
|
||||
private Double inventoryAmount;
|
||||
|
||||
/**
|
||||
* 变动类型
|
||||
*/
|
||||
@ExcelProperty(value = "变动类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "wms_ledger_change_type")
|
||||
private String changeType;
|
||||
|
||||
/**
|
||||
* 变动状态(0减少,1增加)
|
||||
*/
|
||||
@ExcelProperty(value = "变动状态(0减少,1增加)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "wms_ledger_state")
|
||||
private String ledgerState;
|
||||
|
||||
/**
|
||||
* 变动数量
|
||||
*/
|
||||
@ExcelProperty(value = "变动数量")
|
||||
private Double changeAmount;
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
@ExcelProperty(value = "创建部门")
|
||||
private Long createDept;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ExcelProperty(value = "创建人")
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ExcelProperty(value = "更新人")
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ExcelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.wms.domain.WmsInventoryLedger;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 库存变动台账Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
public interface WmsInventoryLedgerMapper extends BaseMapperPlus<WmsInventoryLedger, WmsInventoryLedgerVo> {
|
||||
|
||||
/**
|
||||
* 查询库存变动台账列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 条件
|
||||
* @return 库存变动台账集合
|
||||
*/
|
||||
public Page<WmsInventoryLedgerVo> selectCustomWmsInventoryLedgerVoList(@Param("page") Page<WmsInventoryLedgerVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<WmsInventoryLedger> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询库存变动台账列表
|
||||
*
|
||||
* @param queryWrapper 条件
|
||||
* @return 库存变动台账集合
|
||||
*/
|
||||
public List<WmsInventoryLedgerVo> selectCustomWmsInventoryLedgerVoList(@Param(Constants.WRAPPER) MPJLambdaWrapper<WmsInventoryLedger> queryWrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.wms.domain.WmsInventoryLedger;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库存变动台账Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
public interface IWmsInventoryLedgerService {
|
||||
|
||||
/**
|
||||
* 查询库存变动台账
|
||||
*
|
||||
* @param ledgerId 主键
|
||||
* @return 库存变动台账
|
||||
*/
|
||||
WmsInventoryLedgerVo queryById(Long ledgerId);
|
||||
|
||||
/**
|
||||
* 分页查询库存变动台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 库存变动台账分页列表
|
||||
*/
|
||||
TableDataInfo<WmsInventoryLedgerVo> queryPageList(WmsInventoryLedgerBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的库存变动台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 库存变动台账列表
|
||||
*/
|
||||
List<WmsInventoryLedgerVo> queryList(WmsInventoryLedgerBo bo);
|
||||
|
||||
/**
|
||||
* 新增库存变动台账
|
||||
*
|
||||
* @param bo 库存变动台账
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsInventoryLedgerBo bo);
|
||||
|
||||
/**
|
||||
* 修改库存变动台账
|
||||
*
|
||||
* @param bo 库存变动台账
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsInventoryLedgerBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除库存变动台账信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.wms.domain.WmsBaseProduct;
|
||||
import org.dromara.wms.domain.WmsWarehouseInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
|
||||
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
|
||||
import org.dromara.wms.domain.WmsInventoryLedger;
|
||||
import org.dromara.wms.mapper.WmsInventoryLedgerMapper;
|
||||
import org.dromara.wms.service.IWmsInventoryLedgerService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 库存变动台账Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-02
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsInventoryLedgerServiceImpl implements IWmsInventoryLedgerService {
|
||||
|
||||
private final WmsInventoryLedgerMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询库存变动台账
|
||||
*
|
||||
* @param ledgerId 主键
|
||||
* @return 库存变动台账
|
||||
*/
|
||||
@Override
|
||||
public WmsInventoryLedgerVo queryById(Long ledgerId){
|
||||
return baseMapper.selectVoById(ledgerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询库存变动台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 库存变动台账分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsInventoryLedgerVo> queryPageList(WmsInventoryLedgerBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsInventoryLedger> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsInventoryLedgerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的库存变动台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 库存变动台账列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInventoryLedgerVo> queryList(WmsInventoryLedgerBo bo) {
|
||||
MPJLambdaWrapper<WmsInventoryLedger> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsInventoryLedger> buildQueryWrapper(WmsInventoryLedgerBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsInventoryLedger> lqw = JoinWrappers.lambda(WmsInventoryLedger.class)
|
||||
.selectAll(WmsInventoryLedger.class)
|
||||
.like(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventoryLedger::getLocationCode, bo.getLocationCode())
|
||||
.eq(bo.getWarehouseId() != null, WmsInventoryLedger::getWarehouseId, bo.getWarehouseId())
|
||||
.eq(bo.getMaterielId() != null, WmsInventoryLedger::getMaterielId, bo.getMaterielId())
|
||||
.eq(StringUtils.isNotBlank(bo.getBatchNumber()), WmsInventoryLedger::getBatchNumber, bo.getBatchNumber())
|
||||
.eq(StringUtils.isNotBlank(bo.getChangeType()), WmsInventoryLedger::getChangeType, bo.getChangeType())
|
||||
.eq(StringUtils.isNotBlank(bo.getLedgerState()), WmsInventoryLedger::getLedgerState, bo.getLedgerState())
|
||||
.leftJoin(WmsBaseProduct.class, WmsBaseProduct::getProductId, WmsInventoryLedger::getMaterielId)
|
||||
.select(WmsBaseProduct::getProductName, WmsBaseProduct::getProductCode,WmsBaseProduct::getProductSpe)
|
||||
.leftJoin(WmsWarehouseInfo.class, WmsWarehouseInfo::getWarehouseId, WmsInventoryLedger::getWarehouseId)
|
||||
.select(WmsWarehouseInfo::getWarehouseName, WmsWarehouseInfo::getWarehouseCode)
|
||||
;
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存变动台账
|
||||
*
|
||||
* @param bo 库存变动台账
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsInventoryLedgerBo bo) {
|
||||
WmsInventoryLedger add = MapstructUtils.convert(bo, WmsInventoryLedger.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setLedgerId(add.getLedgerId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存变动台账
|
||||
*
|
||||
* @param bo 库存变动台账
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsInventoryLedgerBo bo) {
|
||||
WmsInventoryLedger update = MapstructUtils.convert(bo, WmsInventoryLedger.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsInventoryLedger entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除库存变动台账信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsInventoryLedgerMapper">
|
||||
<resultMap type="org.dromara.wms.domain.vo.WmsInventoryLedgerVo" id="WmsInventoryLedgerResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomWmsInventoryLedgerVoList" resultMap="WmsInventoryLedgerResult">
|
||||
select ledger_id, tenant_id, location_code, warehouse_id, materiel_id, batch_number, inventory_amount, change_type, ledger_state, change_amount, create_dept, create_by, create_time, update_by, update_time from wms_inventory_ledger t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue