| | |
| | | package com.vincent.rsf.server.api.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.erp.params.SaveCheckDiffParams; |
| | | import com.vincent.rsf.server.api.service.PdaCheckOrderService; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.CheckDiffExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | |
| | | |
| | | return R.ok(Cools.add("checkDiffItems",checkDiffItems).add("checkDiff",checkDiff)); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/11/5 |
| | | * @description: 希日无单据临时盘点 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public R tempCheckItem(String barcode) { |
| | | if (Objects.isNull(barcode)) { |
| | | throw new CoolException("搬盘码不能为空!!"); |
| | | } |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | | Task task = taskService.getOne(lambdaQueryWrapper); |
| | | if (null == task) { |
| | | throw new CoolException("未找到容器号对应任务"); |
| | | } |
| | | if (!task.getTaskStatus().equals(TaskStsType.AWAIT.id)) { |
| | | return R.error("任务状态不是等待确认"); |
| | | } |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | if (Cools.isEmpty(taskItems)){ |
| | | throw new CoolException("未找到该容器码对应的任务明细"); |
| | | } |
| | | taskItems.forEach(taskItem -> { |
| | | if (!Objects.isNull(taskItem.getFieldsIndex())) { |
| | | Map<String, String> fields = FieldsUtils.getFields(taskItem.getFieldsIndex()); |
| | | taskItem.setExtendFields(fields); |
| | | } |
| | | }); |
| | | |
| | | return R.ok().add(taskItems); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/11/5 |
| | | * @description: 盘点添加新物料 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public R confirmMatnr(Map<String, Object> map) { |
| | | if (Objects.isNull(map)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(map.get("barcode"))) { |
| | | throw new CoolException("托盘码不能为空!!"); |
| | | } |
| | | if (Objects.isNull(map.get("matnrs"))) { |
| | | throw new CoolException("新增物料不能为空!!"); |
| | | } |
| | | String barcode = map.get("barcode").toString(); |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | | Task task = taskService.getOne(lambdaQueryWrapper); |
| | | if (null == task) { |
| | | throw new CoolException("未找到容器号对应任务"); |
| | | } |
| | | if (!task.getTaskStatus().equals(TaskStsType.AWAIT.id)) { |
| | | return R.error("任务状态不是等待确认"); |
| | | } |
| | | |
| | | List<Matnr> items = JSONArray.parseArray(JSONArray.toJSONString(map.get("matnrs")), Map<String, Object>.class); |
| | | |
| | | |
| | | |
| | | // if (Objects.isNull(map.get("taskId"))) { |
| | | // throw new CoolException("任务ID不能为空!!"); |
| | | // } |
| | | // if (Objects.isNull(map.get("matnr"))) { |
| | | // throw new CoolException("物料编码不能为空!!"); |
| | | // } |
| | | // if (Objects.isNull(map.get("batch"))) { |
| | | // throw new CoolException("批次不能为空!!"); |
| | | // } |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | } |