Merge remote-tracking branch 'origin/master'

master
wanghao 2 months ago
commit 76ddbb5431

@ -107,9 +107,21 @@ public class ProdMaterialBomController extends BaseController {
/**
* BOM
*/
@GetMapping("getProdMaterialBomList")
@GetMapping("/getProdMaterialBomList")
public R<List<ProdMaterialBomVo>> getProdMaterialBomlist(ProdMaterialBomBo bo) {
List<ProdMaterialBomVo> list = prodMaterialBomService.queryList(bo);
return R.ok(list);
}
/**
* BOMBOM
*/
@SaCheckPermission("mes:materialBom:add")
@Log(title = "物料BOM信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/addBatchMaterialBom")
public R<Void> addBatchMaterialBom(@RequestBody List<ProdMaterialBomBo> boList) {
//不是单纯的批量新增是新增BOM对话框参考结构BOM批量新增物料BOM
return toAjax(prodMaterialBomService.insertBatchByBoList(boList));
}
}

@ -72,8 +72,14 @@ public class ProdBaseStationInfo extends TenantEntity {
*/
private String remark;
/**
* ID
*/
private Long machineId;
@TableField(exist = false)
private String processName;//字段映射
@TableField(exist = false)
private String machineName;//字段映射
}

@ -72,5 +72,9 @@ public class ProdBaseMachineInfoBo extends BaseEntity {
*/
private String remark;
/**
*
*/
private Long processId;
}

@ -74,5 +74,5 @@ public class ProdBaseStationInfoBo extends BaseEntity {
*/
private String remark;
private Long machineId;
}

@ -8,6 +8,9 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.mes.domain.ProdTechnologyStepInfo;
import java.util.List;
/**
* prod_technology_info
@ -67,5 +70,6 @@ public class ProdTechnologyInfoBo extends BaseEntity {
*/
private String remark;
private List<ProdTechnologyStepInfo> prodTechnologyStepInfoList;
}

@ -131,5 +131,11 @@ public class ProdBaseStationInfoVo implements Serializable {
@ExcelProperty(value = "更新时间")
private Date updateTime;
private Long machineId;
/**
*
*/
@ExcelProperty(value = "机台名称")
private String machineName;
}

@ -7,11 +7,12 @@ 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.mes.domain.ProdTechnologyStepInfo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -90,4 +91,6 @@ public class ProdTechnologyInfoVo implements Serializable {
@ExcelProperty(value = "物料名称")
private String materialName;
private List<ProdTechnologyStepInfo> prodTechnologyStepInfoList;
}

@ -56,4 +56,11 @@ public interface IProdMaterialBomService {
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* BOMBOM
* @param boList BOM
* @return true
*/
Boolean insertBatchByBoList(List<ProdMaterialBomBo> boList);
}

@ -10,6 +10,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.mes.domain.BaseMaterialInfo;
import org.dromara.mes.mapper.BaseMaterialInfoMapper;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.BaseEqualMaterialInfoBo;
import org.dromara.mes.domain.vo.BaseEqualMaterialInfoVo;
@ -21,6 +22,8 @@ import java.util.List;
import java.util.Map;
import java.util.Collection;
import org.springframework.util.ObjectUtils;
/**
* Service
*
@ -32,6 +35,7 @@ import java.util.Collection;
public class BaseEqualMaterialInfoServiceImpl implements IBaseEqualMaterialInfoService {
private final BaseEqualMaterialInfoMapper baseMapper;
private final BaseMaterialInfoMapper baseMaterialInfoMapper;
/**
*
@ -41,7 +45,16 @@ public class BaseEqualMaterialInfoServiceImpl implements IBaseEqualMaterialInfoS
*/
@Override
public BaseEqualMaterialInfoVo queryById(Long equalMaterialInfoId){
return baseMapper.selectVoById(equalMaterialInfoId);
BaseEqualMaterialInfoVo baseEqualMaterialInfoVo = baseMapper.selectVoById(equalMaterialInfoId);
if (!ObjectUtils.isEmpty(baseEqualMaterialInfoVo)) {
// 关联物料名称
BaseMaterialInfo baseMaterialInfo = baseMaterialInfoMapper.selectOne(Wrappers.lambdaQuery(BaseMaterialInfo.class)
.eq(BaseMaterialInfo::getMaterialId, baseEqualMaterialInfoVo.getMaterialId()));
if (!ObjectUtils.isEmpty(baseMaterialInfo)) {
baseEqualMaterialInfoVo.setMaterialName(baseMaterialInfo.getMaterialName());
}
}
return baseEqualMaterialInfoVo;
}
/**

@ -10,6 +10,8 @@ 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.mes.domain.ProdBaseProcessInfo;
import org.dromara.mes.domain.ProdBaseStationInfo;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdBaseMachineInfoBo;
import org.dromara.mes.domain.vo.ProdBaseMachineInfoVo;
@ -74,6 +76,8 @@ public class ProdBaseMachineInfoServiceImpl implements IProdBaseMachineInfoServi
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<ProdBaseMachineInfo> lqw = JoinWrappers.lambda(ProdBaseMachineInfo.class)
.selectAll(ProdBaseMachineInfo.class)
.leftJoin(ProdBaseStationInfo.class, ProdBaseStationInfo::getMachineId, ProdBaseMachineInfo::getMachineId)
.leftJoin(ProdBaseProcessInfo.class, ProdBaseProcessInfo::getProcessId, ProdBaseStationInfo::getProcessId)
.eq(bo.getMachineId() != null, ProdBaseMachineInfo::getMachineId, bo.getMachineId())
.eq(StringUtils.isNotBlank(bo.getMachineCode()), ProdBaseMachineInfo::getMachineCode, bo.getMachineCode())
.like(StringUtils.isNotBlank(bo.getMachineName()), ProdBaseMachineInfo::getMachineName, bo.getMachineName())
@ -83,7 +87,8 @@ public class ProdBaseMachineInfoServiceImpl implements IProdBaseMachineInfoServi
.eq(StringUtils.isNotBlank(bo.getMachineSpec()), ProdBaseMachineInfo::getMachineSpec, bo.getMachineSpec())
.eq(StringUtils.isNotBlank(bo.getSupplierId()), ProdBaseMachineInfo::getSupplierId, bo.getSupplierId())
.eq(StringUtils.isNotBlank(bo.getMachineStatus()), ProdBaseMachineInfo::getMachineStatus, bo.getMachineStatus())
.orderByDesc(ProdBaseMachineInfo::getCreateTime);
.eq(StringUtils.isNotNull(bo.getProcessId()), ProdBaseProcessInfo::getProcessId, bo.getProcessId())
.orderByAsc(ProdBaseMachineInfo::getCreateTime);
return lqw;
}

@ -9,6 +9,7 @@ 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.mes.domain.ProdBaseMachineInfo;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdBaseStationInfoBo;
@ -75,16 +76,19 @@ public class ProdBaseStationInfoServiceImpl implements IProdBaseStationInfoServi
MPJLambdaWrapper<ProdBaseStationInfo> lqw = JoinWrappers.lambda(ProdBaseStationInfo.class)
.selectAll(ProdBaseStationInfo.class)
.select(ProdBaseProcessInfo::getProcessName)
.select(ProdBaseMachineInfo::getMachineName)
.leftJoin(ProdBaseProcessInfo.class, ProdBaseProcessInfo::getProcessId, ProdBaseStationInfo::getProcessId)
.leftJoin(ProdBaseMachineInfo.class, ProdBaseMachineInfo::getMachineId, ProdBaseStationInfo::getMachineId)
.eq(bo.getStationId() != null, ProdBaseStationInfo::getStationId, bo.getStationId())
.eq(StringUtils.isNotBlank(bo.getStationCode()), ProdBaseStationInfo::getStationCode, bo.getStationCode())
.like(StringUtils.isNotBlank(bo.getStationName()), ProdBaseStationInfo::getStationName, bo.getStationName())
.eq(StringUtils.isNotBlank(bo.getStationType()), ProdBaseStationInfo::getStationType, bo.getStationType())
.eq(bo.getProcessId() != null, ProdBaseStationInfo::getProcessId, bo.getProcessId())
.eq(bo.getMachineId() != null, ProdBaseStationInfo::getMachineId, bo.getMachineId())
.like(StringUtils.isNotBlank(bo.getAgvCode()), ProdBaseStationInfo::getAgvCode, bo.getAgvCode())
.like(StringUtils.isNotBlank(bo.getIpAddress()), ProdBaseStationInfo::getIpAddress, bo.getIpAddress())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseStationInfo::getActiveFlag, bo.getActiveFlag())
.orderByDesc(ProdBaseStationInfo::getCreateTime);
.orderByAsc(ProdBaseStationInfo::getCreateTime);
return lqw;
}

@ -15,6 +15,14 @@ import org.dromara.mes.service.IProdMaterialBomService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.HashMap;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.collection.CollUtil;
import org.dromara.common.core.exception.ServiceException;
/**
* BOMService
@ -154,4 +162,89 @@ public class ProdMaterialBomServiceImpl implements IProdMaterialBomService {
}
}
/**
* BOMBOM
* @param boList BOM
* @return true
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertBatchByBoList(List<ProdMaterialBomBo> boList) {
if (CollUtil.isEmpty(boList)) {
return false;
}
try {
// 按层级分组根据parentId分组
Map<Long, List<ProdMaterialBomBo>> levelMap = new HashMap<>();
// 1. 首先找出所有顶级节点
List<ProdMaterialBomBo> topNodes = boList.stream()
.filter(bo -> bo.getParentId() == null || bo.getParentId() == 0)
.collect(Collectors.toList());
// 2. 其他节点按parentId分组
Map<Long, List<ProdMaterialBomBo>> childrenMap = boList.stream()
.filter(bo -> bo.getParentId() != null && bo.getParentId() != 0)
.collect(Collectors.groupingBy(bo -> Math.abs(bo.getParentId())));
// 存储临时ID到实际ID的映射
Map<Long, Long> idMapping = new HashMap<>();
// 3. 优先处理顶级节点,设置基础数据并插入
for (ProdMaterialBomBo topNode : topNodes) {
Long tempId = Math.abs(topNode.getMaterialBomId());
topNode.setMaterialBomId(null); // 清除临时ID
topNode.setParentId(0L); // 确保顶级节点parentId为0
topNode.setAncestors("0"); // 顶级节点的ancestors为"0"
topNode.setTopFlag(1L); // 设置顶级节点的topFlag为1
// 插入顶级节点
ProdMaterialBom add = MapstructUtils.convert(topNode, ProdMaterialBom.class);
if (baseMapper.insert(add) <= 0) {
throw new ServiceException("插入顶级节点失败");
}
// 记录映射关系
idMapping.put(tempId, add.getMaterialBomId());
}
// 4. 处理子节点,直到所有节点都处理完
while (!childrenMap.isEmpty()) {
// 找出当前可以处理的节点父节点已经在idMapping中的节点
List<Long> processableParentIds = new ArrayList<>(childrenMap.keySet());
boolean processed = false;// 标记本轮是否有节点被处理
for (Long parentTempId : processableParentIds) {
// 检查父节点是否已处理
if (idMapping.containsKey(parentTempId)) {
List<ProdMaterialBomBo> children = childrenMap.remove(parentTempId);
// 处理同一父节点的所有子节点
for (ProdMaterialBomBo child : children) {
Long childTempId = Math.abs(child.getMaterialBomId());
// 设置实际的父节点ID
child.setMaterialBomId(null);// 清除临时ID
child.setTopFlag(0L); // 设置非顶级节点的topFlag为0
Long actualParentId = idMapping.get(parentTempId);
child.setParentId(actualParentId);
// 设置祖级列表
ProdMaterialBom parent = baseMapper.selectById(actualParentId);
child.setAncestors(parent.getAncestors() + "," + actualParentId);
// 插入子节点
ProdMaterialBom add = MapstructUtils.convert(child, ProdMaterialBom.class);
if (baseMapper.insert(add) <= 0) {
throw new ServiceException("插入子节点失败");
}
// 记录映射关系
idMapping.put(childTempId, add.getMaterialBomId());
}
processed = true;
}
}
// 如果一轮循环没有处理任何节点,说明数据有问题
if (!processed && !childrenMap.isEmpty()) {
throw new ServiceException("存在无法处理的节点,可能是父节点丢失");
}
}
return true;
} catch (Exception e) {
throw new ServiceException("批量插入失败: " + e.getMessage());
}
}
}

@ -1,5 +1,7 @@
package org.dromara.mes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -11,12 +13,16 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.mes.domain.BaseMaterialInfo;
import org.dromara.mes.domain.ProdBaseProcessInfo;
import org.dromara.mes.domain.ProdTechnologyStepInfo;
import org.dromara.mes.domain.bo.ProdTechnologyStepInfoBo;
import org.dromara.mes.mapper.ProdTechnologyStepInfoMapper;
import org.springframework.stereotype.Service;
import org.dromara.mes.domain.bo.ProdTechnologyInfoBo;
import org.dromara.mes.domain.vo.ProdTechnologyInfoVo;
import org.dromara.mes.domain.ProdTechnologyInfo;
import org.dromara.mes.mapper.ProdTechnologyInfoMapper;
import org.dromara.mes.service.IProdTechnologyInfoService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@ -34,6 +40,8 @@ public class ProdTechnologyInfoServiceImpl implements IProdTechnologyInfoService
private final ProdTechnologyInfoMapper baseMapper;
private final ProdTechnologyStepInfoMapper prodTechnologyStepInfoMapper;
/**
*
*
@ -46,7 +54,15 @@ public class ProdTechnologyInfoServiceImpl implements IProdTechnologyInfoService
bo.setTechnologyId(technologyId);
MPJLambdaWrapper<ProdTechnologyInfo> lqw = buildQueryWrapper(bo);
List<ProdTechnologyInfoVo> voList = baseMapper.selectVoList(lqw);
return voList.get(0);
ProdTechnologyInfoVo prodTechnologyInfoVo = voList.get(0);
//工艺步序信息
MPJLambdaWrapper<ProdTechnologyStepInfo> lqwStep = JoinWrappers.lambda(ProdTechnologyStepInfo.class)
.selectAll(ProdTechnologyStepInfo.class)
.eq(bo.getTechnologyId() != null, ProdTechnologyStepInfo::getTechnologyId, bo.getTechnologyId())
.orderByAsc(ProdTechnologyStepInfo::getCreateTime);
List<ProdTechnologyStepInfo> prodTechnologyStepInfoList = prodTechnologyStepInfoMapper.selectList(lqwStep);
prodTechnologyInfoVo.setProdTechnologyStepInfoList(prodTechnologyStepInfoList);
return prodTechnologyInfoVo;
}
/**
@ -91,7 +107,7 @@ public class ProdTechnologyInfoServiceImpl implements IProdTechnologyInfoService
.eq(StringUtils.isNotBlank(bo.getTechnologyVersion()), ProdTechnologyInfo::getTechnologyVersion, bo.getTechnologyVersion())
.eq(bo.getStandardTime() != null, ProdTechnologyInfo::getStandardTime, bo.getStandardTime())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdTechnologyInfo::getActiveFlag, bo.getActiveFlag())
.orderByDesc(ProdTechnologyInfo::getCreateTime);
.orderByAsc(ProdTechnologyInfo::getCreateTime);
return lqw;
}
@ -119,9 +135,22 @@ public class ProdTechnologyInfoServiceImpl implements IProdTechnologyInfoService
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(ProdTechnologyInfoBo bo) {
ProdTechnologyInfo update = MapstructUtils.convert(bo, ProdTechnologyInfo.class);
validEntityBeforeSave(update);
List<ProdTechnologyStepInfo> technologyStepInfoList = bo.getProdTechnologyStepInfoList();
if (technologyStepInfoList.size() > 0){
LambdaQueryWrapper<ProdTechnologyStepInfo> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotNull(bo.getTechnologyId()), ProdTechnologyStepInfo::getTechnologyId, bo.getTechnologyId());
prodTechnologyStepInfoMapper.delete(lqw);
for (ProdTechnologyStepInfo stepInfo : technologyStepInfoList) {
stepInfo.setStepId(null);
prodTechnologyStepInfoMapper.insert(stepInfo);
}
}
return baseMapper.updateById(update) > 0;
}

@ -81,7 +81,7 @@ public class ProdTechnologyStepInfoServiceImpl implements IProdTechnologyStepInf
.eq(StringUtils.isNotBlank(bo.getStepParameter()), ProdTechnologyStepInfo::getStepParameter, bo.getStepParameter())
.eq(StringUtils.isNotBlank(bo.getValueState()), ProdTechnologyStepInfo::getValueState, bo.getValueState())
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdTechnologyStepInfo::getActiveFlag, bo.getActiveFlag())
.orderByDesc(ProdTechnologyStepInfo::getCreateTime);
.orderByDesc(ProdTechnologyStepInfo::getStepCode);
return lqw;
}

@ -74,7 +74,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bmi.material_code,
bmi.material_name,
bomi.material_name material_bom_name,
pbsi.station_name release_name,
case
when t.release_type = 1 then (select pbmi.machine_name
from prod_base_machine_info pbmi
where t.release_id = pbmi.machine_id)
when t.release_type = 2 then (select su.nick_name
from sys_user su
where t.release_id = su.user_id)
when t.release_type = 3 then (select pbsi.station_name
from prod_base_station_info pbsi
where t.release_id = pbsi.station_id)
end as release_name,
pbpi.process_name,
bsi.shift_name,
bcti.team_name
@ -85,7 +95,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ${tableName} t
left join base_material_info bmi on bmi.material_id = t.material_id
left join base_material_info bomi on bomi.material_id = t.material_bom_id
left join prod_base_station_info pbsi on pbsi.station_id = t.release_id
left join prod_base_process_info pbpi on pbpi.process_id = t.process_id
left join base_shift_info bsi on bsi.shift_id = t.shift_id
left join base_class_team_info bcti on bcti.class_team_id = t.class_team_id

@ -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 ,

@ -38,7 +38,7 @@ public class SysMasterDataDetailController extends BaseController {
private final ISysMasterDataDetailService sysMasterDataDetailService;
/**
*
* -
*/
@SaCheckPermission("system:masterDataDetail:list")
@GetMapping("/list")
@ -46,6 +46,16 @@ public class SysMasterDataDetailController extends BaseController {
return sysMasterDataDetailService.queryPageList(bo, pageQuery);
}
/**
* -
*/
@SaCheckPermission("system:masterDataDetail:list")
@GetMapping("/treeList")
public R<List<SysMasterDataDetailVo>> list(SysMasterDataDetailBo bo) {
List<SysMasterDataDetailVo> list = sysMasterDataDetailService.queryList(bo);
return R.ok(list);
}
/**
*
*/

Loading…
Cancel
Save