yys  1.仓储物流增加分类管理
2.仓储物流分类管理导出接口
4.新疆生产管控定制化
已添加2个文件
已修改8个文件
279 ■■■■■ 文件已修改
src/main/java/com/ruoyi/basic/pojo/ProductModel.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/dto/ProductionDispatchAddDto.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/dto/SalesLedgerSchedulingDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/mapper/SpeculativeTradingInfoMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/pojo/SalesLedgerScheduling.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/pojo/SpeculativeTradingInfo.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/SalesLedgerSchedulingServiceImpl.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/pojo/ProductModel.java
@@ -39,6 +39,12 @@
    @Excel(name = "单位")
    private String unit;
    /**
     * ç”Ÿäº§ç‚’机
     */
    @Excel(name = "生产炒机")
    private String speculativeTradingName;
    @ApiModelProperty(value = "租户ID")
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;
src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java
@@ -12,11 +12,14 @@
import com.ruoyi.production.dto.ProductionDispatchAddDto;
import com.ruoyi.production.dto.SalesLedgerSchedulingDto;
import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto;
import com.ruoyi.production.mapper.SpeculativeTradingInfoMapper;
import com.ruoyi.production.pojo.SpeculativeTradingInfo;
import com.ruoyi.production.service.impl.SalesLedgerSchedulingServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -35,6 +38,44 @@
    private SalesLedgerSchedulingServiceImpl salesLedgerSchedulingService;
    @Autowired
    private SpeculativeTradingInfoMapper speculativeTradingInfoMapper;
    @GetMapping("/list")
    @Log(title = "生产管理-生产派工-炒机信息", businessType = BusinessType.OTHER)
    @ApiOperation("生产管理-生产派工-炒机信息")
    public AjaxResult list() {
        List<SpeculativeTradingInfo> result = speculativeTradingInfoMapper.selectList(null);
        result.forEach(item -> {
            item.setCurrentWorkLoad(salesLedgerSchedulingService.getSchedulingNumBySpeculativeTradingName(item.getName()));
            item.setVacant(item.getWorkLoad().subtract(item.getCurrentWorkLoad()));
        });
        return AjaxResult.success(result);
    }
    @PostMapping("/addSpeculatTrading")
    @Log(title = "生产管理-生产派工-添加炒机信息", businessType = BusinessType.INSERT)
    @ApiOperation("生产管理-生产派工-添加炒机信息")
    public AjaxResult addSpeculatTrading(@RequestBody List<SpeculativeTradingInfo> speculativeTradingInfo) {
        if(CollectionUtils.isEmpty(speculativeTradingInfo)) return AjaxResult.error("数据组不能为空");
        speculativeTradingInfo.forEach(item -> {
            speculativeTradingInfoMapper.insert(item);
        });
        return AjaxResult.success("添加炒机信息成功");
    }
    @PostMapping("/updateSpeculatTrading")
    @Log(title = "生产管理-生产派工-修改炒机信息", businessType = BusinessType.UPDATE)
    @ApiOperation("生产管理-生产派工-修改炒机信息")
    public AjaxResult updateSpeculatTrading(@RequestBody List<SpeculativeTradingInfo> speculativeTradingInfo) {
        if(CollectionUtils.isEmpty(speculativeTradingInfo)) return AjaxResult.error("数据组不能为空");
        speculativeTradingInfo.forEach(item -> {
            speculativeTradingInfoMapper.updateById(item);
        });
        return AjaxResult.success("修改炒机信息成功");
    }
    @GetMapping("/listPage")
    @Log(title = "生产管理-生产订单-分页查询", businessType = BusinessType.OTHER)
    @ApiOperation("生产管理-生产订单-分页查询")
src/main/java/com/ruoyi/production/dto/ProductionDispatchAddDto.java
@@ -1,5 +1,6 @@
package com.ruoyi.production.dto;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -38,4 +39,14 @@
    @ApiModelProperty(value = "排产日期")
    private String schedulingDate;
    /**
     * ç”Ÿäº§ç‚’机
     */
    private String speculativeTradingName;
    /**
     * è§„格型号
     */
    private String specificationModel;
}
src/main/java/com/ruoyi/production/dto/SalesLedgerSchedulingDto.java
@@ -28,6 +28,12 @@
    private Long salesLedgerId;
    /**
     * ç”Ÿäº§ç‚’机
     */
    @Excel(name = "生产炒机")
    private String speculativeTradingName;
    /**
     * é”€å”®åˆåŒå·
     */
    @Excel(name = "销售合同号")
src/main/java/com/ruoyi/production/mapper/SpeculativeTradingInfoMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.ruoyi.production.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.production.pojo.SpeculativeTradingInfo;
/**
 * @author :yys
 * @date : 2025/11/11 15:40
 */
public interface SpeculativeTradingInfoMapper extends BaseMapper<SpeculativeTradingInfo> {
}
src/main/java/com/ruoyi/production/pojo/SalesLedgerScheduling.java
@@ -1,6 +1,7 @@
package com.ruoyi.production.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Builder;
import lombok.Data;
@@ -38,6 +39,11 @@
    private Long schedulingUserId;
    /**
     * ç”Ÿäº§ç‚’机
     */
    private String speculativeTradingName;
    /**
     * æ´¾å·¥äººåç§°
     */
    private String schedulingUserName;
src/main/java/com/ruoyi/production/pojo/SpeculativeTradingInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
package com.ruoyi.production.pojo;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
 * @author :yys
 * @date : 2025/11/11 15:38
 */
@TableName("speculative_trading_info")
@Data
public class SpeculativeTradingInfo {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * ç‚’机名称
     */
    private String name;
    /**
     * ç‚’机工作量(单位kg)
     */
    private BigDecimal workLoad;
    /**
     * æŽ’序
     */
    private Integer sort;
    /**
     * ç‚’机正在工作量(单位kg)
     */
    @TableField(exist = false)
    private BigDecimal currentWorkLoad;
    /**
     * ç‚’机空余工作量(单位kg)
     */
    @TableField(exist = false)
    private BigDecimal vacant;
    /**
     * åˆ›å»ºè€…
     */
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    /**
     * ä¿®æ”¹è€…
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     * ä¿®æ”¹æ—¶é—´
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     * ç§Ÿæˆ·ID
     */
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;
}
src/main/java/com/ruoyi/production/service/impl/SalesLedgerSchedulingServiceImpl.java
@@ -5,15 +5,18 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
import com.ruoyi.production.dto.*;
import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper;
import com.ruoyi.production.mapper.SalesLedgerWorkMapper;
import com.ruoyi.production.mapper.SpeculativeTradingInfoMapper;
import com.ruoyi.production.pojo.SalesLedgerScheduling;
import com.ruoyi.production.pojo.SalesLedgerWork;
import com.ruoyi.production.pojo.SpeculativeTradingInfo;
import com.ruoyi.production.service.SalesLedgerSchedulingService;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -25,8 +28,11 @@
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@@ -95,13 +101,46 @@
    private final SysUserMapper sysUserMapper;
    private final SpeculativeTradingInfoMapper speculativeTradingInfoMapper;
    @Override
    public int productionDispatch(ProductionDispatchAddDto productionDispatchAddDto) {
        SysUser sysUser = sysUserMapper.selectUserById(productionDispatchAddDto.getSchedulingUserId());
        if(sysUser == null) throw new RuntimeException("排产人不存在");
        // èŽ·å–ç©ºä½™ç‚’æœº
        String[] split = productionDispatchAddDto.getSpeculativeTradingName().split(",");
        if(split != null && split.length == 0){
            throw new RuntimeException("生产炒机不能为空");
        }
        List<SpeculativeTradingInfo> speculativeTradingInfos = speculativeTradingInfoMapper.selectList(new LambdaQueryWrapper<SpeculativeTradingInfo>()
                .in(SpeculativeTradingInfo::getName, Arrays.asList(split))
                .orderByAsc(SpeculativeTradingInfo::getSort));
        if(CollectionUtils.isEmpty(speculativeTradingInfos)){
            throw new RuntimeException("无空余炒机,请检查炒机表");
        }
        AtomicReference<String> name = new AtomicReference<>("");  //需要绑定的炒机
        //通过规格型号和排产数量计算本次生产产量
        String[] split1 = productionDispatchAddDto.getSpecificationModel().split("\\*");
        if(split1.length != 2) throw new RuntimeException("规格型号格式错误");
        // æœ¬æ¬¡ç”Ÿäº§äº§é‡
        BigDecimal productionNum = new BigDecimal(split1[0])
                .multiply(new BigDecimal(split1[1]).multiply(productionDispatchAddDto.getSchedulingNum()));
        // å¤šä¸ªç‚’机情况
        if(speculativeTradingInfos.size() > 1){
            speculativeTradingInfos.forEach(item ->{
                // èŽ·å–è¯¥ç‚’æœºæ­£åœ¨æŽ’äº§é‡
                BigDecimal schedulingNumBySpeculativeTradingName = getSchedulingNumBySpeculativeTradingName(item.getName());
                // å¦‚果该炒机总量 - æ­£åœ¨æŽ’产量 >=本次生产产量就分配此炒机
                if(item.getWorkLoad().subtract(schedulingNumBySpeculativeTradingName).compareTo(productionNum) >= 0){
                    name.set(item.getName());
                }
            });
        }
        if(name.get().isEmpty()) throw new RuntimeException("无空余炒机,请检查炒机表");
        SalesLedgerScheduling salesLedgerScheduling = SalesLedgerScheduling.builder()
                .salesLedgerId(productionDispatchAddDto.getSalesLedgerId())
                .salesLedgerProductId(productionDispatchAddDto.getSalesLedgerProductId())
                .speculativeTradingName(name.get())
                .schedulingUserId(productionDispatchAddDto.getSchedulingUserId())
                .schedulingUserName(sysUser.getNickName())
                .schedulingNum(productionDispatchAddDto.getSchedulingNum())
@@ -111,6 +150,75 @@
        return salesLedgerSchedulingMapper.insert(salesLedgerScheduling);
    }
    private final SalesLedgerProductMapper salesLedgerProductMapper;
    /**
     *通过炒机名称获取当天正在排产量
     * @return
     */
    public BigDecimal getSchedulingNumBySpeculativeTradingName(String speculativeTradingName){
        LambdaQueryWrapper<SalesLedgerScheduling> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SalesLedgerScheduling::getSpeculativeTradingName, speculativeTradingName)
                .eq(SalesLedgerScheduling::getSchedulingDate, LocalDate.now());
        List<SalesLedgerScheduling> salesLedgerSchedulings = salesLedgerSchedulingMapper.selectList(queryWrapper);
        if(CollectionUtils.isEmpty(salesLedgerSchedulings)){
            return BigDecimal.ZERO;
        }
        List<Long> collect = salesLedgerSchedulings.stream().map(SalesLedgerScheduling::getSalesLedgerProductId).collect(Collectors.toList());
        List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>()
                .in(SalesLedgerProduct::getId, collect));
        if(CollectionUtils.isEmpty(salesLedgerProducts)) return BigDecimal.ZERO;
        AtomicInteger totalNum = new AtomicInteger(0); //总数
        salesLedgerSchedulings.forEach(item ->{
            List<SalesLedgerProduct> collect1 = salesLedgerProducts.stream()
                    .filter(j -> j.getId().equals(item.getSalesLedgerProductId()))
                    .collect(Collectors.toList());
            if(!CollectionUtils.isEmpty(collect1)){
                SalesLedgerProduct salesLedgerProduct = collect1.get(0);
                // æ ¹æ®äº§å“è§„æ ¼ * æŽ’产数量 èŽ·å–æœ¬æ¬¡ç”Ÿäº§äº§é‡å¹¶ç´¯è®¡
                String[] split = salesLedgerProduct.getSpecificationModel().split("\\*");
                BigDecimal productionNum = new BigDecimal(split[0])
                        .multiply(new BigDecimal(split[1]).multiply(item.getSchedulingNum()));
                totalNum.addAndGet(productionNum.intValue());
            }
        });
        return new BigDecimal(totalNum.get());
    }
    /**
     *通过批量炒机名称获取当天正在排产量
     * @return
     */
    public BigDecimal getSchedulingNumBySpeculativeTradingNameList(List<String> speculativeTradingName){
        LambdaQueryWrapper<SalesLedgerScheduling> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(SalesLedgerScheduling::getSpeculativeTradingName, speculativeTradingName)
                .eq(SalesLedgerScheduling::getSchedulingDate, LocalDate.now());
        List<SalesLedgerScheduling> salesLedgerSchedulings = salesLedgerSchedulingMapper.selectList(queryWrapper);
        if(CollectionUtils.isEmpty(salesLedgerSchedulings)){
            return BigDecimal.ZERO;
        }
        List<Long> collect = salesLedgerSchedulings.stream().map(SalesLedgerScheduling::getSalesLedgerProductId).collect(Collectors.toList());
        List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>()
                .in(SalesLedgerProduct::getId, collect));
        if(CollectionUtils.isEmpty(salesLedgerProducts)) return BigDecimal.ZERO;
        AtomicInteger totalNum = new AtomicInteger(0); //总数
        salesLedgerSchedulings.forEach(item ->{
            List<SalesLedgerProduct> collect1 = salesLedgerProducts.stream()
                    .filter(j -> j.getId().equals(item.getSalesLedgerProductId()))
                    .collect(Collectors.toList());
            if(!CollectionUtils.isEmpty(collect1)){
                SalesLedgerProduct salesLedgerProduct = collect1.get(0);
                // æ ¹æ®äº§å“è§„æ ¼ * æŽ’产数量 èŽ·å–æœ¬æ¬¡ç”Ÿäº§äº§é‡å¹¶ç´¯è®¡
                String[] split = salesLedgerProduct.getSpecificationModel().split("\\*");
                BigDecimal productionNum = new BigDecimal(split[0])
                        .multiply(new BigDecimal(split[1]).multiply(item.getSchedulingNum()));
                totalNum.addAndGet(productionNum.intValue());
            }
        });
        return new BigDecimal(totalNum.get());
    }
    @Override
    public IPage<SalesLedgerSchedulingProcessDto> listPageProcess(Page page, SalesLedgerSchedulingProcessDto salesLedgerSchedulingDto) {
        IPage<SalesLedgerSchedulingProcessDto> list = salesLedgerSchedulingMapper.listPageProcess(page, salesLedgerSchedulingDto);
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
@@ -59,6 +59,12 @@
    private String unit;
    /**
     * ç”Ÿäº§ç‚’机
     */
    @Excel(name = "生产炒机")
    private String speculativeTradingName;
    /**
     * æ•°é‡
     */
    @Excel(name = "数量")
src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml
@@ -15,6 +15,7 @@
        T2.quantity,
        T2.product_category,
        T2.specification_model,
        T2.speculative_trading_name,
        T2.unit
        FROM
        sales_ledger_product T2