skyouc
2025-04-01 fd8c8f8facc58ce1d2dd45b738e8316172c99a85
1. 质检明细接口修改
2. 任务列表生成修改
5个文件已修改
74 ■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/QlyIsptItemController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/IsptItemsParams.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/QlyInspect.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyIsptItemServiceImpl.java 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/QlyIsptItemController.java
@@ -15,6 +15,7 @@
import com.vincent.rsf.server.manager.entity.QlyIsptItem;
import com.vincent.rsf.server.manager.service.QlyIsptItemService;
import com.vincent.rsf.server.system.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -23,6 +24,7 @@
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@Api(tags = "质检明细")
@RestController
public class QlyIsptItemController extends BaseController {
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/params/IsptItemsParams.java
@@ -21,9 +21,9 @@
@ApiModel(value = "IsptItemsParams", description = "明细修改参数")
public class IsptItemsParams implements Serializable {
    @ApiModelProperty("主单ID")
    private List<Long> ids;
    @ApiModelProperty("明细参数")
    private QlyIsptItem isptItem;
    private List<QlyIsptItem> isptItem;
    @ApiModelProperty("类型:1:合格, 2:不合格, 0: 其它(默认)")
    private String type;
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/QlyInspect.java
@@ -54,6 +54,9 @@
    @ApiModelProperty("质检状态")
    private String isptStatus;
    @ApiModelProperty("质检结果")
    private Short isptResult;
    /**
     * 业务类型
     */
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyIsptItemServiceImpl.java
@@ -6,17 +6,26 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.controller.params.IsptItemsParams;
import com.vincent.rsf.server.manager.controller.params.QlyInspectAndItem;
import com.vincent.rsf.server.manager.entity.QlyInspect;
import com.vincent.rsf.server.manager.mapper.QlyIsptItemMapper;
import com.vincent.rsf.server.manager.entity.QlyIsptItem;
import com.vincent.rsf.server.manager.service.QlyInspectService;
import com.vincent.rsf.server.manager.service.QlyIsptItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service("qlyIsptItemService")
public class QlyIsptItemServiceImpl extends ServiceImpl<QlyIsptItemMapper, QlyIsptItem> implements QlyIsptItemService {
    @Autowired
    private QlyInspectService qlyInspectService;
    /**
     * @author Ryan
@@ -26,20 +35,50 @@
     * @time 2025/4/1 09:40
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchUpdate(IsptItemsParams params) {
        if (Objects.isNull(params.getIds()) || params.getIds().isEmpty()) {
        if (Objects.isNull(params.getIsptItem()) || params.getIsptItem().isEmpty()) {
            throw new CoolException("ID不能为空!!");
        }
        QlyIsptItem isptItem = params.getIsptItem();
        if (Objects.isNull(isptItem)) {
            throw new CoolException("参数不能为空!");
        List<QlyIsptItem> isptItem =  params.getIsptItem();
        List<Long> list = isptItem.stream().map(QlyIsptItem::getId).collect(Collectors.toList());
        if (params.getType().equals("2") || params.getType().equals("1")) {
            if (!this.update(new LambdaUpdateWrapper<QlyIsptItem>()
                    .set(QlyIsptItem::getIsptResult, params.getType())
                    .in(QlyIsptItem::getId, list))) {
                throw new CoolException("修改失败!!");
            }
        } else {
            if (!this.updateBatchById(isptItem)) {
                throw new CoolException("明细修改失败");
            }
        }
       return this.update(new LambdaUpdateWrapper<QlyIsptItem>()
                .in(QlyIsptItem::getId, params.getIds())
                .set(!Objects.isNull(isptItem.getIsptStatus()), QlyIsptItem::getIsptStatus, !Objects.isNull(isptItem.getIsptStatus()) ? isptItem.getIsptStatus() : "0")
                .set(!Objects.isNull(isptItem.getDisQty()), QlyIsptItem::getDisQty, !Objects.isNull(isptItem.getDisQty()) ? isptItem.getDisQty() : 0)
                .set(!Objects.isNull(isptItem.getDlyQty()), QlyIsptItem::getDlyQty, !Objects.isNull(isptItem.getDlyQty()) ? isptItem.getDlyQty() : 0)
                .set(!Objects.isNull(isptItem.getIsptResult()), QlyIsptItem::getIsptResult, !Objects.isNull(isptItem.getIsptResult()) ? isptItem.getIsptResult() : "0"));
        List<QlyIsptItem> isptItems = this.list(new LambdaQueryWrapper<QlyIsptItem>().in(QlyIsptItem::getId, list));
        if (isptItems.isEmpty()) {
            throw new CoolException("数据错误:明细不存在!!");
        }
        Map<Long, List<QlyIsptItem>> listMap = isptItems.stream().collect(Collectors.groupingBy(QlyIsptItem::getIspectId));
        for (Long key : listMap.keySet()) {
            QlyInspect inspect = qlyInspectService.getById(key);
            List<QlyIsptItem> items = listMap.get(key);
            Double safeQty = items.stream().mapToDouble(QlyIsptItem::getSafeQty).sum();
            Double rcptQty = items.stream().mapToDouble(QlyIsptItem::getSafeQty).sum();
            Double disQty = items.stream().mapToDouble(QlyIsptItem::getDisQty).sum();
            Double qlyQty = safeQty + disQty;
            //安全数量,质检数量
            inspect.setSafeQty(safeQty)
                    .setIsptQty(qlyQty);
            if (Double.compare(disQty, 0) > 0) {
                inspect.setIsptResult(Short.parseShort("4"));
            }
            if (Double.compare(safeQty, rcptQty) == 0) {
                inspect.setIsptResult(Short.parseShort("1"));
            }
            if (!qlyInspectService.updateById(inspect)) {
                throw new CoolException("质检数量修改失败!!");
            }
        }
        return true;
    }
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
@@ -25,7 +25,7 @@
        //TODO 库位策略后续排期
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type), false);
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type), false);
        return Objects.isNull(loc) ? loc.getCode() : null;
    }