| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetl; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OrderOutBatchPreviewDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OrderOutMergeDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutDetlDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OutLocDto; |
| | | import com.zy.asrs.wms.asrs.entity.param.OrderOutMergeParam; |
| | | import com.zy.asrs.wms.asrs.entity.param.OutParam; |
| | | import com.zy.asrs.wms.asrs.service.LocDetlService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | OutLocDto locDto = entry.getValue(); |
| | | locDtos.add(locDto); |
| | | |
| | | List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locDto.getLocId())); |
| | | |
| | | Double sum = 0D; |
| | | for (LocDetl locDetl : list) { |
| | | sum += locDetl.getAnfme(); |
| | | } |
| | | |
| | | for (OutDetlDto detl : locDto.getDetls()) { |
| | | sum -= detl.getAnfme(); |
| | | } |
| | | |
| | | locDto.setAll(sum == 0); |
| | | Boolean all = this.isAllForOut(locDto.getLocId(), locDto.getDetls()); |
| | | locDto.setAll(all); |
| | | locDto.setOperationPort(outParam.getOperationPort()); |
| | | } |
| | | |
| | |
| | | return locDtos; |
| | | } |
| | | |
| | | public Boolean isAllForMerge(Long locId, List<OrderOutMergeDto> list) { |
| | | List<Double> anfmeList = new ArrayList<>(); |
| | | for (OrderOutMergeDto dto : list) { |
| | | anfmeList.add(dto.getAnfme()); |
| | | } |
| | | return isAll(locId, anfmeList); |
| | | } |
| | | |
| | | public Boolean isAllForPreview(Long locId, List<OrderOutBatchPreviewDto> list) { |
| | | List<Double> anfmeList = new ArrayList<>(); |
| | | for (OrderOutBatchPreviewDto outPreviewDto : list) { |
| | | anfmeList.add(outPreviewDto.getAnfme()); |
| | | } |
| | | return isAll(locId, anfmeList); |
| | | } |
| | | |
| | | public Boolean isAllForOut(Long locId, List<OutDetlDto> list) { |
| | | List<Double> anfmeList = new ArrayList<>(); |
| | | for (OutDetlDto dto : list) { |
| | | anfmeList.add(dto.getAnfme()); |
| | | } |
| | | return isAll(locId, anfmeList); |
| | | } |
| | | |
| | | private Boolean isAll(Long locId, List<Double> anfmeList) { |
| | | if (anfmeList.isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | | List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId)); |
| | | Double sum = 0D; |
| | | for (LocDetl locDetl : locDetls) { |
| | | sum += locDetl.getAnfme(); |
| | | } |
| | | |
| | | for (Double anfme : anfmeList) { |
| | | sum -= anfme; |
| | | } |
| | | |
| | | return sum <= 0; |
| | | } |
| | | |
| | | } |