| | |
| | | import com.jilongda.common.security.JwtTokenUtils; |
| | | import com.jilongda.common.utils.CodeGenerateUtils; |
| | | import com.jilongda.manage.dto.TWarehousingDTO; |
| | | import com.jilongda.manage.dto.TWarehousingLensDTO; |
| | | import com.jilongda.manage.model.TFrameWarehousingDetail; |
| | | import com.jilongda.manage.model.TLensWarehousingDetail; |
| | | import com.jilongda.manage.model.TWarehousing; |
| | | import com.jilongda.manage.query.TWarehousingDetailLensQuery; |
| | | import com.jilongda.manage.query.TWarehousingDetailQuery; |
| | | import com.jilongda.manage.service.TFrameWarehousingDetailService; |
| | | import com.jilongda.manage.service.TLensWarehousingDetailService; |
| | | import com.jilongda.manage.service.TWarehousingService; |
| | | import com.jilongda.manage.vo.TFrameWarehousingDetailVO; |
| | | import com.jilongda.manage.vo.TLensWarehousingDetailVO; |
| | | import com.jilongda.manage.vo.TWarehousingLensVO; |
| | | import com.jilongda.manage.vo.TWarehousingVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private TWarehousingService warehousingService; |
| | | @Autowired |
| | | private TFrameWarehousingDetailService frameWarehousingDetailService; |
| | | @Autowired |
| | | private TLensWarehousingDetailService lensWarehousingDetailService; |
| | | |
| | | /** |
| | | * 出入库单列表 |
| | |
| | | public ApiResult<PageInfo<TWarehousingVO>> inventoryReceiptList(@RequestBody TWarehousingDetailQuery query) { |
| | | return ApiResult.success(warehousingService.inventoryReceiptList(query)); |
| | | } |
| | | @ApiOperation(value = "镜片出入库单列表") |
| | | @PostMapping(value = "/inventoryReceiptLensList") |
| | | public ApiResult<PageInfo<TWarehousingLensVO>> inventoryReceiptLensList(@RequestBody TWarehousingDetailLensQuery query) { |
| | | return ApiResult.success(warehousingService.inventoryReceiptLensList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 库存明细记录列表 |
| | |
| | | @PostMapping(value = "/detailList") |
| | | public ApiResult<PageInfo<TFrameWarehousingDetailVO>> detailList(@RequestBody TWarehousingDetailQuery query) { |
| | | PageInfo<TFrameWarehousingDetailVO> frameWarehousingDetailVOPageInfo = warehousingService.detailList(query); |
| | | return ApiResult.success(frameWarehousingDetailVOPageInfo); |
| | | } |
| | | /** |
| | | * 库存明细记录列表 |
| | | */ |
| | | @ApiOperation(value = "镜片库存明细记录列表") |
| | | @PostMapping(value = "/detailLensList") |
| | | public ApiResult<PageInfo<TLensWarehousingDetailVO>> detailLensList(@RequestBody TWarehousingDetailLensQuery query) { |
| | | PageInfo<TLensWarehousingDetailVO> frameWarehousingDetailVOPageInfo = warehousingService.detailListLens(query); |
| | | return ApiResult.success(frameWarehousingDetailVOPageInfo); |
| | | } |
| | | |
| | |
| | | frameWarehousingDetailService.saveBatch(frameWarehousingDetails); |
| | | return ApiResult.success(); |
| | | } |
| | | /** |
| | | * 添加镜片出库,入库,作废,退货 |
| | | */ |
| | | @ApiOperation(value = "添加镜片出库,入库,作废,退货") |
| | | @PostMapping(value = "/outBoundLens") |
| | | public ApiResult<String> outBoundLens(@Validated @RequestBody TWarehousingLensDTO dto) { |
| | | // 获取当前用户 |
| | | String username = JwtTokenUtils.getUsername(); |
| | | dto.setCreateBy(username); |
| | | dto.setCreateTime(LocalDateTime.now()); |
| | | dto.setType(WarehousingTypeEnum.LENS.getCode()); |
| | | warehousingService.save(dto); |
| | | // 添加明细 |
| | | List<TLensWarehousingDetail> frameWarehousingDetails = dto.getLensWarehousingDetails(); |
| | | frameWarehousingDetails.forEach(detail -> { |
| | | detail.setWarehousingId(dto.getId()); |
| | | detail.setCode(WarehousingConstant.OUT_BOUND+CodeGenerateUtils.generateVolumeSn()); |
| | | }); |
| | | lensWarehousingDetailService.saveBatch(frameWarehousingDetails); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 查询详情 |
| | |
| | | vo.setTotalNum(list.stream().mapToInt(TFrameWarehousingDetail::getTotal).sum()); |
| | | return ApiResult.success(vo); |
| | | } |
| | | @ApiOperation(value = "镜片查询详情") |
| | | @GetMapping(value = "/getDetailLensById") |
| | | public ApiResult<TWarehousingLensVO> getDetailLensById(@RequestParam Integer id) { |
| | | TWarehousing warehousing = warehousingService.getById(id); |
| | | TWarehousingLensVO vo = new TWarehousingLensVO(); |
| | | BeanUtils.copyProperties(warehousing, vo); |
| | | List<TLensWarehousingDetail> list = lensWarehousingDetailService.list(Wrappers.lambdaQuery(TLensWarehousingDetail.class) |
| | | .eq(TLensWarehousingDetail::getWarehousingId, id)); |
| | | vo.setLensWarehousingDetails(list); |
| | | // 统计数量 |
| | | vo.setTotalNum(list.stream().mapToInt(TLensWarehousingDetail::getTotal).sum()); |
| | | return ApiResult.success(vo); |
| | | } |
| | | |
| | | } |
| | | |