| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.dto.ClinicOutboundGoodsDto; |
| | | import com.ruoyi.system.dto.OutboundGoodsNextDto; |
| | | import com.ruoyi.system.dto.WarehouseGoodsDto; |
| | | import com.ruoyi.system.dto.clinicWarehouseGoodsDto; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | @Override |
| | | public List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.pageList1(query,user); |
| | | if(list.isEmpty()){ |
| | | return list; |
| | | } |
| | | |
| | | |
| | | List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); |
| | | if(!typeIds.isEmpty()){ |
| | | List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); |
| | | tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void warehouseGoods(List<clinicWarehouseGoodsDto> dtos, SysUser user, String supplierClinicId) { |
| | | public void warehouseGoods(WarehouseGoodsDto dtos, SysUser user, String supplierClinicId) { |
| | | |
| | | // dtos根据供应商分组 |
| | | Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); |
| | | // Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); |
| | | |
| | | for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { |
| | | String key = stringListEntry.getKey(); |
| | | List<clinicWarehouseGoodsDto> value = stringListEntry.getValue(); |
| | | // for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { |
| | | TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing(); |
| | | tErpClinicWarehousing.setClinicId(supplierClinicId); |
| | | tErpClinicWarehousing.setCreateId(user.getUserId().toString()); |
| | | tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow()); |
| | | tErpClinicWarehousing.setCreateTime(LocalDateTime.now()); |
| | | tErpClinicWarehousing.setSupplierId(key); |
| | | tErpClinicWarehousing.setType(3); |
| | | tErpClinicWarehousing.setStatus(dtos.getStatus()); |
| | | this.save(tErpClinicWarehousing); |
| | | |
| | | BigDecimal totalPrice = new BigDecimal(0); |
| | | for (clinicWarehouseGoodsDto dto : value) { |
| | | for (clinicWarehouseGoodsDto dto : dtos.getDtos()) { |
| | | TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch(); |
| | | tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId()); |
| | | tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount()); |
| | | tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber()); |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate()); |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate()); |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setGoodsId(dto.getId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); |
| | | tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName()); |
| | |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | | this.updateById(tErpClinicWarehousing); |
| | | |
| | | } |
| | | // } |
| | | |
| | | } |
| | | |