| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.erp.params.ReportDataParam; |
| | | import com.vincent.rsf.server.api.controller.erp.params.ReportParams; |
| | | import com.vincent.rsf.server.api.controller.erp.params.SaveCheckDiffParams; |
| | | import com.vincent.rsf.server.api.service.PdaCheckOrderService; |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | 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; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.manager.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.enums.*; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.system.constant.DictTypeCode; |
| | | import com.vincent.rsf.server.system.entity.DictData; |
| | | import com.vincent.rsf.server.system.entity.FieldsItem; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import com.vincent.rsf.server.system.service.DictTypeService; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsItemServiceImpl; |
| | | import com.vincent.rsf.server.system.service.impl.UserServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private MatnrService matnrService; |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | @Autowired |
| | | private ReportMsgService reportMsgService; |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | |
| | | @Override |
| | |
| | | .setMatnrCode(matnr.getCode()) |
| | | .setMaktx(matnr.getName()) |
| | | .setAnfme(0D) |
| | | .setCheckQty(0D) |
| | | ; |
| | | .setCheckQty(0D); |
| | | return R.ok(checkDiffItem); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * @param map |
| | | * @return com.vincent.rsf.framework.common.R |
| | | * @author Ryan |
| | | * 临时盘点提交ERP修改 |
| | | * @date 2025/11/5 20:49 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R tempCheckConfirm(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("任务状态不是等待确认"); |
| | | } |
| | | |
| | | task.setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTargLoc(task.getOrgLoc()) |
| | | .setTaskType(TaskType.TASK_TYPE_CHECK_IN.type) |
| | | .setUpdateTime(new Date()); |
| | | |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | |
| | | uploadCheckResult(task); |
| | | |
| | | return R.ok("提交成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上传盘点结果 |
| | | * @author Ryan |
| | | * @date 2025/11/5 21:50 |
| | | * @param task |
| | | */ |
| | | public void uploadCheckResult(Task task) { |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("任务不能为空!!"); |
| | | } |
| | | ReportParams params = new ReportParams(); |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | if (Objects.isNull(taskItems) || taskItems.isEmpty()) { |
| | | throw new CoolException("托盘明细为空!1"); |
| | | } |
| | | List<ReportDataParam> reportDataParams = new ArrayList<>(); |
| | | taskItems.forEach(taskItem -> { |
| | | ReportDataParam dataParam = new ReportDataParam(); |
| | | |
| | | User user = userService.getById(taskItem.getUpdateBy()); |
| | | String nickName = null; |
| | | if (!Objects.isNull(user)) { |
| | | nickName = user.getNickname(); |
| | | } |
| | | //获取索引内容 |
| | | Map<String, String> fields = FieldsUtils.getFields(taskItem.getFieldsIndex()); |
| | | //设置通用参数 |
| | | dataParam.setItemCode(taskItem.getMatnrCode()) |
| | | .setPDQty(taskItem.getAnfme()) |
| | | .setEditUser(nickName) |
| | | .setEditDate(taskItem.getUpdateTime()) |
| | | .setGoodsNO(fields.get("crushNo")) |
| | | .setIsBad(0 + "") |
| | | .setMemoDtl(taskItem.getMemo()); |
| | | |
| | | reportDataParams.add(dataParam); |
| | | }); |
| | | |
| | | params.setOrderType("PD_stock").setAction("Update").setData(reportDataParams); |
| | | |
| | | reportMsgService.uploadCheckOrder(params); |
| | | } |
| | | |
| | | } |