| | |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.dto.GoodModelInfoDTO; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.pojo.response.FormOutputGoodsVO; |
| | | import com.consum.base.pojo.response.FormOutputVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWhFormOutputExtendVO; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhFormOutputService; |
| | |
| | | lWhFormOutputExtendVO.setDoc(lWhFormOutput.getOutputDoc()); |
| | | |
| | | List<GoodModelInfoDTO> goodsModelList = |
| | | lWhProcureModelService.getGoodsModelListByBusinessId(lWhFormOutputExtendVO.getId()); |
| | | lWhProcureModelService.getGoodsModelListByBusinessId(lWhFormOutputExtendVO.getId(), null); |
| | | if (CollectionUtils.isEmpty(goodsModelList)) { |
| | | return ResponseValue.success(lWhFormOutputExtendVO); |
| | | } |
| | | Map<Long, List<GoodModelInfoDTO>> collect = |
| | | goodsModelList.stream().collect(Collectors.groupingBy(GoodModelInfoDTO::getBaseGoodsTemplateId)); |
| | | List<FormOutputGoodsVO> fromOutputGoods = Lists.newArrayList(); |
| | | List<GoodsTemplateInfoVO> goodsTemplateInfoList = Lists.newArrayList(); |
| | | for (Map.Entry<Long, List<GoodModelInfoDTO>> entry : collect.entrySet()) { |
| | | FormOutputGoodsVO formOutputGoodsVO = getFormOutputGoodsVO(entry); |
| | | fromOutputGoods.add(formOutputGoodsVO); |
| | | GoodsTemplateInfoVO goodsTemplateInfoVO = getFormOutputGoodsVO(entry); |
| | | goodsTemplateInfoList.add(goodsTemplateInfoVO); |
| | | } |
| | | lWhFormOutputExtendVO.setFromOutputGoods(fromOutputGoods); |
| | | lWhFormOutputExtendVO.setFromOutputGoods(goodsTemplateInfoList); |
| | | |
| | | return ResponseValue.success("查询成功!", lWhFormOutputExtendVO); |
| | | } |
| | | |
| | | private static FormOutputGoodsVO getFormOutputGoodsVO(Entry<Long, List<GoodModelInfoDTO>> entry) { |
| | | private GoodsTemplateInfoVO getFormOutputGoodsVO(Entry<Long, List<GoodModelInfoDTO>> entry) { |
| | | Long baseGoodsTemplateId = entry.getKey(); |
| | | List<GoodModelInfoDTO> goodModelInfoDTOS = entry.getValue(); |
| | | GoodModelInfoDTO goodModelInfoDTO = goodModelInfoDTOS.stream().findFirst().orElse(null); |
| | | FormOutputGoodsVO formOutputGoodsVO = new FormOutputGoodsVO(); |
| | | GoodsTemplateInfoVO goodsTemplateInfoVO = new GoodsTemplateInfoVO(); |
| | | if (goodModelInfoDTO != null) { |
| | | formOutputGoodsVO.setId(baseGoodsTemplateId); |
| | | formOutputGoodsVO.setCategoryId(goodModelInfoDTO.getCategoryId()); |
| | | formOutputGoodsVO.setCategoryName(goodModelInfoDTO.getCategoryName()); |
| | | formOutputGoodsVO.setGoodsName(goodModelInfoDTO.getBaseGoodsModelsName()); |
| | | goodsTemplateInfoVO.setId(baseGoodsTemplateId); |
| | | goodsTemplateInfoVO.setCategoryName(goodModelInfoDTO.getCategoryName()); |
| | | goodsTemplateInfoVO.setGoodsName(goodModelInfoDTO.getBaseGoodsModelsName()); |
| | | } |
| | | List<GoodsModelVO> goodsModelList = Lists.newArrayList(); |
| | | for (GoodModelInfoDTO goodModelInfo : goodModelInfoDTOS) { |
| | |
| | | goodsModelVO.setBaseGoodsModelsName(goodModelInfo.getBaseGoodsModelsName()); |
| | | goodsModelVO.setUnit(goodModelInfo.getUnit()); |
| | | goodsModelVO.setCounts(goodModelInfo.getCounts()); |
| | | goodsModelVO.setTotalAmount(goodModelInfo.getTotalAmount()); |
| | | goodsModelVO.setTotalAmount(CurrencyUtil.convertFenToYuan(goodModelInfo.getTotalAmount())); |
| | | goodsModelList.add(goodsModelVO); |
| | | } |
| | | formOutputGoodsVO.setModels(goodsModelList); |
| | | return formOutputGoodsVO; |
| | | goodsTemplateInfoVO.setModels(goodsModelList); |
| | | return goodsTemplateInfoVO; |
| | | } |
| | | |
| | | @ApiOperation(value = "查询出库单详情明细", notes = "查询出库单详情明细") |