| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/3/26 |
| | |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | @PostMapping("/out/pakout/preview/auth") |
| | | public R pakoutPreview(@RequestBody List<Long> ids) { |
| | | if (Cools.isEmpty(ids)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | // 合并同类项 |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | Set<DetlDto> detlDtos = new HashSet<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (DetlDto.hasList(detlDtos, orderDetl)) { |
| | | DetlDto detlDto = DetlDto.find(detlDtos, orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | assert detlDto != null; |
| | | detlDto.setAnfme(detlDto.getAnfme() + orderDetl.getAnfme()); |
| | | } else { |
| | | detlDtos.add(new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())); |
| | | } |
| | | } |
| | | // |
| | | // List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getOrderNo()); |
| | | |
| | | return R.ok().add(orderDetls); |
| | | |
| | | } |