增加 送货单模块

master
wanghao 2 weeks ago
parent c0003881bb
commit de67497e1f

@ -0,0 +1,106 @@
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.WmsDeliveryNoteVo;
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
import org.dromara.wms.service.IWmsDeliveryNoteService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
*
* 访:/wms/deliveryNote
*
* @author LionLi
* @date 2025-01-06
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/deliveryNote")
public class WmsDeliveryNoteController extends BaseController {
private final IWmsDeliveryNoteService wmsDeliveryNoteService;
/**
*
*/
@SaCheckPermission("wms:deliveryNote:list")
@GetMapping("/list")
public TableDataInfo<WmsDeliveryNoteVo> list(WmsDeliveryNoteBo bo, PageQuery pageQuery) {
return wmsDeliveryNoteService.queryPageList(bo, pageQuery);
}
/**
*
*/
@SaCheckPermission("wms:deliveryNote:export")
@Log(title = "送货单管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsDeliveryNoteBo bo, HttpServletResponse response) {
List<WmsDeliveryNoteVo> list = wmsDeliveryNoteService.queryList(bo);
ExcelUtil.exportExcel(list, "送货单管理", WmsDeliveryNoteVo.class, response);
}
/**
*
*
* @param deliveryNoteId
*/
@SaCheckPermission("wms:deliveryNote:query")
@GetMapping("/{deliveryNoteId}")
public R<WmsDeliveryNoteVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long deliveryNoteId) {
return R.ok(wmsDeliveryNoteService.queryById(deliveryNoteId));
}
/**
*
*/
@SaCheckPermission("wms:deliveryNote:add")
@Log(title = "送货单管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsDeliveryNoteBo bo) {
return toAjax(wmsDeliveryNoteService.insertByBo(bo));
}
/**
*
*/
@SaCheckPermission("wms:deliveryNote:edit")
@Log(title = "送货单管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsDeliveryNoteBo bo) {
return toAjax(wmsDeliveryNoteService.updateByBo(bo));
}
/**
*
*
* @param deliveryNoteIds
*/
@SaCheckPermission("wms:deliveryNote:remove")
@Log(title = "送货单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deliveryNoteIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] deliveryNoteIds) {
return toAjax(wmsDeliveryNoteService.deleteWithValidByIds(List.of(deliveryNoteIds), true));
}
}

@ -0,0 +1,70 @@
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_delivery_note
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_delivery_note")
public class WmsDeliveryNote extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
private Long deliveryNoteId;
/**
*
*/
private String poNo;
/**
*
*/
private String deliveryNoteCode;
/**
*
*/
private String customerName;
/**
*
*/
private String contacts;
/**
*
*/
private String contactsIpone;
/**
* 012
*/
private String deliveryNoteState;
/**
*
*/
private Integer printQty;
/**
*
*/
private String licensePlate;
}

@ -0,0 +1,78 @@
package org.dromara.wms.domain.bo;
import org.dromara.wms.domain.WmsDeliveryNote;
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_delivery_note
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WmsDeliveryNote.class, reverseConvertGenerate = false)
public class WmsDeliveryNoteBo extends BaseEntity {
/**
*
*/
// @NotNull(message = "送货单表主键不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deliveryNoteId;
/**
*
*/
// @NotBlank(message = "采购订单编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String poNo;
/**
*
*/
// @NotBlank(message = "送货单编码不能为空", groups = { AddGroup.class, EditGroup.class })
private String deliveryNoteCode;
/**
*
*/
@NotBlank(message = "客户名称(默认值)不能为空", groups = { AddGroup.class, EditGroup.class })
private String customerName;
/**
*
*/
@NotBlank(message = "联系人不能为空", groups = { AddGroup.class, EditGroup.class })
private String contacts;
/**
*
*/
@NotBlank(message = "联系电话不能为空", groups = { AddGroup.class, EditGroup.class })
private String contactsIpone;
/**
* 012
*/
// @NotBlank(message = "送货单状态0待发货1已发货2已交货不能为空", groups = { AddGroup.class, EditGroup.class })
private String deliveryNoteState;
/**
*
*/
// @NotNull(message = "打印次数不能为空", groups = { EditGroup.class })
private Integer printQty;
/**
*
*/
@NotBlank(message = "车牌号不能为空", groups = { AddGroup.class, EditGroup.class })
private String licensePlate;
private String tenantId;
}

@ -0,0 +1,112 @@
package org.dromara.wms.domain.vo;
import org.dromara.wms.domain.WmsDeliveryNote;
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_delivery_note
*
* @author LionLi
* @date 2025-01-06
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WmsDeliveryNote.class)
public class WmsDeliveryNoteVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "送货单表主键")
private Long deliveryNoteId;
/**
*
*/
@ExcelProperty(value = "采购订单编号")
private String poNo;
/**
*
*/
@ExcelProperty(value = "租户号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "送货单编码")
private String deliveryNoteCode;
/**
*
*/
@ExcelProperty(value = "创建人")
private String createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "客户名称", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "默=认值")
private String customerName;
/**
*
*/
@ExcelProperty(value = "联系人")
private String contacts;
/**
*
*/
@ExcelProperty(value = "联系电话")
private String contactsIpone;
/**
* 012
*/
@ExcelProperty(value = "送货单状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "delivery_note_state")
private String deliveryNoteState;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
/**
*
*/
@ExcelProperty(value = "打印次数")
private Integer printQty;
/**
*
*/
@ExcelProperty(value = "车牌号")
private String licensePlate;
}

@ -0,0 +1,15 @@
package org.dromara.wms.mapper;
import org.dromara.wms.domain.WmsDeliveryNote;
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* Mapper
*
* @author LionLi
* @date 2025-01-06
*/
public interface WmsDeliveryNoteMapper extends BaseMapperPlus<WmsDeliveryNote, WmsDeliveryNoteVo> {
}

@ -0,0 +1,69 @@
package org.dromara.wms.service;
import org.dromara.wms.domain.WmsDeliveryNote;
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
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 LionLi
* @date 2025-01-06
*/
public interface IWmsDeliveryNoteService {
/**
*
*
* @param deliveryNoteId
* @return
*/
WmsDeliveryNoteVo queryById(Long deliveryNoteId);
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<WmsDeliveryNoteVo> queryPageList(WmsDeliveryNoteBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<WmsDeliveryNoteVo> queryList(WmsDeliveryNoteBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean insertByBo(WmsDeliveryNoteBo bo);
/**
*
*
* @param bo
* @return
*/
Boolean updateByBo(WmsDeliveryNoteBo bo);
/**
*
*
* @param ids
* @param isValid
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

@ -0,0 +1,140 @@
package org.dromara.wms.service.impl;
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.springframework.stereotype.Service;
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
import org.dromara.wms.domain.WmsDeliveryNote;
import org.dromara.wms.mapper.WmsDeliveryNoteMapper;
import org.dromara.wms.service.IWmsDeliveryNoteService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author LionLi
* @date 2025-01-06
*/
@RequiredArgsConstructor
@Service
public class WmsDeliveryNoteServiceImpl implements IWmsDeliveryNoteService {
private final WmsDeliveryNoteMapper baseMapper;
/**
*
*
* @param deliveryNoteId
* @return
*/
@Override
public WmsDeliveryNoteVo queryById(Long deliveryNoteId){
return baseMapper.selectVoOne(new LambdaQueryWrapper<WmsDeliveryNote>().eq(WmsDeliveryNote::getDeliveryNoteId, deliveryNoteId));
}
/**
*
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<WmsDeliveryNoteVo> queryPageList(WmsDeliveryNoteBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsDeliveryNote> lqw = buildQueryWrapper(bo);
lqw.orderByAsc(WmsDeliveryNote::getCreateTime);
Page<WmsDeliveryNoteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<WmsDeliveryNoteVo> queryList(WmsDeliveryNoteBo bo) {
LambdaQueryWrapper<WmsDeliveryNote> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<WmsDeliveryNote> buildQueryWrapper(WmsDeliveryNoteBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<WmsDeliveryNote> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getDeliveryNoteId() != null, WmsDeliveryNote::getDeliveryNoteId, bo.getDeliveryNoteId());
lqw.eq(StringUtils.isNotBlank(bo.getPoNo()), WmsDeliveryNote::getPoNo, bo.getPoNo());
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), WmsDeliveryNote::getTenantId, bo.getTenantId());
lqw.eq(StringUtils.isNotBlank(bo.getDeliveryNoteCode()), WmsDeliveryNote::getDeliveryNoteCode, bo.getDeliveryNoteCode());
lqw.eq(StringUtils.isNotBlank(bo.getDeliveryNoteState()), WmsDeliveryNote::getDeliveryNoteState, bo.getDeliveryNoteState());
lqw.eq(bo.getPrintQty() != null, WmsDeliveryNote::getPrintQty, bo.getPrintQty());
lqw.eq(StringUtils.isNotBlank(bo.getLicensePlate()), WmsDeliveryNote::getLicensePlate, bo.getLicensePlate());
return lqw;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean insertByBo(WmsDeliveryNoteBo bo) {
WmsDeliveryNote add = MapstructUtils.convert(bo, WmsDeliveryNote.class);
// add.setCreateBy("12312");
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setDeliveryNoteId(add.getDeliveryNoteId());
}
return flag;
}
/**
*
*
* @param bo
* @return
*/
@Override
public Boolean updateByBo(WmsDeliveryNoteBo bo) {
WmsDeliveryNote update = MapstructUtils.convert(bo, WmsDeliveryNote.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
*
*/
private void validEntityBeforeSave(WmsDeliveryNote 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.WmsDeliveryNoteMapper">
</mapper>
Loading…
Cancel
Save