wms新增物料wms_instock_order模块
parent
2c1c2ff7ad
commit
3c3259cf49
@ -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<WmsInstockOrderVo> 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<WmsInstockOrderVo> list = wmsInstockOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "入库单", WmsInstockOrderVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入库单详细信息
|
||||
*
|
||||
* @param instockId 主键
|
||||
*/
|
||||
// @SaCheckPermission("system:instockOrder:query")
|
||||
@GetMapping("/{instockId}")
|
||||
public R<WmsInstockOrderVo> 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<Void> add( @RequestBody WmsInstockOrderBo bo) {
|
||||
return toAjax(wmsInstockOrderService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入库单
|
||||
*/
|
||||
@SaCheckPermission("system:instockOrder:edit")
|
||||
@Log(title = "入库单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] instockIds) {
|
||||
return toAjax(wmsInstockOrderService.deleteWithValidByIds(List.of(instockIds), true));
|
||||
}
|
||||
}
|
@ -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;//字段映射
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;//字段映射
|
||||
|
||||
|
||||
}
|
@ -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<WmsInstockOrder, WmsInstockOrderVo> {
|
||||
|
||||
int updateInstock(WmsInstockOrder update);
|
||||
}
|
@ -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<WmsInstockOrderVo> queryPageList(WmsInstockOrderBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的入库单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 入库单列表
|
||||
*/
|
||||
List<WmsInstockOrderVo> 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<Long> ids, Boolean isValid);
|
||||
}
|
@ -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<WmsInstockOrder> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WmsInstockOrder::getInstockId,instockId);
|
||||
return baseMapper.selectVoOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 入库单分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsInstockOrderVo> queryPageList(WmsInstockOrderBo bo, PageQuery pageQuery) {
|
||||
// LambdaQueryWrapper<WmsInstockOrder> lqw = buildQueryWrapper(bo);
|
||||
MPJLambdaWrapper<WmsInstockOrder> lqw = buildJoinQueryWrapper(bo);
|
||||
lqw.orderByDesc(WmsInstockOrder::getCreateTime);
|
||||
Page<WmsInstockOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的入库单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 入库单列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInstockOrderVo> queryList(WmsInstockOrderBo bo) {
|
||||
LambdaQueryWrapper<WmsInstockOrder> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
private MPJLambdaWrapper<WmsInstockOrder> buildJoinQueryWrapper(WmsInstockOrderBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsInstockOrder> 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<WmsInstockOrder> buildQueryWrapper(WmsInstockOrderBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsInstockOrder> 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<WmsInstockOrder> 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<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
LambdaUpdateWrapper<WmsInstockOrder> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(WmsInstockOrder::getInstockId,ids);
|
||||
return baseMapper.delete(wrapper)>0;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?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.WmsInstockOrderMapper">
|
||||
|
||||
<update id="updateInstock" parameterType="org.dromara.wms.domain.WmsInstockOrder">
|
||||
update wms_instock_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="instockCode != null">instock_code = #{instockCode},</if>
|
||||
<if test="materialCategories != null and materialCategories != ''">material_categories = #{materialCategories},</if>
|
||||
<if test="instockType != null and instockType != ''">instock_type = #{instockType},</if>
|
||||
<if test="auditBy != null">audit_by = #{auditBy},</if>
|
||||
<if test="auditComments != null">audit_comments = #{auditComments},</if>
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where instock_id = #{instockId}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue