add(hwmom-wms): 新增采购订单及采购订单物料模块
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,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,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,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…
Reference in New Issue