| | |
| | | |
| | | inventoryDetailVo.setGoodsName(goods.getGoodsName()); |
| | | TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); |
| | | if(tErpGoodsUnit!=null){ |
| | | if (tErpGoodsUnit != null) { |
| | | inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); |
| | | } |
| | | inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo()); |
| | |
| | | } |
| | | inventoryDetailVos.add(inventoryDetailVo); |
| | | |
| | | } |
| | | for (InventoryDetailVo inventoryDetailVo : inventoryDetailVos) { |
| | | if(inventoryDetailVo.getNowCount().equals(inventoryDetailVo.getInventoryCount())){ |
| | | inventoryDetailVo.setInventoryType(3); |
| | | } |
| | | } |
| | | |
| | | return inventoryDetailVos; |
| | |
| | | if (!supplierIds.isEmpty()) { |
| | | List<TCrmSupplier> supplierClinicList = crmSupplierMapper.selectBatchIds(supplierIds); |
| | | for (TErpGoodsVO tErpGoodsVO : list) { |
| | | supplierClinicList.stream().filter(t -> tErpGoodsVO.getGoodsSource()==1 && t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | supplierClinicList.stream().filter(t -> tErpGoodsVO.getGoodsSource() == 1 && t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName())); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | |
| | | // Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId)); |
| | | |
| | | // for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) { |
| | | if(dtos.getStatus()==null || dtos.getStatus()!=1 ){ |
| | | if (dtos.getStatus() == null || dtos.getStatus() != 1) { |
| | | // 草稿-》正式 移除所有草稿 |
| | | this.baseMapper.delete(new LambdaQueryWrapper<TErpClinicWarehousing>().eq(TErpClinicWarehousing::getClinicId,supplierClinicId).eq(TErpClinicWarehousing::getStatus,1)); |
| | | this.baseMapper.delete(new LambdaQueryWrapper<TErpClinicWarehousing>().eq(TErpClinicWarehousing::getClinicId, supplierClinicId).eq(TErpClinicWarehousing::getStatus, 1)); |
| | | } |
| | | |
| | | |
| | |
| | | tErpClinicWarehousing.setCreateId(user.getUserId().toString()); |
| | | |
| | | TErpClinicWarehousing last = this.getOne(new LambdaQueryWrapper<TErpClinicWarehousing>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicWarehousing::getWarehouseNo).last("LIMIT 1")); |
| | | if(last==null){ |
| | | tErpClinicWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else{ |
| | | if (last == null) { |
| | | tErpClinicWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow() + "00001"); |
| | | } else { |
| | | String lastProcurementCode = last.getWarehouseNo(); |
| | | String datePart = "G" + DateUtils.dateTimeNow(); |
| | | |
| | |
| | | tErpClinicWarehousing.setWarehousingType(2); |
| | | try { |
| | | this.save(tErpClinicWarehousing); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | |
| | | } |
| | | |
| | | |
| | | BigDecimal totalPrice = new BigDecimal(0); |
| | | ArrayList<String> names = new ArrayList<>(); |
| | | for (clinicWarehouseGoodsDto dto : dtos.getDtos()) { |
| | |
| | | tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId()); |
| | | tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount()); |
| | | tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber()); |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay()); |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); |
| | | if(dto.getProductionDate()!= null){ |
| | | tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay()); |
| | | } |
| | | if(dto.getExpiryDate()!=null){ |
| | | tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay()); |
| | | } |
| | | tErpClinicWarehousingBatch.setGoodsId(dto.getId()); |
| | | TErpGoods goods = erpGoodsMapper.selectById(dto.getId()); |
| | | String supplierName = goods.getSupplierName(); |
| | |
| | | erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch); |
| | | |
| | | |
| | | if (goods.getMaintenanceInterval() != null && !goods.getMaintenanceInterval().isEmpty()) { |
| | | if (goods.getMaintenanceInterval() != null && !goods.getMaintenanceInterval().isEmpty() && (dtos.getStatus()==null || dtos.getStatus() != 1)) { |
| | | TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); |
| | | tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId); |
| | | tErpMaintenanceReminder.setMaintenanceType(2); |
| | |
| | | erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder); |
| | | } |
| | | |
| | | |
| | | totalPrice = totalPrice.add(dto.getUnitAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | if(dto.getUnitAmount()!=null && dto.getPurchaseCount()!=null){ |
| | | totalPrice = totalPrice.add(dto.getUnitAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); |
| | | } |
| | | } |
| | | tErpClinicWarehousing.setTotalPrice(totalPrice); |
| | | String name = names.stream().collect(Collectors.joining(",")); |
| | | tErpClinicWarehousing.setSupplierName(name); |
| | | this.updateById(tErpClinicWarehousing); |
| | | |
| | | |
| | | // } |
| | | |
| | |
| | | tErpClinicOutbound.setClinicId(supplierClinicId); |
| | | tErpClinicOutbound.setCreateId(user.getUserId().toString()); |
| | | TErpClinicOutbound last = erpClinicOutboundMapper.selectOne(new LambdaQueryWrapper<TErpClinicOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpClinicOutbound::getOutboundNumber).last("limit 1")); |
| | | if(last==null){ |
| | | tErpClinicOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else{ |
| | | if (last == null) { |
| | | tErpClinicOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow() + "00001"); |
| | | } else { |
| | | String lastProcurementCode = last.getOutboundNumber(); |
| | | String datePart = "G" + DateUtils.dateTimeNow(); |
| | | |
| | |
| | | tErpClinicOutbound.setTypeNum(dto.getTypeNum()); |
| | | try { |
| | | erpClinicOutboundMapper.insert(tErpClinicOutbound); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | } |
| | | |
| | |
| | | tErpClinicOutboundGoods1.setWarehousingId(tErpClinicWarehousingBatch.getWarehousingId()); |
| | | tErpClinicOutboundGoods1.setWarehousingBatchId(batchId); |
| | | tErpClinicOutboundGoods1.setOutboundCount(outboundGoodsNextDto.getNum()); |
| | | if(tErpClinicWarehousingBatch.getUnitAmount()==null){ |
| | | if (tErpClinicWarehousingBatch.getUnitAmount() == null) { |
| | | tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getSalesAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); |
| | | }else { |
| | | } else { |
| | | tErpClinicOutboundGoods1.setTotalPrice(tErpClinicWarehousingBatch.getUnitAmount().multiply(BigDecimal.valueOf(outboundGoodsNextDto.getNum()))); |
| | | } |
| | | tErpClinicOutboundGoods1.setGoodsId(tErpClinicWarehousingBatch.getGoodsId()); |