add(hwmom-wms): 新增采购订单及采购订单物料模块

master
zch 1 week ago
parent 2dafc80207
commit 09718780a7

@ -0,0 +1,117 @@
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.WmsPurchaseOrderVo;
import org.dromara.wms.domain.bo.WmsPurchaseOrderBo;
import org.dromara.wms.service.IWmsPurchaseOrderService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
* 访:/wms/wmsPurchaseOrder
*
* @author ZangCH
* @date 2025-01-08
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/wmsPurchaseOrder")
public class WmsPurchaseOrderController extends BaseController {
private final IWmsPurchaseOrderService wmsPurchaseOrderService;
/**
*
*/
@SaCheckPermission("wms:wmsPurchaseOrder:list")
@GetMapping("/list")
public TableDataInfo<WmsPurchaseOrderVo> list(WmsPurchaseOrderBo bo, PageQuery pageQuery) {
return wmsPurchaseOrderService.queryPageList(bo, pageQuery);
}
/**
*
*/
@SaCheckPermission("wms:wmsPurchaseOrder:export")
@Log(title = "采购订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsPurchaseOrderBo bo, HttpServletResponse response) {
List<WmsPurchaseOrderVo> list = wmsPurchaseOrderService.queryList(bo);
ExcelUtil.exportExcel(list, "采购订单", WmsPurchaseOrderVo.class, response);
}
/**
*
*
* @param poId
*/
@SaCheckPermission("wms:wmsPurchaseOrder:query")
@GetMapping("/{poId}")
public R<WmsPurchaseOrderVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long poId) {
return R.ok(wmsPurchaseOrderService.queryById(poId));
}
/**
*
*/
@SaCheckPermission("wms:wmsPurchaseOrder:add")
@Log(title = "采购订单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsPurchaseOrderBo bo) {
return toAjax(wmsPurchaseOrderService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("wms:wmsPurchaseOrder:edit")
@Log(title = "采购订单", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsPurchaseOrderBo bo) {
return toAjax(wmsPurchaseOrderService.updateByBo(bo));
}
/**
*
*
* @param poIds
*/
@SaCheckPermission("wms:wmsPurchaseOrder:remove")
@Log(title = "采购订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{poIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] poIds) {
return toAjax(wmsPurchaseOrderService.deleteWithValidByIds(List.of(poIds), true));
}
/**
*
*/
@GetMapping("getWmsPurchaseOrderList")
public R<List<WmsPurchaseOrderVo>> getWmsPurchaseOrderlist(WmsPurchaseOrderBo bo) {
List<WmsPurchaseOrderVo> list = wmsPurchaseOrderService.queryList(bo);
return R.ok(list);
}
}

@ -0,0 +1,117 @@
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.WmsPurchaseOrderDetailVo;
import org.dromara.wms.domain.bo.WmsPurchaseOrderDetailBo;
import org.dromara.wms.service.IWmsPurchaseOrderDetailService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* -
* 访:/wms/wmsPurchaseOrderDetail
*
* @author ZangCH
* @date 2025-01-08
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/wmsPurchaseOrderDetail")
public class WmsPurchaseOrderDetailController extends BaseController {
private final IWmsPurchaseOrderDetailService wmsPurchaseOrderDetailService;
/**
* -
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:list")
@GetMapping("/list")
public TableDataInfo<WmsPurchaseOrderDetailVo> list(WmsPurchaseOrderDetailBo bo, PageQuery pageQuery) {
return wmsPurchaseOrderDetailService.queryPageList(bo, pageQuery);
}
/**
* -
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:export")
@Log(title = "采购订单-物料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsPurchaseOrderDetailBo bo, HttpServletResponse response) {
List<WmsPurchaseOrderDetailVo> list = wmsPurchaseOrderDetailService.queryList(bo);
ExcelUtil.exportExcel(list, "采购订单-物料", WmsPurchaseOrderDetailVo.class, response);
}
/**
* -
*
* @param poDId
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:query")
@GetMapping("/{poDId}")
public R<WmsPurchaseOrderDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long poDId) {
return R.ok(wmsPurchaseOrderDetailService.queryById(poDId));
}
/**
* -
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:add")
@Log(title = "采购订单-物料", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsPurchaseOrderDetailBo bo) {
return toAjax(wmsPurchaseOrderDetailService.insertByBo(bo));
}
/**
* -
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:edit")
@Log(title = "采购订单-物料", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsPurchaseOrderDetailBo bo) {
return toAjax(wmsPurchaseOrderDetailService.updateByBo(bo));
}
/**
* -
*
* @param poDIds
*/
@SaCheckPermission("wms:wmsPurchaseOrderDetail:remove")
@Log(title = "采购订单-物料", businessType = BusinessType.DELETE)
@DeleteMapping("/{poDIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] poDIds) {
return toAjax(wmsPurchaseOrderDetailService.deleteWithValidByIds(List.of(poDIds), true));
}
/**
* -
*/
@GetMapping("getWmsPurchaseOrderDetailList")
public R<List<WmsPurchaseOrderDetailVo>> getWmsPurchaseOrderDetaillist(WmsPurchaseOrderDetailBo bo) {
List<WmsPurchaseOrderDetailVo> list = wmsPurchaseOrderDetailService.queryList(bo);
return R.ok(list);
}
}

@ -0,0 +1,93 @@
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_purchase_order
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_purchase_order")
public class WmsPurchaseOrder extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "po_id", type = IdType.AUTO)
private Long poId;
/**
*
*/
private String poNo;
/**
* (123)
*/
private String poStatus;
/**
*
*/
private String planDeliveryDate;
/**
* ID
*/
private Long supplierId;
/**
* (1,2ERP,34)
*/
private String poType;
/**
* ID
*/
private Long erpId;
/**
*
*/
private String remark;
/**
*
*/
private String materialCategories;
/**
*
*/
private String auditBy;
/**
*
*/
private Date auditTime;
/**
* (0,1,2)
*/
private String auditStatus;
/**
*
*/
private String auditComments;
}

@ -0,0 +1,71 @@
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_purchase_order_detail
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_purchase_order_detail")
public class WmsPurchaseOrderDetail extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "po_d_id", type = IdType.AUTO)
private Long poDId;
/**
*
*/
private String materialCode;
/**
*
*/
private String materialName;
/**
*
*/
private String poNo;
/**
*
*/
private Long taxPrice;
/**
*
*/
private Long purchaseQty;
/**
*
*/
private String materialSpe;
/**
*
*/
private String unitName;
/**
* ==
*/
private Long deliveryQty;
}

@ -0,0 +1,92 @@
package org.dromara.wms.domain.bo;
import org.dromara.wms.domain.WmsPurchaseOrder;
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;
/**
* wms_purchase_order
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WmsPurchaseOrder.class, reverseConvertGenerate = false)
public class WmsPurchaseOrderBo extends BaseEntity {
/**
*
*/
private Long poId;
/**
*
*/
@NotBlank(message = "订单编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String poNo;
/**
* (123)
*/
private String poStatus;
/**
*
*/
private String planDeliveryDate;
/**
* ID
*/
private Long supplierId;
/**
* (1,2ERP,34)
*/
private String poType;
/**
* ID
*/
private Long erpId;
/**
*
*/
private String remark;
/**
*
*/
private String materialCategories;
/**
*
*/
private String auditBy;
/**
*
*/
private Date auditTime;
/**
* (0,1,2)
*/
private String auditStatus;
/**
*
*/
private String auditComments;
}

@ -0,0 +1,72 @@
package org.dromara.wms.domain.bo;
import org.dromara.wms.domain.WmsPurchaseOrderDetail;
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_purchase_order_detail
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WmsPurchaseOrderDetail.class, reverseConvertGenerate = false)
public class WmsPurchaseOrderDetailBo extends BaseEntity {
/**
*
*/
private Long poDId;
/**
*
*/
@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 poNo;
/**
*
*/
private Long taxPrice;
/**
*
*/
private Long purchaseQty;
/**
*
*/
private String materialSpe;
/**
*
*/
private String unitName;
/**
* ==
*/
private Long deliveryQty;
}

@ -0,0 +1,98 @@
package org.dromara.wms.domain.vo;
import org.dromara.wms.domain.WmsPurchaseOrderDetail;
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_purchase_order_detail
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WmsPurchaseOrderDetail.class)
public class WmsPurchaseOrderDetailVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "采购物料表主键")
private Long poDId;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "物料编码")
private String materialCode;
/**
*
*/
@ExcelProperty(value = "物料名称")
private String materialName;
/**
*
*/
@ExcelProperty(value = "采购订单编号")
private String poNo;
/**
*
*/
@ExcelProperty(value = "含税单价")
private Long taxPrice;
/**
*
*/
@ExcelProperty(value = "采购数量")
private Long purchaseQty;
/**
*
*/
@ExcelProperty(value = "物料规格")
private String materialSpe;
/**
*
*/
@ExcelProperty(value = "计量单位名称")
private String unitName;
/**
* ==
*/
@ExcelProperty(value = "送货数量=送货单数量=总入库数量")
private Long deliveryQty;
/**
*
*/
@ExcelProperty(value = "租户号")
private String tenantId;
}

@ -0,0 +1,146 @@
package org.dromara.wms.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.wms.domain.WmsPurchaseOrder;
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_purchase_order
*
* @author ZangCH
* @date 2025-01-08
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WmsPurchaseOrder.class)
public class WmsPurchaseOrderVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "表主键")
private Long poId;
/**
*
*/
@ExcelProperty(value = "订单编号")
private String poNo;
/**
* (123)
*/
@ExcelProperty(value = "订单状态(1待采购2部分到货3订单完成)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wms_po_status")
private String poStatus;
/**
*
*/
@ExcelProperty(value = "计划交货日期")
private String planDeliveryDate;
/**
* ID
*/
@ExcelProperty(value = "供应商ID")
private Long supplierId;
/**
* (1,2ERP,34)
*/
@ExcelProperty(value = "订单类型(1人工创建,2ERP同步,3后台创建4)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wms_po_type")
private String poType;
/**
* ID
*/
@ExcelProperty(value = "单据的ID连表扩充")
private Long erpId;
/**
*
*/
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
@ExcelProperty(value = "租户号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "创建人")
private String createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private String updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
/**
*
*/
@ExcelProperty(value = "物料大类", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "material_mategories")
private String materialCategories;
/**
*
*/
@ExcelProperty(value = "审核人")
private String auditBy;
/**
*
*/
@ExcelProperty(value = "审核时间")
private Date auditTime;
/**
* (0,1,2)
*/
@ExcelProperty(value = "审核状态(0待审核,1审核通过,2审核未通过)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wms_audit_status")
private String auditStatus;
/**
*
*/
@ExcelProperty(value = "审核意见")
private String auditComments;
}

@ -0,0 +1,15 @@
package org.dromara.wms.mapper;
import org.dromara.wms.domain.WmsPurchaseOrderDetail;
import org.dromara.wms.domain.vo.WmsPurchaseOrderDetailVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* -Mapper
*
* @author ZangCH
* @date 2025-01-08
*/
public interface WmsPurchaseOrderDetailMapper extends BaseMapperPlus<WmsPurchaseOrderDetail, WmsPurchaseOrderDetailVo> {
}

@ -0,0 +1,15 @@
package org.dromara.wms.mapper;
import org.dromara.wms.domain.WmsPurchaseOrder;
import org.dromara.wms.domain.vo.WmsPurchaseOrderVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* Mapper
*
* @author ZangCH
* @date 2025-01-08
*/
public interface WmsPurchaseOrderMapper extends BaseMapperPlus<WmsPurchaseOrder, WmsPurchaseOrderVo> {
}

@ -0,0 +1,69 @@
package org.dromara.wms.service;
import org.dromara.wms.domain.WmsPurchaseOrderDetail;
import org.dromara.wms.domain.vo.WmsPurchaseOrderDetailVo;
import org.dromara.wms.domain.bo.WmsPurchaseOrderDetailBo;
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 ZangCH
* @date 2025-01-08
*/
public interface IWmsPurchaseOrderDetailService {
/**
* -
*
* @param poDId
* @return -
*/
WmsPurchaseOrderDetailVo queryById(Long poDId);
/**
* -
*
* @param bo
* @param pageQuery
* @return -
*/
TableDataInfo<WmsPurchaseOrderDetailVo> queryPageList(WmsPurchaseOrderDetailBo bo, PageQuery pageQuery);
/**
* -
*
* @param bo
* @return -
*/
List<WmsPurchaseOrderDetailVo> queryList(WmsPurchaseOrderDetailBo bo);
/**
* -
*
* @param bo -
* @return
*/
Boolean insertByBo(WmsPurchaseOrderDetailBo bo);
/**
* -
*
* @param bo -
* @return
*/
Boolean updateByBo(WmsPurchaseOrderDetailBo bo);
/**
* -
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -0,0 +1,69 @@
package org.dromara.wms.service;
import org.dromara.wms.domain.WmsPurchaseOrder;
import org.dromara.wms.domain.vo.WmsPurchaseOrderVo;
import org.dromara.wms.domain.bo.WmsPurchaseOrderBo;
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 ZangCH
* @date 2025-01-08
*/
public interface IWmsPurchaseOrderService {
/**
*
*
* @param poId
* @return
*/
WmsPurchaseOrderVo queryById(Long poId);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<WmsPurchaseOrderVo> queryPageList(WmsPurchaseOrderBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<WmsPurchaseOrderVo> queryList(WmsPurchaseOrderBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean insertByBo(WmsPurchaseOrderBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBo(WmsPurchaseOrderBo bo);
/**
*
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -0,0 +1,139 @@
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.springframework.stereotype.Service;
import org.dromara.wms.domain.bo.WmsPurchaseOrderDetailBo;
import org.dromara.wms.domain.vo.WmsPurchaseOrderDetailVo;
import org.dromara.wms.domain.WmsPurchaseOrderDetail;
import org.dromara.wms.mapper.WmsPurchaseOrderDetailMapper;
import org.dromara.wms.service.IWmsPurchaseOrderDetailService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* -Service
*
* @author ZangCH
* @date 2025-01-08
*/
@RequiredArgsConstructor
@Service
public class WmsPurchaseOrderDetailServiceImpl implements IWmsPurchaseOrderDetailService {
private final WmsPurchaseOrderDetailMapper baseMapper;
/**
* -
*
* @param poDId
* @return -
*/
@Override
public WmsPurchaseOrderDetailVo queryById(Long poDId){
return baseMapper.selectVoById(poDId);
}
/**
* -
*
* @param bo
* @param pageQuery
* @return -
*/
@Override
public TableDataInfo<WmsPurchaseOrderDetailVo> queryPageList(WmsPurchaseOrderDetailBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<WmsPurchaseOrderDetail> lqw = buildQueryWrapper(bo);
Page<WmsPurchaseOrderDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* -
*
* @param bo
* @return -
*/
@Override
public List<WmsPurchaseOrderDetailVo> queryList(WmsPurchaseOrderDetailBo bo) {
MPJLambdaWrapper<WmsPurchaseOrderDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<WmsPurchaseOrderDetail> buildQueryWrapper(WmsPurchaseOrderDetailBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsPurchaseOrderDetail> lqw = JoinWrappers.lambda(WmsPurchaseOrderDetail.class)
.selectAll(WmsPurchaseOrderDetail.class)
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsPurchaseOrderDetail::getMaterialCode, bo.getMaterialCode())
.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsPurchaseOrderDetail::getMaterialName, bo.getMaterialName())
.eq(StringUtils.isNotBlank(bo.getPoNo()), WmsPurchaseOrderDetail::getPoNo, bo.getPoNo())
.eq(bo.getTaxPrice() != null, WmsPurchaseOrderDetail::getTaxPrice, bo.getTaxPrice())
.eq(bo.getPurchaseQty() != null, WmsPurchaseOrderDetail::getPurchaseQty, bo.getPurchaseQty())
.eq(StringUtils.isNotBlank(bo.getMaterialSpe()), WmsPurchaseOrderDetail::getMaterialSpe, bo.getMaterialSpe())
.like(StringUtils.isNotBlank(bo.getUnitName()), WmsPurchaseOrderDetail::getUnitName, bo.getUnitName())
.eq(bo.getDeliveryQty() != null, WmsPurchaseOrderDetail::getDeliveryQty, bo.getDeliveryQty())
.orderByDesc(WmsPurchaseOrderDetail::getCreateTime);
return lqw;
}
/**
* -
*
* @param bo -
* @return
*/
@Override
public Boolean insertByBo(WmsPurchaseOrderDetailBo bo) {
WmsPurchaseOrderDetail add = MapstructUtils.convert(bo, WmsPurchaseOrderDetail.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPoDId(add.getPoDId());
}
return flag;
}
/**
* -
*
* @param bo -
* @return
*/
@Override
public Boolean updateByBo(WmsPurchaseOrderDetailBo bo) {
WmsPurchaseOrderDetail update = MapstructUtils.convert(bo, WmsPurchaseOrderDetail.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(WmsPurchaseOrderDetail 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,142 @@
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.springframework.stereotype.Service;
import org.dromara.wms.domain.bo.WmsPurchaseOrderBo;
import org.dromara.wms.domain.vo.WmsPurchaseOrderVo;
import org.dromara.wms.domain.WmsPurchaseOrder;
import org.dromara.wms.mapper.WmsPurchaseOrderMapper;
import org.dromara.wms.service.IWmsPurchaseOrderService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author ZangCH
* @date 2025-01-08
*/
@RequiredArgsConstructor
@Service
public class WmsPurchaseOrderServiceImpl implements IWmsPurchaseOrderService {
private final WmsPurchaseOrderMapper baseMapper;
/**
*
*
* @param poId
* @return
*/
@Override
public WmsPurchaseOrderVo queryById(Long poId){
return baseMapper.selectVoById(poId);
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<WmsPurchaseOrderVo> queryPageList(WmsPurchaseOrderBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<WmsPurchaseOrder> lqw = buildQueryWrapper(bo);
Page<WmsPurchaseOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<WmsPurchaseOrderVo> queryList(WmsPurchaseOrderBo bo) {
MPJLambdaWrapper<WmsPurchaseOrder> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<WmsPurchaseOrder> buildQueryWrapper(WmsPurchaseOrderBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsPurchaseOrder> lqw = JoinWrappers.lambda(WmsPurchaseOrder.class)
.selectAll(WmsPurchaseOrder.class)
.eq(StringUtils.isNotBlank(bo.getPoNo()), WmsPurchaseOrder::getPoNo, bo.getPoNo())
.eq(StringUtils.isNotBlank(bo.getPoStatus()), WmsPurchaseOrder::getPoStatus, bo.getPoStatus())
.eq(StringUtils.isNotBlank(bo.getPlanDeliveryDate()), WmsPurchaseOrder::getPlanDeliveryDate, bo.getPlanDeliveryDate())
.eq(bo.getSupplierId() != null, WmsPurchaseOrder::getSupplierId, bo.getSupplierId())
.eq(StringUtils.isNotBlank(bo.getPoType()), WmsPurchaseOrder::getPoType, bo.getPoType())
.eq(bo.getErpId() != null, WmsPurchaseOrder::getErpId, bo.getErpId())
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsPurchaseOrder::getMaterialCategories, bo.getMaterialCategories())
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsPurchaseOrder::getAuditBy, bo.getAuditBy())
.eq(bo.getAuditTime() != null, WmsPurchaseOrder::getAuditTime, bo.getAuditTime())
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsPurchaseOrder::getAuditStatus, bo.getAuditStatus())
.eq(StringUtils.isNotBlank(bo.getAuditComments()), WmsPurchaseOrder::getAuditComments, bo.getAuditComments())
.orderByDesc(WmsPurchaseOrder::getCreateTime);
return lqw;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean insertByBo(WmsPurchaseOrderBo bo) {
WmsPurchaseOrder add = MapstructUtils.convert(bo, WmsPurchaseOrder.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPoId(add.getPoId());
}
return flag;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean updateByBo(WmsPurchaseOrderBo bo) {
WmsPurchaseOrder update = MapstructUtils.convert(bo, WmsPurchaseOrder.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(WmsPurchaseOrder 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,7 @@
<?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.WmsPurchaseOrderDetailMapper">
</mapper>

@ -0,0 +1,7 @@
<?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.WmsPurchaseOrderMapper">
</mapper>
Loading…
Cancel
Save