| | |
| | | import com.vincent.rsf.server.manager.mapper.WaveMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.utils.LocManageUtil; |
| | | import com.vincent.rsf.server.manager.utils.OptimalAlgorithmUtil; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | | |
| | | if (!waveItemService.update(new LambdaUpdateWrapper<WaveItem>() |
| | | .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_ING.val) |
| | | .in(WaveItem::getId, waveItems))) { |
| | | throw new CoolException("下发执行异常,请稍候重试!"); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | List<LocItem> locItems = LocManageUtil.getEfficiencyFirstItemList(items.get(i).getMatnrCode(), items.get(i).getSplrBatch(), items.get(i).getAnfme()); |
| | | items.get(i).setStockLocs(JSONArray.toJSONString(locItems)).setStockQty(items.get(i).getAnfme()); |
| | | } |
| | | |
| | | /**生成出库任务*/ |
| | | try { |
| | | generateOutTask(items, loginUserId, waves); |
| | |
| | | log.error("UNK", e); |
| | | 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("下发执行异常,请稍候重试!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | for (WaveItem param : itemParams) { |
| | | String locs = param.getStockLocs(); |
| | | List<LocItem> locItems = JSONArray.parseArray(locs, LocItem.class); |
| | | List<Long> list = new ArrayList<>(); |
| | | if (Objects.isNull(locItems) || locItems.isEmpty()) { |
| | | //TODO |
| | | } else { |
| | | list = locItems.stream().map(LocItem::getLocId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /**根据供应商批次,物料码, 动态字段查询指定的物料库存信息*/ |
| | | //TODO 这里需要要根据波次规则查找库存信息 |
| | | List<LocItem> items = locItemService.list(new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getBatch, param.getSplrBatch()) |
| | | .in(!list.isEmpty(), LocItem::getLocId, list) |
| | | // .eq(StringUtils.isNotBlank(param.getFieldsIndex()), LocItem::getFieldsIndex, param.getFieldsIndex()) |
| | | .eq(LocItem::getMatnrCode, param.getMatnrCode())); |
| | | if (items.isEmpty()) { |
| | | throw new CoolException("库存信息有变,请取消当前波次,生新生成新的波次!!"); |
| | | } |
| | | /***将有货有的明细信息存放到库位信息中*/ |
| | | for (int i = 0; i < items.size(); i++) { |
| | | items.get(i) |
| | | for (int i = 0; i < locItems.size(); i++) { |
| | | locItems.get(i) |
| | | .setSourceId(param.getWaveId()) |
| | | .setSourceCode(param.getWaveCode()) |
| | | .setSource(param.getId()); |
| | | } |
| | | locItemList.addAll(items); |
| | | locItemList.addAll(locItems); |
| | | } |
| | | if (locItemList.isEmpty()) { |
| | | throw new CoolException("没有合适库位!!"); |
| | |
| | | // if (!items.isEmpty()) { |
| | | // throw new CoolException("波次任务已生成,不能重复生成!!"); |
| | | // } |
| | | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskType(TaskType.TASK_TYPE_OUT.type) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | |
| | | taskItems.forEach(item -> { |
| | | boolean update = waveItemService.update(new LambdaUpdateWrapper<WaveItem>() |
| | | .eq(WaveItem::getId, item.getSource()) |
| | | .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_SEED.val) |
| | | .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_SEED.val) |
| | | .set(WaveItem::getWorkQty, item.getAnfme())); |
| | | if (!update) { |
| | | throw new CoolException("波次执行数量修改失败!!"); |