wms新增物料wms_instock_detail模块
parent
3c3259cf49
commit
303a1bc364
@ -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<WmsInstockDetailVo> 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<WmsInstockDetailVo> list = wmsInstockDetailService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "入库单-物料", WmsInstockDetailVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入库单-物料详细信息
|
||||
*
|
||||
* @param instockDetailId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:instockDetail:query")
|
||||
@GetMapping("/{instockDetailId}")
|
||||
public R<WmsInstockDetailVo> 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<Void> add(@RequestBody WmsInstockDetailBo bo) {
|
||||
return toAjax(wmsInstockDetailService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入库单-物料
|
||||
*/
|
||||
@SaCheckPermission("system:instockDetail:edit")
|
||||
@Log(title = "入库单-物料", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@RequestBody WmsInstockDetailBo bo) {
|
||||
return toAjax(wmsInstockDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入库单-物料
|
||||
*
|
||||
* @param instockDetailIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:instockDetail:remove")
|
||||
@Log(title = "入库单-物料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{instockDetailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] instockDetailIds) {
|
||||
return toAjax(wmsInstockDetailService.deleteWithValidByIds(List.of(instockDetailIds), true));
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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<WmsInstockDetail, WmsInstockDetailVo> {
|
||||
|
||||
int updateDetail(WmsInstockDetail 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.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<WmsInstockDetailVo> queryPageList(WmsInstockDetailBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的入库单-物料列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 入库单-物料列表
|
||||
*/
|
||||
List<WmsInstockDetailVo> 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<Long> ids, Boolean isValid);
|
||||
}
|
@ -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<WmsInstockDetail> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WmsInstockDetail::getInstockDetailId,instockDetailId);
|
||||
return baseMapper.selectVoOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询入库单-物料列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 入库单-物料分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsInstockDetailVo> queryPageList(WmsInstockDetailBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsInstockDetail> lqw = buildQueryWrapper(bo);
|
||||
lqw.orderByDesc(WmsInstockDetail::getCreateTime);
|
||||
Page<WmsInstockDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的入库单-物料列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 入库单-物料列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsInstockDetailVo> queryList(WmsInstockDetailBo bo) {
|
||||
LambdaQueryWrapper<WmsInstockDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsInstockDetail> buildQueryWrapper(WmsInstockDetailBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsInstockDetail> 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<WmsInstockDetail> 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<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?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.WmsInstockDetailMapper">
|
||||
|
||||
<update id="updateDetail" parameterType="org.dromara.wms.domain.WmsInstockDetail">
|
||||
update wms_instock_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dnDId != null">dn_d_id = #{dnDId},</if>
|
||||
<if test="poDId != null and poDId != ''">po_d_id = #{poDId},</if>
|
||||
<if test="materialId != null and materialId != ''">material_id = #{materialId},</if>
|
||||
<if test="instockQty != null">instock_qty = #{instockQty},</if>
|
||||
<if test="codeYesNo != null">code_yes_no = #{codeYesNo},</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