| | |
| | | package com.zy.asrs.wms.apis.wcs.services.Impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.apis.wcs.entity.domain.WaveTaskDetl; |
| | | import com.zy.asrs.wms.apis.wcs.entity.response.SowSeeds; |
| | | import com.zy.asrs.wms.apis.wcs.services.WaveManagentService; |
| | | import com.zy.asrs.wms.asrs.entity.CacheSite; |
| | | import com.zy.asrs.wms.asrs.entity.Order; |
| | | import com.zy.asrs.wms.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.wms.asrs.entity.Task; |
| | | import com.zy.asrs.wms.asrs.entity.dto.LargeScreenTaskDto; |
| | | import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; |
| | | import com.zy.asrs.wms.asrs.entity.param.WaveSeedReviewParam; |
| | | import com.zy.asrs.wms.asrs.mapper.CacheSiteMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.OrderDetlMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.OrderMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.TaskMapper; |
| | | import com.zy.asrs.wms.asrs.service.TaskService; |
| | | import com.zy.asrs.wms.asrs.service.WaveSeedService; |
| | | import org.aspectj.weaver.ast.Or; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class WaveManagentServiceImpl implements WaveManagentService { |
| | |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private TaskMapper taskMapper; |
| | | @Autowired |
| | | private OrderMapper orderMapper; |
| | | @Autowired |
| | | private OrderDetlMapper orderDetlMapper; |
| | | @Autowired |
| | | private CacheSiteMapper cacheSiteMapper; |
| | | |
| | | @Override |
| | | public R getSowSeeds() { |
| | |
| | | |
| | | @Override |
| | | public R getTask() { |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id)); |
| | | return R.ok(list); |
| | | List<LargeScreenTaskDto> taskDtos = taskMapper.getTaskIntegrateByTaskNo(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id)); |
| | | return R.ok(taskDtos); |
| | | } |
| | | |
| | | @Override |
| | | public R getTaskDetl(String taskNo) { |
| | | List<WaveTaskDetl> taskDetls = taskService.getTaskDetlByTaskNo(taskNo); |
| | | List<WaveTaskDetl> taskDetls = taskMapper.getTaskDetlByTaskNo(taskNo); |
| | | return R.ok(taskDetls); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getTaskDetlQutify(Map<String, Object> taskNo) { |
| | | List<WaveTaskDetl> taskDetls = taskService.getTaskDetlQutify(taskNo); |
| | | public R getTaskDetlQutify(String taskNo) { |
| | | List<WaveTaskDetl> taskDetls = taskMapper.getTaskDetlQutify(taskNo); |
| | | return R.ok(taskDetls); |
| | | } |
| | | |
| | | /** |
| | | * 获取波次下所有订单 |
| | | * @param waveNo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getAllOrders(String waveNo) { |
| | | if (StringUtils.isNullOrEmpty(waveNo)) { |
| | | throw new CoolException("波次编码不能为空!!"); |
| | | } |
| | | List<Order> orders = orderMapper.selectList(new LambdaQueryWrapper<Order>().eq(Order::getWaveNo, waveNo)); |
| | | if (orders.isEmpty()) { |
| | | throw new CoolException("当前波次下没有订单!!"); |
| | | } |
| | | |
| | | orders.forEach(order -> { |
| | | List<OrderDetl> detls = orderDetlMapper.selectList(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId())); |
| | | if (detls.isEmpty()) { |
| | | throw new CoolException("订单:" + order.getOrderNo() + " 没有明细,请联系管理员!!"); |
| | | } |
| | | List<OrderDetl> orderDetls = detls.stream().filter(orderDetl -> { |
| | | return orderDetl.getAnfme() == (orderDetl.getWorkQty() + orderDetl.getQty()); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | if (!orderDetls.isEmpty() && orderDetls.size() == detls.size()) { |
| | | order.setOrderStatus("已完成");//已完成 |
| | | } else if (orderDetls.size() < detls.size() && orderDetls.size() != 0) {//部分完成 |
| | | order.setOrderStatus("部分完成"); |
| | | } else {//未完成 |
| | | order.setOrderStatus("未完成"); |
| | | } |
| | | }); |
| | | |
| | | return R.ok(orders); |
| | | } |
| | | |
| | | /** |
| | | * 获了当前播种墙库位信息 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R AllSeedLocs() { |
| | | List<CacheSite> cacheSites = cacheSiteMapper.selectList(new LambdaQueryWrapper<CacheSite>()); |
| | | if (cacheSites.isEmpty()) { |
| | | return R.error("当前播种墙信息未设置!!"); |
| | | } |
| | | return R.ok(cacheSites); |
| | | } |
| | | } |