skyouc
1 天以前 cd8e369a7b3b751527090147798c5b81c30bf2d0
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java
@@ -68,7 +68,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R publicTask(Map<String, Object> map, Long loginUserId) {
        List<WaveItem> itemParams =  JSONArray.parseArray(JSON.toJSONString(map.get("waveItem")), WaveItem.class);
        List<WaveItem> itemParams = JSONArray.parseArray(JSON.toJSONString(map.get("waveItem")), WaveItem.class);
        if (Objects.isNull(itemParams) || itemParams.isEmpty()) {
            throw new CoolException("参数不能为空!!");
        }
@@ -113,6 +113,7 @@
    /**
     * 选择波次明细下发任务
     *
     * @param map
     * @param loginUserId
     * @return
@@ -162,12 +163,24 @@
            throw new CoolException(e.getMessage());
        }
        if (!waveItemService.update(new LambdaUpdateWrapper<WaveItem>()
                .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_ING.val)
                .in(WaveItem::getId, waveItems))) {
            throw new CoolException("下发执行异常,请稍候重试!");
        List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSource, waveItems));
        if (Cools.isEmpty(taskItems)) {
            throw new CoolException("数据错误:波次明细已不存在!!");
        }
        for (TaskItem item : taskItems) {
            if (!waveItemService.update(new LambdaUpdateWrapper<WaveItem>()
                    .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_ING.val)
                    .set(WaveItem::getWorkQty, item.getAnfme())
                    .in(WaveItem::getId, waveItems))) {
                throw new CoolException("下发执行异常,请稍候重试!");
            }
        }
        if (!waveService.update(new LambdaUpdateWrapper<Wave>()
                .set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_TASK.val)
                .set(Wave::getWorkQty, taskItems.stream().mapToDouble(TaskItem::getAnfme).sum())
                .eq(Wave::getId, waveId))) {
            throw new CoolException("波次状态修改失败!!");
        }
        return R.ok();
    }
@@ -248,16 +261,16 @@
    }
    /**
    * @author Ryan
    * @description 取消波次
    * @param
    * @return
    * @time 2025/6/17 10:04
    */
     * @param
     * @return
     * @author Ryan
     * @description 取消波次
     * @time 2025/6/17 10:04
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R cancelWave(List<Long> ids) {
        return null;
    }
@@ -270,7 +283,7 @@
     * @time 2025/4/27 09:26
     */
    @Synchronized
    private  List<WaveItem> getLocs(List<WaveItem> waveItems) throws Exception {
    private List<WaveItem> getLocs(List<WaveItem> waveItems) throws Exception {
        //TODO  根据物料编码,批次,动态字段 查询符合的库位,再根据库位中物料的数量选择最适合的库位
        waveItems.forEach(waveItem -> {
            List<LocItem> locItems = locItemService.list(new QueryWrapper<LocItem>()