采购订单主子表页面功能

master
maxw@mesnac.com 2 months ago
parent a1ae9be45e
commit a4a0afee86

@ -77,7 +77,7 @@ public class WmsPurchaseOrderController extends BaseController {
@Log(title = "采购订单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<WmsPurchaseOrder> add(@Validated(AddGroup.class) @RequestBody WmsPurchaseOrderBo bo) {
public R<WmsPurchaseOrder> add(@RequestBody WmsPurchaseOrderBo bo) {
return R.ok(wmsPurchaseOrderService.insertByBo(bo));
}
@ -88,7 +88,7 @@ public class WmsPurchaseOrderController extends BaseController {
@Log(title = "采购订单", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsPurchaseOrderBo bo) {
public R<Void> edit(@RequestBody WmsPurchaseOrderBo bo) {
return toAjax(wmsPurchaseOrderService.updateByBo(bo));
}

@ -0,0 +1,90 @@
package org.dromara.wms.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
import java.util.Date;
/**
* base_supplier_info
*
* @author ZangCH
* @date 2025-01-07
*/
@Data
@TableName("base_supplier_info")
public class BaseSupplierInfo {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "supplier_id", type = IdType.AUTO)
private Long supplierId;
/**
*
*/
private String supplierCode;
/**
*
*/
private String supplierName;
/**
* erp
*/
private Long erpId;
/**
* 1 0
*/
private String supplierStatus;
/**
*
*/
private Date auditDate;
/**
* erp
*/
private Date erpModifyDate;
/**
*
*/
private String remark;
/**
* 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;
}

@ -93,7 +93,7 @@ public class WmsInventory{
private Date updateTime;
@TableField(exist = false)
private String warehouseCode;//字段映射
@TableField(exist = false)
// @TableField(exist = false)
private String materialCode;//字段映射
private String warehouseId;

@ -16,9 +16,8 @@ import java.io.Serial;
* @date 2025-01-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_purchase_order")
public class WmsPurchaseOrder extends TenantEntity {
public class WmsPurchaseOrder {
@Serial
private static final long serialVersionUID = 1L;
@ -88,6 +87,36 @@ public class WmsPurchaseOrder extends TenantEntity {
*
*/
private String auditComments;
/**
*
*/
@TableField(exist = false)
private String supplierCode;
/**
* 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;
}

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.math.BigDecimal;
/**
* - wms_purchase_order_detail
@ -45,12 +46,12 @@ public class WmsPurchaseOrderDetail extends TenantEntity {
/**
*
*/
private Long taxPrice;
private BigDecimal taxPrice;
/**
*
*/
private Long purchaseQty;
private BigDecimal purchaseQty;
/**
*
@ -65,7 +66,7 @@ public class WmsPurchaseOrderDetail extends TenantEntity {
/**
* ==
*/
private Long deliveryQty;
private BigDecimal deliveryQty;
private Long materialId;

@ -77,5 +77,6 @@ public class WmsInventoryBo extends BaseEntity {
private Long storeId;
private String tenantId;
private String warehouseId;
private String materialCode;//字段映射
}

@ -9,6 +9,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
/**
* - wms_purchase_order_detail
*
@ -46,12 +48,12 @@ public class WmsPurchaseOrderDetailBo extends BaseEntity {
/**
*
*/
private Long taxPrice;
private BigDecimal taxPrice;
/**
*
*/
private Long purchaseQty;
private BigDecimal purchaseQty;
/**
*
@ -66,7 +68,7 @@ public class WmsPurchaseOrderDetailBo extends BaseEntity {
/**
* ==
*/
private Long deliveryQty;
private BigDecimal deliveryQty;
private Long materialId;

@ -0,0 +1,116 @@
package org.dromara.wms.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.wms.domain.BaseSupplierInfo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* base_supplier_info
*
* @author ZangCH
* @date 2025-01-07
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BaseSupplierInfo.class)
public class BaseSupplierInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "主键标识")
private Long supplierId;
/**
*
*/
@ExcelProperty(value = "租户编号")
private String tenantId;
/**
*
*/
@ExcelProperty(value = "供应商编号")
private String supplierCode;
/**
*
*/
@ExcelProperty(value = "供应商名称")
private String supplierName;
/**
* erp
*/
@ExcelProperty(value = "erp的主键")
private Long erpId;
/**
* 1 0
*/
@ExcelProperty(value = "激活状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String supplierStatus;
/**
*
*/
@ExcelProperty(value = "审核日期")
private Date auditDate;
/**
* erp
*/
@ExcelProperty(value = "erp最后更新时间")
private Date erpModifyDate;
/**
*
*/
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
@ExcelProperty(value = "创建部门")
private Long createDept;
/**
*
*/
@ExcelProperty(value = "创建人")
private Long createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private Long updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
}

@ -10,6 +10,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -62,13 +63,13 @@ public class WmsPurchaseOrderDetailVo implements Serializable {
*
*/
@ExcelProperty(value = "含税单价")
private Long taxPrice;
private BigDecimal taxPrice;
/**
*
*/
@ExcelProperty(value = "采购数量")
private Long purchaseQty;
private BigDecimal purchaseQty;
/**
*
@ -86,7 +87,7 @@ public class WmsPurchaseOrderDetailVo implements Serializable {
* ==
*/
@ExcelProperty(value = "送货数量=送货单数量=总入库数量")
private Long deliveryQty;
private BigDecimal deliveryQty;
/**
*

@ -141,6 +141,10 @@ public class WmsPurchaseOrderVo implements Serializable {
*/
@ExcelProperty(value = "审核意见")
private String auditComments;
/**
*
*/
private String supplierCode;
}

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

@ -79,8 +79,8 @@ public class WmsInventoryCheckRecordServiceImpl implements IWmsInventoryCheckRec
.eq(StringUtils.isNotBlank(bo.getCheckCode()), WmsInventoryCheckRecord::getCheckCode, bo.getCheckCode())
.eq(StringUtils.isNotBlank(bo.getBatchCode()), WmsInventoryCheckRecord::getBatchCode, bo.getBatchCode())
.eq(bo.getMaterialId() != null, WmsInventoryCheckRecord::getMaterialId, bo.getMaterialId())
.eq(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventoryCheckRecord::getLocationCode, bo.getLocationCode())
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsInventoryCheckRecord::getMaterialCode, bo.getMaterialCode())
.like(StringUtils.isNotBlank(bo.getLocationCode()), WmsInventoryCheckRecord::getLocationCode, bo.getLocationCode())
.like(StringUtils.isNotBlank(bo.getMaterialCode()), WmsInventoryCheckRecord::getMaterialCode, bo.getMaterialCode())
.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsInventoryCheckRecord::getMaterialName, bo.getMaterialName())
.eq(StringUtils.isNotBlank(bo.getInventoryQty()), WmsInventoryCheckRecord::getInventoryQty, bo.getInventoryQty())
.eq(bo.getCheckQty() != null, WmsInventoryCheckRecord::getCheckQty, bo.getCheckQty())

@ -92,9 +92,9 @@ public class WmsMoveOrderServiceImpl implements IWmsMoveOrderService {
.eq(bo.getMaterialId() != null, WmsMoveOrder::getMaterialId, bo.getMaterialId())
.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), WmsMoveOrder::getMaterialCategories, bo.getMaterialCategories())
.eq(bo.getWarehouseId() != null, WmsMoveOrder::getWarehouseId, bo.getWarehouseId())
.eq(bo.getPlanLocationCode() != null, WmsMoveOrder::getPlanLocationCode, bo.getPlanLocationCode())
.like(bo.getPlanLocationCode() != null, WmsMoveOrder::getPlanLocationCode, bo.getPlanLocationCode())
.eq(StringUtils.isNotBlank(bo.getOrderStatus()), WmsMoveOrder::getOrderStatus, bo.getOrderStatus())
.eq(bo.getTargetLocationCode() != null, WmsMoveOrder::getTargetLocationCode, bo.getTargetLocationCode())
.like(bo.getTargetLocationCode() != null, WmsMoveOrder::getTargetLocationCode, bo.getTargetLocationCode())
.eq(StringUtils.isNotBlank(bo.getAuditBy()), WmsMoveOrder::getAuditBy, bo.getAuditBy())
.eq(bo.getAuditTime() != null, WmsMoveOrder::getAuditTime, bo.getAuditTime())
.eq(StringUtils.isNotBlank(bo.getAuditStatus()), WmsMoveOrder::getAuditStatus, bo.getAuditStatus())

@ -1,5 +1,6 @@
package org.dromara.wms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +10,11 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.wms.domain.BaseSupplierInfo;
import org.dromara.wms.domain.WmsInstockOrder;
import org.dromara.wms.domain.vo.WmsInstockOrderVo;
import org.dromara.wms.mapper.WmsInstockOrderMapper;
import org.springframework.stereotype.Service;
import org.dromara.wms.domain.bo.WmsPurchaseOrderBo;
import org.dromara.wms.domain.vo.WmsPurchaseOrderVo;
@ -16,9 +22,12 @@ import org.dromara.wms.domain.WmsPurchaseOrder;
import org.dromara.wms.mapper.WmsPurchaseOrderMapper;
import org.dromara.wms.service.IWmsPurchaseOrderService;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Service
@ -31,6 +40,10 @@ import java.util.Collection;
public class WmsPurchaseOrderServiceImpl implements IWmsPurchaseOrderService {
private final WmsPurchaseOrderMapper baseMapper;
private static final AtomicInteger sequence = new AtomicInteger(0);
public static Integer nextSequence() {
return sequence.incrementAndGet();
}
/**
*
@ -73,6 +86,8 @@ public class WmsPurchaseOrderServiceImpl implements IWmsPurchaseOrderService {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsPurchaseOrder> lqw = JoinWrappers.lambda(WmsPurchaseOrder.class)
.selectAll(WmsPurchaseOrder.class)
.select(BaseSupplierInfo::getSupplierCode)
.leftJoin(BaseSupplierInfo.class,BaseSupplierInfo::getSupplierId,WmsPurchaseOrder::getSupplierId)
.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())
@ -96,14 +111,39 @@ public class WmsPurchaseOrderServiceImpl implements IWmsPurchaseOrderService {
*/
@Override
public WmsPurchaseOrder insertByBo(WmsPurchaseOrderBo bo) {
String username = LoginHelper.getUsername();
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHssmm");
String orderDate = format.format(date);
String order = "PUR";
String orderLast="";
Integer value = nextSequence();
if (value.toString().length()==4){
sequence.set(1);
orderLast = generateOrder(sequence.get());
}else {
orderLast = generateOrder(value);
}
String purOrder = order + orderDate + orderLast;
WmsPurchaseOrder add = MapstructUtils.convert(bo, WmsPurchaseOrder.class);
validEntityBeforeSave(add);
add.setPoNo(purOrder);
add.setCreateBy(username);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPoId(add.getPoId());
}
return add;
}
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();
}
/**
*
@ -114,6 +154,8 @@ public class WmsPurchaseOrderServiceImpl implements IWmsPurchaseOrderService {
@Override
public Boolean updateByBo(WmsPurchaseOrderBo bo) {
WmsPurchaseOrder update = MapstructUtils.convert(bo, WmsPurchaseOrder.class);
String username = LoginHelper.getUsername();
update.setUpdateBy(username);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}

@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
MAX(b.min_stock_amount) min_stock_amount,
MAX(b.max_stock_amount) max_stock_amount,
MAX(c.warehouse_code) warehouse_code,
MAX(d.material_code) material_code,
MAX(b.material_code) material_code,
MAX(x.lock_state) lock_state,
MAX(x.inventory_status) inventory_status,
MAX(x.material_categories) material_categories,
@ -34,12 +34,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
x.material_id = b.material_id
left join wms_base_warehouse c on
x.warehouse_id = c.warehouse_id
left join base_material_info d
on
x.material_id = d.material_id
-- left join base_material_info d
-- on
-- x.material_id = d.material_id
<where>
<if test="entity.materialId != null ">and x.material_id = #{entity.materialId}</if>
<!-- <if test="entity.materialId != null ">and x.material_id = #{entity.materialId}</if>-->
<if test="entity.warehouseId != null and entity.warehouseId != ''">and x.warehouse_id = #{entity.warehouseId}</if>
<if test="entity.lockState != null and entity.lockState != ''">and x.lock_state = #{entity.lockState}</if>
<if test="entity.materialCategories != null and entity.materialCategories != ''">and x.material_categories = #{entity.materialCategories}</if>
<if test="entity.inventoryStatus != null and entity.inventoryStatus != ''">and x.inventory_status = #{entity.inventoryStatus}</if>
<if test="entity.locationCode != null and entity.locationCode != ''">and x.location_code like concat('%',#{entity.locationCode},'%')</if>
<if test="entity.batchCode != null and entity.batchCode != ''">and x.batch_code like concat('%',#{entity.batchCode},'%')</if>
<if test="entity.materialCode != null and entity.materialCode != ''">and x.material_code like concat('%',#{entity.materialCode},'%')</if>
</where>
group by
x.warehouse_id ,

Loading…
Cancel
Save