huminmin
昨天 e28990c8626f115fccad6fd5f47a6e98b85dacb7
主生产计划增加状态字段,根据状态判断是否编辑删除
已修改4个文件
19 ■■■■■ 文件已修改
doc/宁夏-中盛建材.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/ÄþÏÄ-ÖÐÊ¢½¨²Ä.sql
@@ -167,3 +167,7 @@
  ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
alter table production_plan
    add status tinyint default 0 not null comment '状态 0未下发 1已下发';
src/main/java/com/ruoyi/productionPlan/pojo/ProductionPlan.java
@@ -106,6 +106,10 @@
    @Excel(name = "强度")
    private String strength;
    @ApiModelProperty("状态 0未下发 1已下发")
    @Excel(name = "状态", readConverterExp = "0=未下发,1=已下发")
    private Integer status;
    /**
     * å¼€å§‹æ—¥æœŸ
     */
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -166,6 +166,7 @@
            if (assignedVolume.add(remainingVolume).compareTo(productionPlanDto.getTotalAssignedQuantity()) >= 0) {
                // æœ€åŽä¸€ä¸ªè®¡åˆ’,分配剩余方数
                BigDecimal lastRemainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume);
                plan.setStatus(1);
                plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume));
                productOrderPlan.setAssignedQuantity(lastRemainingVolume);
                productionPlanMapper.updateById(plan);
@@ -174,6 +175,7 @@
            }
            // åˆ†é…å½“前计划方数
            plan.setStatus(1);
            plan.setAssignedQuantity(plan.getAssignedQuantity().add(remainingVolume));
            productOrderPlan.setAssignedQuantity(remainingVolume);
            // æ›´æ–°ç”Ÿäº§è®¡åˆ’
@@ -196,6 +198,10 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean update(ProductionPlanDto productionPlanDto) {
        // å·²ä¸‹å‘状态,不能编辑
        if (productionPlanDto.getStatus() == 1) {
            throw new BaseException("已下发状态,不能编辑");
        }
        // æŸ¥è¯¢æ˜¯å¦æœ‰å…³è”订单
        boolean hasProductOrderPlan = productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().eq(ProductOrderPlan::getProductionPlanId, productionPlanDto.getId())).stream().anyMatch(p -> p.getProductOrderId() != null);
        if (hasProductOrderPlan) {
@@ -212,6 +218,10 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delete(List<Long> ids) {
        // å¦‚果存在已下发的计划,则不能删除
        if (productionPlanMapper.selectList(Wrappers.<ProductionPlan>lambdaQuery().in(ProductionPlan::getId, ids).eq(ProductionPlan::getStatus, 1)).stream().anyMatch(p -> p.getStatus() == 1)) {
            throw new BaseException("删除失败,存在已下发的计划");
        }
        // å¦‚果有关联订单,则不能删除
        if (productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductionPlanId, ids)).stream().anyMatch(p -> p.getProductOrderId() != null)) {
            throw new BaseException("删除失败,存在关联订单");
src/main/resources/mapper/productionPlan/ProductionPlanMapper.xml
@@ -68,6 +68,7 @@
        <if test="c.endDate != null">
            AND pp.end_date &lt;= DATE_FORMAT(#{c.endDate},'%Y-%m-%d')
        </if>
        ORDER BY pp.id DESC
    </select>
    <select id="selectSummaryByProductType" resultType="com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto">